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:
ITOH
2023-04-03 15:52:34 +00:00
committed by GitHub
co-authored by Skillz4Killz
parent 7f9459b435
commit 088fd12513
2 changed files with 5 additions and 7 deletions
+4 -6
View File
@@ -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))
}