Skip to content

Secure and non secure commands

r0ann3l edited this page Apr 10, 2019 · 2 revisions

Attending to the users that can use the commands, these can be classified in two types: secure and non-secure commands. Non-secure commands are those that can be executed by any users. While the secure commands are those that can only be executed by users authorized by the bot.

By default, all commands are secure, except the /whoami command (included in the default commands). This command helps the user to know their chat ID. Normally, this identifier should be sent to bot administrators, so they can add it as authorized user.

The property telegram.commands.non-secure is used to control the non-secure commands available in your bot. You can specify the commands as a comma separated list, such as: telegram.commands.non-secure=command1,command2. But sometimes, a comma separated list could be clumsy for real world, so you can write it as a list too (starting at 0):

telegram.commands.non-secure[0]=command1
telegram.commands.non-secure[1]=command2

In addition, for your own commands you can set the secure attribute of the @TelegramCommand annotation to false as shown in OwnHelpCommand.java.