forked from HonusBot/HonusBot
Connectionpool
This commit is contained in:
parent
62caedbafd
commit
e3e8cd1109
@ -5,3 +5,4 @@ Password=
|
||||
|
||||
[Bot]
|
||||
Token=
|
||||
ConnectionPool=
|
||||
|
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user