-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun.py
More file actions
38 lines (29 loc) · 884 Bytes
/
run.py
File metadata and controls
38 lines (29 loc) · 884 Bytes
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
# -*- coding: utf-8 -*-
import os
import time
import telepot
import hangoutLinker
token = os.getenv('TELEHANGBOT_TELEGRAM_TOKEN')
commands = [u'/потрындеть',u'/перетереть',u'/takeacall',u'/tac',u'/попиздеть',u'/поговорить',u'/беседа',u'/переговоры']
def command_handler(msg):
"""
handle chat messages
"""
chat_id = msg['chat']['id']
command = msg['text']
try:
print('Got command: %s' % command.encode('ascii', 'ignore').decode('ascii', 'ignore'))
except Exception:
pass
if command in commands:
bot.sendMessage(chat_id, hangoutLinker.getlink())
#main
#take some time to start selenium server
time.sleep(30)
hangoutLinker.sepUpAndLogin()
bot = telepot.Bot(token)
bot.message_loop(command_handler)
print('bot started')
#keep running
while 1:
time.sleep(10)