# A telegram bot in Julia

By: Akako L

Re-posted from: https://blog.moelf.xyz/a-telegram-bot-in-julia/

I just want to see source code.

Fetching and replying of telegram bot messages can be handle by HTTP.jl easily, unless you forget to escape uri with percentages. Because the main use case is to respond to commands in telegram, I used a Dict() approach where we give the bot a dictionary of functions so that whenever it sees matching commands, it will reply with the result of that function (given parameter).

using telegram

botApi = "<your_api>"

function echo(incoming::AbstractString)
return incoming
end

txtCmds = Dict()
txtCmds["repeat_msg"] = echo #this will respond to '/repeat_msg <any thing>'
txtCmds["start"] = x -> "Welcome to my bot" # this will respond to '/start'

telegram.startBot(botApi; textHandle = txtCmds)


The inline mode is still missing, any help is appreciated!