Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
41 lines (37 sloc) 1.47 KB
import telebot
from local_settings import tgbot_token
from local_settings import allowed_users
from threading import Thread
from time import sleep
class TGCoffeeBot:
def __init__(self, receiver):
self.uid = allowed_users[0] = telebot.TeleBot(tgbot_token), "This is your coffee machine speaking. I am awake!") message: True)
def msghandler(message):
if not in allowed_users:
print message.from_user.first_name,message.from_user.last_name,,"is unknown"
if message.text.lower() == 'hi' or message.text.lower() == 'hello':
self.sender("Hi! I'm a teapot!",1)
self.sender("I mean... HTTP 418 I'm a teapot.",1)
self.sender("Look:",1), open('/var/www/pot.jpg', 'rb'))
self.sender("But by NO means that means that I cannot brew coffee.",2)
self.sender("So, what can I do for you?",1)
if 'tea' in message.text.lower():
self.sender("Sorry. While I am a teapot",1)
self.sender("While I AM a teapot, I cannot as of yet brew tea.",2)
self.sender("Really sorry.",1)
self.sender("Anything else?",0)
thread = Thread(target =
def sender(self,msg,sleeptime):
if sleeptime > 0:, 'typing')
sleep(sleeptime), msg)
def stop_polling(self):