Connectionpool

This commit is contained in:
Christian Rendina 2020-03-11 02:39:26 +01:00
parent 62caedbafd
commit e3e8cd1109
2 changed files with 7 additions and 1 deletions

View File

@ -5,3 +5,4 @@ Password=
[Bot]
Token=
ConnectionPool=

View File

@ -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
@ -78,6 +79,9 @@ class Config:
def getBotToken(self):
return self.botToken
def getBotConnectionPool(self):
return self.botConnectionPool
class InlineBot:
def __init__(self):
self.errorText = "Sowwy mawster, an ewror occuwed. ;;w;;"
@ -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))