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