Skip to content

Commit

Permalink
fix: status default (#249)
Browse files Browse the repository at this point in the history
* fix: status default

* Create fresh-apricots-train.md

* fix: types
  • Loading branch information
zaida04 authored Apr 8, 2024
1 parent f0988da commit d923a92
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/fresh-apricots-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"guilded.js": patch
---

fix: status default
6 changes: 3 additions & 3 deletions packages/guilded.js/lib/structures/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,23 +231,23 @@ export class Client extends (EventEmitter as unknown as new () => TypedEmitter<C
emoteId: number;
expiresAt?: Date | number | string;
}): Promise<void> {
let resolvedDate: Date;
let resolvedDate: Date | undefined;
if (options.expiresAt instanceof Date) {
resolvedDate = options.expiresAt;
} else if (typeof options.expiresAt === "string") {
resolvedDate = new Date(options.expiresAt);
} else if (typeof options.expiresAt === "number") {
resolvedDate = new Date(Date.now() + options.expiresAt);
} else {
resolvedDate = new Date(Date.now());
resolvedDate = options.expiresAt;
}

await this.rest.router.userStatus.userStatusCreate({
userId: this.user!.id,
requestBody: {
content: options.content,
emoteId: options.emoteId,
expiresAt: resolvedDate.toISOString() ?? undefined,
expiresAt: resolvedDate?.toISOString() ?? undefined,
},
});
}
Expand Down

0 comments on commit d923a92

Please sign in to comment.