Current section

Files

Jump to
ex_gram templates bot.ex
Raw

templates/bot.ex

defmodule <%= app_module %>.Bot do
@bot <%= inspect(app) %>
use ExGram.Bot,
name: @bot,
setup_commands: true
command("start")
command("help", description: "Print the bot's help")
middleware(ExGram.Middleware.IgnoreUsername)
def handle({:command, :start, _msg}, context) do
answer(context, "Hi!")
end
def handle({:command, :help, _msg}, context) do
answer(context, "Here is your help:")
end
end