command
Catches a Telegram command, which has been specified as an argument.
Platform | Supported |
---|---|
Messenger | |
WhatsApp | |
Telegram |
class MainContext < Conversation
def blocks
command :start do
@reply.text "Hello and welcome!"
end
end
In order to be implemented in Kogno, the commands must be created first in Telegram through the BotFather or well, by defining them in the configuration file
config/platforms/telegram.rb
by modifying config.telegram.commands
field. config.telegram.commands = [
{
scope: :default,
commands:{
start: "Start chat",
featured_products: "List featured products."
}
},
{
scope: :all_chat_administrators,
commands:{
update_products: "Update products from server.",
purchase_count: "Sales today."
}
}
]
Available scopes are:
:default
, :all_private_chats
, :all_group_chats
and :all_chat_administrators
. Read more about Commands Scopes on Telegram.Once configured, these changes must be sent to Telegram by running the following command in terminal.
kogno telegram set_commands all
kogno telegram set_commands all_chat_administrators
Last modified 6mo ago