Skip to content

annotation Tourmaline::Annotations::Command #

Define a new Command. By default all commands start with a / and commands are accessable to all chat types. You can change these defaults by supplying named parameters to the annotation.

Options:

commands
the command(s) to use. should be a prefixless string or symbol.
prefix
the prefix for this command. defaults to /.
remove_leading
if true the text value passed to the command context will not include the command, if the command is at the beginning. defaults to true.
private_only
if true this command will only be allowed inside of private chats.
group_only
if true this command will only be allowed inside of groups.

Example:

@[Command("help", prefix: "!", private_only: true)]
def help_command(client, update)
  update.message.not_nil!.reply("This is a help message")
end