You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
567 B
26 lines
567 B
module Bot
|
|
|
|
export find_username
|
|
|
|
using Logging
|
|
using Telegram, Telegram.API
|
|
import ..fetch_in_env
|
|
|
|
TG_TOKEN = fetch_in_env("TG_TOKEN_MARKOV")
|
|
CHAT_ID = parse(Int, fetch_in_env("TG_CHAT_ID"))
|
|
|
|
TELEGRAM_BOT = TelegramClient(TG_TOKEN, use_globally=false)
|
|
|
|
function find_username(user_id)
|
|
global TELEGRAM_BOT, CHAT_ID
|
|
@debug "Fetching user" user_id
|
|
u = getChatMember(TELEGRAM_BOT, user_id=user_id, chat_id=CHAT_ID)
|
|
u[:user][:username]
|
|
end
|
|
|
|
function register_command(commands...)
|
|
global TELEGRAM_BOT
|
|
setMyCommands(TELEGRAM_BOT, commands)
|
|
end
|
|
|
|
end
|
|
|