-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.py
executable file
·36 lines (28 loc) · 874 Bytes
/
main.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
#!/usr/bin/env python3
# Telegram RPG Character Sheet bot
from pprint import pprint
import telepot
import time
import socket
import os
import re
import sys
import json
from telepot.loop import MessageLoop
from telepot.delegate import pave_event_space, per_chat_id, create_open, flavor, include_callback_query_chat_id, per_callback_query_origin, per_callback_query_chat_id
import config
import db
import commands
import keyboard
os.chdir(os.path.dirname(os.path.abspath(__file__)))
db.init()
#bot = telepot.Bot(config.bot_token)
print('Entering message loop.')
#bot.message_loop(process_message)
bot = telepot.DelegatorBot(config.bot_token, [
pave_event_space()(
[per_chat_id(), per_callback_query_chat_id()], create_open, keyboard.MessageHandler, timeout=120, include_callback_query=True),
])
MessageLoop(bot).run_as_thread()
while 1:
time.sleep(10)