Guild-only Commands
Sometimes your command can only be executed in a guild context.
For those cases Discapp alows you to mark commands as guild-only, this means trying to execute this command from the bot private chat, for example, will not work.
In this chapter we will code the MakeChannelCommand
that receives the name of the channel as argument and creates it.
MakeChannelCommand
#
Writing the Notice that we've added an argument to our @Command()
decorator before the class declaration.
Actually this argument can receive lots of data about your command, tha are covered in another chapters.
Also notice the @Guild()
decorator that allows us to retrieve the Guild.
MakeChannelCommand
#
Testing the You can test the MakeChannelCommand
by sending:
Your bot should create a channel called new-channel
.
danger
Make sure yout bot has the permissions for creating a channel.
In the chapter Command Permissions you can learn more about it.