summaryrefslogtreecommitdiff
path: root/tgbot.py
blob: ccc8738d273dfd8736449ca3c53b2f858afee6fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/python3

import os
from telebot import TeleBot
from fortniteStatusWrapper import formatFortniteStatus
from pythonFortniteStatus.FortniteStatus import *

if "TELEBOT_BOT_TOKEN" not in os.environ:
    raise AssertionError("Please configure TELEBOT_BOT_TOKEN as environment variables")

bot = TeleBot(os.environ["TELEBOT_BOT_TOKEN"])
fortniteStatus = FortniteStatus()

@bot.message_handler(commands = ['start'])
def startCommand(message):
    bot.reply_to(message, "This bot is doing nothing so far..")

@bot.message_handler(commands = ['status'])
def fortniteStatusCommand(message):
    bot.send_message(
        message.chat.id,
        formatFortniteStatus(fortniteStatus.getStatus()),
        parse_mode='MarkdownV2'
    )

bot.polling(none_stop=True, interval=0)