File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -203,6 +203,27 @@ export class HelpChanModule extends Module {
203203
204204 this . busyChannels . add ( msg . channel . id ) ;
205205
206+ let lastMessage = msg . channel . messages . cache
207+ . array ( )
208+ . reverse ( )
209+ . find ( m => m . author . id === this . client . user ?. id ) ;
210+
211+ if ( ! lastMessage )
212+ lastMessage = ( await msg . channel . messages . fetch ( { limit : 5 } ) )
213+ . array ( )
214+ . reverse ( )
215+ . find ( m => m . author . id === this . client . user ?. id ) ;
216+
217+ let embed = this . occupiedEmbed ( msg . author ) ;
218+
219+ if ( lastMessage ) {
220+ // If there is a last message (the available message) by the bot, edit it
221+ await lastMessage . edit ( embed ) ;
222+ } else {
223+ // Otherwise, just send a new message
224+ await msg . channel . send ( embed ) ;
225+ }
226+
206227 await msg . pin ( ) ;
207228 await this . addCooldown ( msg . member , msg . channel ) ;
208229 await this . moveChannel ( msg . channel , categories . ongoing ) ;
You can’t perform that action at this time.
0 commit comments