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

Add missing sent date tag #332

Merged
merged 2 commits into from
Feb 6, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ export class ClearChat extends Message<ClearChat> {
})
user!: MessageParam;

get date(): Date {
const timestamp = this._tags.get('tmi-sent-ts')!;
return new Date(Number(timestamp));
}

get channelId(): string {
return this._tags.get('room-id')!;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ export class UserNotice extends Message<UserNotice> {
return this._tags.get('id')!;
}

get date(): Date {
const timestamp = this._tags.get('tmi-sent-ts')!;
return new Date(Number(timestamp));
}

get userInfo(): ChatUser {
return new ChatUser(this._tags.get('login')!, this._tags);
}
Expand Down
5 changes: 5 additions & 0 deletions packages/chat/src/caps/twitchTags/messageTypes/ClearMsg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ export class ClearMsg extends Message<ClearMsg> {
})
message!: MessageParam;

get date(): Date {
const timestamp = this._tags.get('tmi-sent-ts')!;
return new Date(Number(timestamp));
}

get userName(): string {
return this._tags.get('login')!;
}
Expand Down
8 changes: 8 additions & 0 deletions packages/chat/src/commands/TwitchPrivateMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ export class TwitchPrivateMessage extends MessageTypes.Commands.PrivateMessage {
return this._tags.get('id')!;
}

/**
* The date the message was sent at.
*/
get date(): Date {
const timestamp = this._tags.get('tmi-sent-ts')!;
return new Date(Number(timestamp));
}

/**
* Info about the user that send the message, like their user ID and their status in the current channel.
*/
Expand Down