import asyncdispatch, telebot, posix, os include updateHandler import cmd/[animalpics, daysuntilcongress, debuginfo, ds100, help, httpstatuscode, sarcasm, stats, unixtime, utc, uptime, whoami, yesorno] proc CtrlCHook() {.noconv.} = echo "Ctrl+C fired! \nStopping bot now!" quit() proc main = # for gcsafe setControlCHook(CtrlCHook) onSignal(SIGTERM): echo "Got SIGTERM! \nStopping bot now!" quit() if getEnv("DATA_PATH") == "": echo "DATA_PATH not set." quit() if getEnv("ASSETS_PATH") == "": echo "ASSETS_PATH not set." quit() if getEnv("API_KEY") != "": let bot = newTeleBot(getEnv("API_KEY")) bot.onUpdate(updateHandler) bot.onCommand("daysuntilcongress", daysUntilCongressCommand) bot.onCommand("fox", animalCommand(fox, false)) bot.onCommand("penguin", animalCommand(penguin, false)) bot.onCommand("dog", animalCommand(dog, false)) bot.onCommand("doggo", animalCommand(dog, false)) bot.onCommand("cat", animalCommand(cat, false)) bot.onCommand("catgif", animalCommand(cat, true)) bot.onCommand("flauschehorn", animalCommand(flauschehorn, false)) bot.onCommand("debuginfo", debuginfoCommand) bot.onCommand("help", helpCommand) bot.onCommand("stats", statsCommand) bot.onCommand("unixtime", unixtimeCommand) bot.onCommand("utc", utcCommand) bot.onCommand("uptime", uptimeCommand) bot.onCommand("yesorno", yesornoCommand) bot.onCommand("whoami", whoamiCommand) bot.onCommand("s", sarcasmCommand) bot.onCommand("httpstatuscode", httpstatuscodeCommand) bot.onCommand("ds100", ds100Command) bot.poll(timeout=300) else: echo "No API_KEY given!" main()