-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
executable file
·48 lines (34 loc) · 1.07 KB
/
main.py
File metadata and controls
executable file
·48 lines (34 loc) · 1.07 KB
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
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python3
import modules.help
import modules.rpn
import modules.weather
import modules.quotes
import telebot
with open("token", "r") as token:
bot = telebot.TeleBot(token.readlines()[0].strip())
@bot.message_handler(commands=["Corder", "C", "c"])
def handle_commands(message):
content = message.text.split(" ", maxsplit=1)[-1]
print(content)
if len(message.text.split(" ")) == 1:
modules.help.send_help(bot, message)
return
if "help" in content.lower():
modules.help.send_help(bot, message)
return
if content.lower().startswith("rpn"):
modules.rpn.calculate(bot, message)
return
if content.lower().startswith("weather"):
modules.weather.weather(bot, message)
return
if "ice" in content.lower() and "water" in content.lower():
modules.quotes.ice(bot, message)
return
bot.send_message(message.chat.id, "Command not recognized.")
def main():
print("Starting bot")
bot.polling()
print("Shutting down")
if __name__ == "__main__":
main()