Retrieving the Channel of the Message
Sometimes it's useful to retrieve the channel in which the message was sent.
For demonstrating how you can retrieve the channel from a Discord.js command we will code the ClearChannelCommand
that will delete messages from the channel the message was sent.
ClearChannelCommand
#
Writing the path/to/your/app/src/Commands/ClearChannelCommand.ts
The ClearChannelCommand
will try to delete all the latest 100 message (in parallel).
ClearChannelCommand
#
Testing the You can test the command by sending:
This should delete by arround 100 messages from the channel you send this command.