File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,11 @@ import {
55 listener ,
66} from 'cookiecord' ;
77import { Message , MessageReaction , GuildMember } from 'discord.js' ;
8- import { clearMessageOwnership , ownsBotMessage } from '../util/send' ;
8+ import {
9+ clearMessageOwnership ,
10+ DELETE_EMOJI ,
11+ ownsBotMessage ,
12+ } from '../util/send' ;
913
1014export class EtcModule extends Module {
1115 constructor ( client : CookiecordClient ) {
@@ -43,12 +47,14 @@ export class EtcModule extends Module {
4347
4448 @listener ( { event : 'messageReactionAdd' } )
4549 async onReact ( reaction : MessageReaction , member : GuildMember ) {
46- if (
47- reaction . emoji . name === '❌' &&
48- ownsBotMessage ( reaction . message , member . id )
49- ) {
50+ if ( reaction . emoji . name !== DELETE_EMOJI ) return ;
51+ if ( member . id === this . client . user ?. id ) return ;
52+
53+ if ( ownsBotMessage ( reaction . message , member . id ) ) {
5054 clearMessageOwnership ( reaction . message ) ;
5155 await reaction . message . delete ( ) ;
56+ } else {
57+ await reaction . remove ( ) ;
5258 }
5359 }
5460}
Original file line number Diff line number Diff line change @@ -4,11 +4,15 @@ const MAX_TRACKED_MESSAGES = 1000;
44
55const messageToUserId = new Map < string , string > ( ) ;
66
7+ export const DELETE_EMOJI = '🗑️' ;
8+
79export async function sendWithMessageOwnership (
810 message : Message ,
911 toSend : string | { embed : MessageEmbed } ,
1012) {
1113 const sent = await message . channel . send ( toSend ) ;
14+ await sent . react ( DELETE_EMOJI ) ;
15+
1216 addMessageOwnership ( sent , message . author ) ;
1317}
1418
You can’t perform that action at this time.
0 commit comments