-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
41 lines (32 loc) · 1.09 KB
/
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
35
36
37
38
39
40
41
from telegram import Update
import logging
from telegram.ext import CommandHandler, Updater
import time
import gpt_2_simple as gpt2
import sys
from config import Setup
import os
from bot import Bot
from chat_manager import ChatManager
from text_generator import TextGenerator
from RSS_prefix_getter import RSSPrefixGetter
from last_prefix_getter import LastPrefixGetter
logging.basicConfig(filename=Setup.config['logfile'], format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)
bots = []
for bot in Setup.config['tokens']:
bots.append(Bot(Setup.config['tokens'][bot], Setup.config['names'][bot], Setup.config['voice_pitch'][bot]))
text_generator = TextGenerator()
prefix_getter = LastPrefixGetter() #RSSPrefixGetter(Setup.config['rss_feeds'])
logger = logging.getLogger('Main')
manager = ChatManager(Setup.config['chat_id'], bots, Setup.config, text_generator, prefix_getter)
while True:
try:
manager.update()
except:
if manager.training is True:
manager.training = False
e = sys.exc_info()[0]
logger.error(e)
time.sleep(10)
print('hello')