Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: status default #249

Merged
merged 3 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading