mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
fix(bot)!: rename auditLogEntryCreate to guildAuditLogEntryCreate (#2952)
* fix(bot)!: rename `auditLogEntryCreate` to `guildAuditLogEntryCreate` * need to start small Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com> * also remove this * suggestions --------- Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>
This commit is contained in:
@@ -43,12 +43,10 @@ export function createBot(options: CreateBotOptions): Bot {
|
||||
|
||||
// RUN DISPATCH CHECK
|
||||
await bot.events.dispatchRequirements?.(data, shard.id)
|
||||
bot.events[
|
||||
data.t.toLowerCase().replace(/_([a-z])/g, function (g) {
|
||||
return g[1].toUpperCase()
|
||||
}) as keyof EventHandlers
|
||||
bot.handlers[
|
||||
data.t as keyof ReturnType<typeof createBotGatewayHandlers>
|
||||
// @ts-expect-error as any gets removed by linter
|
||||
]?.(data.d, shard.id)
|
||||
]?.(bot, data.d, shard.id)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,7 +121,7 @@ export interface Bot {
|
||||
export interface EventHandlers {
|
||||
debug: (text: string, ...args: any[]) => unknown
|
||||
applicationCommandPermissionsUpdate: (command: ApplicationCommandPermission) => unknown
|
||||
auditLogEntryCreate: (log: AuditLogEntry, guildId: bigint) => unknown
|
||||
guildAuditLogEntryCreate: (log: AuditLogEntry, guildId: bigint) => unknown
|
||||
automodRuleCreate: (rule: AutoModerationRule) => unknown
|
||||
automodRuleUpdate: (rule: AutoModerationRule) => unknown
|
||||
automodRuleDelete: (rule: AutoModerationRule) => unknown
|
||||
|
||||
@@ -4,5 +4,5 @@ import type { Bot } from '../../bot.js'
|
||||
export async function handleGuildAuditLogEntryCreate(bot: Bot, data: DiscordGatewayPayload): Promise<void> {
|
||||
// TODO: better type here
|
||||
const payload = data.d as DiscordAuditLogEntry & { guild_id: string }
|
||||
bot.events.auditLogEntryCreate?.(bot.transformers.auditLogEntry(bot, payload), bot.transformers.snowflake(payload.guild_id))
|
||||
bot.events.guildAuditLogEntryCreate?.(bot.transformers.auditLogEntry(bot, payload), bot.transformers.snowflake(payload.guild_id))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user