diff --git a/config.ini.example b/config.ini.example index 7986f38..842b493 100644 --- a/config.ini.example +++ b/config.ini.example @@ -5,3 +5,4 @@ Password= [Bot] Token= +ConnectionPool= diff --git a/inline.py b/inline.py index 59bdd75..81b075c 100644 --- a/inline.py +++ b/inline.py @@ -65,6 +65,7 @@ class Config: self.apiId = cfg["Api"]["Id"] self.apiPassword = cfg["Api"]["Password"] self.botToken = cfg["Bot"]["Token"] + self.botConnectionPool = cfg["Bot"]["ConnectionPool"] def getApiUrl(self): return self.apiUrl @@ -77,6 +78,9 @@ class Config: def getBotToken(self): return self.botToken + + def getBotConnectionPool(self): + return self.botConnectionPool class InlineBot: def __init__(self): @@ -129,7 +133,8 @@ class InlineBot: return r.headers[command.getHeaderField()] def start(self): - self.bot = Bot(token=self.config.getBotToken()) + self.prequest = Request(con_pool_size=int(self.config.getBotConnectionPool())) + self.bot = Bot(token=self.config.getBotToken(), request=self.prequest) self.updater = Updater(bot=self.bot,use_context=True) print("Inline bot v. {}".format(BOT_VERSION))