Skip to content

Commit 47802b3

Browse files
Merge pull request #458 from Would-You-Bot/cluster-dm
feat: add interaction logging
2 parents b704539 + af14372 commit 47802b3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/events/interactionCreate.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ const event: Event = {
88
event: "interactionCreate",
99
execute: async (client: WouldYou, interaction: Interaction) => {
1010
const user = await UserModel.findOne({ userID: interaction.user?.id });
11-
1211
if (!user) {
1312
await UserModel.create({
1413
userID: interaction.user?.id,
1514
});
1615
}
17-
16+
1817
if (interaction.isChatInputCommand()) {
18+
console.log(`[INFO] INTERACTION ${interaction.id} RUN BY (${interaction.user.id}, ${interaction.user.globalName}) COMMAND ${interaction.commandName}`)
1919
const command = client.commands.get(interaction.commandName);
2020
if (!interaction.guild) {
2121
if (command?.requireGuild) {
@@ -69,6 +69,7 @@ const event: Event = {
6969
return;
7070
});
7171
} else if (interaction.isButton()) {
72+
console.log(`[INFO] INTERACTION ${interaction.id} RUN BY (${interaction.user.id}, ${interaction.user.globalName}) CLICKED ${interaction.customId}`)
7273
const guildDb = await client.database.getGuild(
7374
interaction.guildId as string,
7475
true,
@@ -318,6 +319,7 @@ const event: Event = {
318319
interaction.isMentionableSelectMenu() ||
319320
interaction.isChannelSelectMenu()
320321
) {
322+
console.log(`[INFO] INTERACTION ${interaction.id} RUN BY (${interaction.user.id}, ${interaction.user.globalName}) MENU ${interaction.customId}`)
321323
const guildDb = await client.database.getGuild(
322324
interaction.guildId as string,
323325
true,

0 commit comments

Comments
 (0)