mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-02 04:56:07 +00:00
fix: message structure types
This commit is contained in:
parent
d2157e7324
commit
5f61e8e66b
@ -43,12 +43,12 @@ export class Collectors {
|
||||
}
|
||||
|
||||
create<T extends SnakeCaseClientNameEvents>(options: RunData<T>['options']) {
|
||||
const nonce = this.generateRandomUUID(options.event);
|
||||
|
||||
if (!this.values.has(options.event)) {
|
||||
this.values.set(options.event, []);
|
||||
}
|
||||
|
||||
const nonce = this.generateRandomUUID(options.event);
|
||||
|
||||
this.values.get(options.event)!.push({
|
||||
options: {
|
||||
...options,
|
||||
|
@ -24,11 +24,10 @@ export type MessageData = APIMessage | GatewayMessageCreateDispatchData;
|
||||
|
||||
export interface BaseMessage
|
||||
extends DiscordBase,
|
||||
ObjectToLower<Omit<MessageData, 'timestamp' | 'author' | 'mentions' | 'components' | 'poll' | 'embeds'>> {}
|
||||
export class BaseMessage extends DiscordBase {
|
||||
guildId: string | undefined;
|
||||
ObjectToLower<Omit<MessageData, 'timestamp' | 'author' | 'mentions' | 'components' | 'poll' | 'embeds'>> {
|
||||
timestamp?: number;
|
||||
author!: User;
|
||||
guildId?: string;
|
||||
author: User;
|
||||
member?: GuildMember;
|
||||
components: MessageActionRowComponent<ActionRowMessageComponents>[];
|
||||
poll?: Poll;
|
||||
@ -37,6 +36,8 @@ export class BaseMessage extends DiscordBase {
|
||||
channels: APIChannelMention[];
|
||||
users: (GuildMember | User)[];
|
||||
};
|
||||
}
|
||||
export class BaseMessage extends DiscordBase {
|
||||
embeds: InMessageEmbed[];
|
||||
|
||||
constructor(client: UsingClient, data: MessageData) {
|
||||
@ -77,21 +78,10 @@ export class BaseMessage extends DiscordBase {
|
||||
}
|
||||
|
||||
private patch(data: MessageData) {
|
||||
if ('guild_id' in data) {
|
||||
this.guildId = data.guild_id;
|
||||
}
|
||||
|
||||
if (data.type !== undefined) {
|
||||
this.type = data.type;
|
||||
}
|
||||
|
||||
if ('timestamp' in data && data.timestamp) {
|
||||
this.timestamp = Date.parse(data.timestamp);
|
||||
}
|
||||
|
||||
if ('application_id' in data) {
|
||||
this.applicationId = data.application_id;
|
||||
}
|
||||
if ('author' in data && data.author) {
|
||||
this.author = new User(this.client, data.author);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user