aboutsummaryrefslogtreecommitdiffstats
path: root/radiodiodibot.py
blob: ce8abf5dc6c21fd793d4403a970ac7a3092e94ca (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
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/env python

import sys, argparse
import botmanager
import logging

logging.basicConfig(level=logging.INFO)

# Make a globally accessible bot instance
bot = None

# Boolean to track whether the bot has been /started or /stopped
started = False

# Try to import telepot
# If not installed, inform user and fail gracefully
try:
    import telepot
except:
    print("radiodiodibot needs the telepot module to communicate with Telegram.")
    print("Please install telepot before using radiodiodibot.")
    sys.exit()

# Entry point
def main():

    # Get the bot token as an argument from the user
    parser = argparse.ArgumentParser(description="Telegram bot for the Radiodiodi Student Radio broadcast.")
    parser.add_argument("telegram_bot_token")
    args = parser.parse_args()

    token = args.telegram_bot_token

    manager = botmanager.BotManager(token)
    manager.start()

if __name__ == "__main__":
    main()