Retrieving the Guild of the Message
Sometimes it's usefull to have the guild of where the message was sent.
For demonstrating how you can do this using Discapp we will code the AboutCommand
that will display information about your server.
AboutCommand
#
The path/to/your/app/src/Commands/AboutCommand.ts
Couple of things to notice:
- The Guild will only be avaible if the command was executed in a guild context, otherwise it'll be
null
. - If your command really needs the guild, then mark then set
isGuildOnly
totrue
.
AboutCommand
#
Testing the You can test the AboutCommand
by sending:
Your bot should respond with a message with the title, description, icon and creation date of your server.