Skip to content

Commit

Permalink
update with telepot10.1
Browse files Browse the repository at this point in the history
This commit can handle the error message of "event_space"
  • Loading branch information
seungjuchoi committed Nov 19, 2016
1 parent c2f6e9f commit f9e7585
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,3 +1,4 @@
*.pyc
dist/
.idea/
.idea/
setting.json
14 changes: 7 additions & 7 deletions telegram_torrenter.py
@@ -1,16 +1,15 @@
#!/usr/bin/python3
#!/usr/bin/python3.5
import sys
import os
import feedparser
import telepot
import json
from urllib import parse
from apscheduler.schedulers.background import BackgroundScheduler
from telepot.delegate import per_chat_id, create_open
from telepot.delegate import per_chat_id, create_open, pave_event_space

CONFIG_FILE = 'setting.json'


class DelugeAgent:
def __init__(self, sender):
self.STATUS_SEED = 'Seeding'
Expand Down Expand Up @@ -104,8 +103,8 @@ class Torrenter(telepot.helper.ChatHandler):
mode = ''
navi = feedparser.FeedParserDict()

def __init__(self, seed_tuple, timeout):
super(Torrenter, self).__init__(seed_tuple, timeout)
def __init__(self, *args, **kwargs):
super(Torrenter, self).__init__(*args, **kwargs)
self.agent = self.createAgent(AGENT_TYPE)

def createAgent(self, agentType):
Expand Down Expand Up @@ -258,6 +257,7 @@ def getConfig(config):
scheduler = BackgroundScheduler()
scheduler.start()
bot = telepot.DelegatorBot(TOKEN, [
(per_chat_id(), create_open(Torrenter, timeout=120)),
pave_event_space()(
per_chat_id(), create_open, Torrenter, timeout=120),
])
bot.message_loop(run_forever=True)
bot.message_loop(run_forever='Listening ...')

0 comments on commit f9e7585

Please sign in to comment.