diff --git a/packages/core/src/Structures/VoiceState.ts b/packages/core/src/Structures/VoiceState.ts index 16c7065e..6de364d9 100644 --- a/packages/core/src/Structures/VoiceState.ts +++ b/packages/core/src/Structures/VoiceState.ts @@ -9,7 +9,7 @@ export class VoiceState extends Base> { } public get guildId(): string { - return this.data.guildId!; + return this.data.guildId; } public get channelId(): string { diff --git a/services/kanao-gateway/src/Listeners/Caches/Messages/MessageCreateListener.ts b/services/kanao-gateway/src/Listeners/Caches/Messages/MessageCreateListener.ts index 056f8545..b62d5a4f 100644 --- a/services/kanao-gateway/src/Listeners/Caches/Messages/MessageCreateListener.ts +++ b/services/kanao-gateway/src/Listeners/Caches/Messages/MessageCreateListener.ts @@ -80,26 +80,6 @@ export class MessageCreateListener extends Listener { } }); - if (stateMessages) { - await this.store.drizzle.insert(messages).values({ - id: payload.data.d.id, - channelId: payload.data.d.channel_id, - content: payload.data.d.content, - applicationId: payload.data.d.application_id, - authorId: payload.data.d.author.id, - editedTimestamp: payload.data.d.edited_timestamp, - flags: payload.data.d.flags, - type: payload.data.d.type, - mentionEveryone: payload.data.d.mention_everyone, - pinned: payload.data.d.pinned, - position: payload.data.d.position, - timestamp: payload.data.d.timestamp, - tts: payload.data.d.tts, - webhookId: payload.data.d.webhook_id, - nonce: payload.data.d.nonce?.toString() - }).onConflictDoNothing({ target: messages.id }); - } - if (payload.data.d.member.roles.length > 0) { await this.store.drizzle.insert(memberRoles).values(payload.data.d.member.roles.map(role => ({ memberId: payload.data.d.author.id, @@ -109,6 +89,26 @@ export class MessageCreateListener extends Listener { } } + if (stateMessages) { + await this.store.drizzle.insert(messages).values({ + id: payload.data.d.id, + channelId: payload.data.d.channel_id, + content: payload.data.d.content, + applicationId: payload.data.d.application_id, + authorId: payload.data.d.author.id, + editedTimestamp: payload.data.d.edited_timestamp, + flags: payload.data.d.flags, + type: payload.data.d.type, + mentionEveryone: payload.data.d.mention_everyone, + pinned: payload.data.d.pinned, + position: payload.data.d.position, + timestamp: payload.data.d.timestamp, + tts: payload.data.d.tts, + webhookId: payload.data.d.webhook_id, + nonce: payload.data.d.nonce?.toString() + }).onConflictDoNothing({ target: messages.id }); + } + await this.store.amqp.publish(RabbitMQ.GATEWAY_QUEUE_SEND, RoutingKey(clientId, payload.shardId), Buffer.from(JSON.stringify(payload.data))); } }