feat: add tag mentions and deletions
This commit is contained in:
parent
6673a8a36c
commit
ff5882730d
3 changed files with 38 additions and 2 deletions
28
src/index.ts
28
src/index.ts
|
@ -1,4 +1,10 @@
|
|||
import { Client, GatewayIntentBits, Partials, OAuth2Scopes } from 'discord.js';
|
||||
import {
|
||||
Client,
|
||||
GatewayIntentBits,
|
||||
Partials,
|
||||
OAuth2Scopes,
|
||||
InteractionType,
|
||||
} from 'discord.js';
|
||||
import { reuploadCommands } from './_reupload';
|
||||
|
||||
import * as BuildConfig from './constants';
|
||||
|
@ -125,6 +131,26 @@ client.on('interactionCreate', async (interaction) => {
|
|||
}
|
||||
});
|
||||
|
||||
client.on('messageReactionAdd', async (reaction, user) => {
|
||||
if (reaction.partial) {
|
||||
try {
|
||||
await reaction.fetch();
|
||||
} catch (error) {
|
||||
console.error('Something went wrong when fetching the message:', error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
reaction.message.interaction &&
|
||||
reaction.message.interaction?.type === InteractionType.ApplicationCommand &&
|
||||
reaction.message.interaction?.user === user &&
|
||||
reaction.emoji.name === '❌'
|
||||
) {
|
||||
await reaction.message.delete();
|
||||
}
|
||||
});
|
||||
|
||||
reuploadCommands()
|
||||
.then(() => {
|
||||
client.login(process.env.DISCORD_TOKEN);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue