-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
37 lines (21 loc) · 1.21 KB
/
bot.py
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
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
updater = Updater(token='999651935:AAGi5RcJ08qR90m8G-0xXp26q_ZC5P0-CzM', use_context=True)
def start(update, context):
context.bot.send_message(chat_id=update.effective_chat.id, text="Olá, sou o bot do Python Day 2019!")
def hello(update, context):
context.bot.send_message(chat_id=update.effective_chat.id, text="world!")
def echo(update, context):
context.bot.send_message(chat_id=update.effective_chat.id, text=update.message.text)
def caps(update, context):
text_caps = " ".join(context.args).upper()
context.bot.send_message(chat_id=update.effective_chat.id, text=text_caps)
def unknown(update, context):
context.bot.send_message(chat_id=update.effective_chat.id, text="Não reconheci esse comando 😅")
updater.dispatcher.add_handler(CommandHandler('start', start))
updater.dispatcher.add_handler(CommandHandler('hello', hello))
updater.dispatcher.add_handler(MessageHandler(Filters.text, echo))
updater.dispatcher.add_handler(CommandHandler('caps', caps))
updater.dispatcher.add_handler(MessageHandler(Filters.command, unknown))
if __name__ == "__main__":
print("Meu bot está rodando!")
updater.start_polling()