Skip to content

Commit

Permalink
Add emoji action logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy-rifkin committed Jun 22, 2024
1 parent 765d0ce commit e4b3fd6
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions src/components/emoji-log.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import * as Discord from "discord.js";

import { strict as assert } from "assert";

import { M } from "../utils/debugging-and-logging.js";
import { colors } from "../common.js";
import { BotComponent } from "../bot-component.js";

export default class EmojiLog extends BotComponent {
override async on_emoji_create(emoji: Discord.GuildEmoji) {
await this.wheatley.channels.staff_action_log.send({
embeds: [
new Discord.EmbedBuilder()
.setTitle("Emoji Created")
.setThumbnail(emoji.imageURL())
.setColor(colors.green)
.setDescription(`New emoji has been made: \`:${emoji.name}:\``)
.setFooter({
text: `ID: ${emoji.id}`,
})
.setTimestamp(Date.now()),
],
});
}

override async on_emoji_delete(emoji: Discord.GuildEmoji) {
await this.wheatley.channels.staff_action_log.send({
embeds: [
new Discord.EmbedBuilder()
.setTitle("Emoji Removed")
.setThumbnail(emoji.imageURL())
.setColor(colors.red)
.setDescription(`Emoji has been deleted: \`:${emoji.name}:\``)
.setFooter({
text: `ID: ${emoji.id}`,
})
.setTimestamp(Date.now()),
],
});
}

override async on_emoji_update(old_emoji: Discord.GuildEmoji, new_emoji: Discord.GuildEmoji) {
await this.wheatley.channels.staff_action_log.send({
embeds: [
new Discord.EmbedBuilder()
.setTitle("Emoji Updated")
.setThumbnail(new_emoji.imageURL())
.setColor(colors.red)
.setDescription(`Emoji \`:${old_emoji.name}:\` was changed to \`:${new_emoji.name}:\``)
.setFooter({
text: `ID: ${new_emoji.id}`,
})
.setTimestamp(Date.now()),
],
});
}
}

0 comments on commit e4b3fd6

Please sign in to comment.