forked from Kylmakalle/heroku-telegram-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
54 lines (40 loc) · 1.32 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# -*- coding: utf-8 -*-
#import redis
import os
from typing import Optional
import telebot
import time
import random
from telebot.types import User
token = os.environ['TELEGRAM_TOKEN']
API_TOKEN = token
polear = False
bot = telebot.TeleBot(API_TOKEN)
# Handle '/start' and '/help'
@bot.message_handler(commands=['help', 'start'])
def send_welcome(message):
bot.reply_to(message, "Hola mi dueño se avergüenza de mi.")
@bot.message_handler(commands=['users'])
def fill_redis_users(message):
bot.reply_to(message, f"@{message['from_user']['first_name']}")
@bot.message_handler(commands=['pole'])
def toca_polear(message):
global polear
bot.send_message(message.chat.id, "En sus puestos")
bot.send_message(message.chat.id, "3")
time.sleep(1)
bot.send_message(message.chat.id, "2")
time.sleep(1)
bot.send_message(message.chat.id, "1")
time.sleep(random.random()+0.5)
bot.send_message(message.chat.id, "GO POLE GO")
polear=True
# Handle all other messages with content_type 'text' (content_types defaults to ['text'])
@bot.message_handler(func=lambda message: message.text=='pole' or message.text=="oro")
def echo_message(message):
global polear
if polear==True :
polear = False
print(message.message_id)
bot.reply_to(message, 'aquí la pole')
bot.polling()