Chore: commit unstaged changed
This commit is contained in:
parent
ccb91f3576
commit
f6b054781a
1 changed files with 8 additions and 2 deletions
10
src/main.py
10
src/main.py
|
@ -25,12 +25,17 @@ class MlmMatrixBot:
|
||||||
self._config['MATRIX_SERVER'], self._matrixUsername, self._config['MATRIX_SPACE_ID'], self._matrixUsername)
|
self._config['MATRIX_SERVER'], self._matrixUsername, self._config['MATRIX_SPACE_ID'], self._matrixUsername)
|
||||||
|
|
||||||
async def init(self):
|
async def init(self):
|
||||||
|
logging.info("==> Initializing <==")
|
||||||
|
|
||||||
|
logging.info(" \t* Connecting to ldap")
|
||||||
if not self._ldapHelper.bind():
|
if not self._ldapHelper.bind():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
logging.info(" \t* Connecting to matrix")
|
||||||
if not await self._matrixHelper.login(self._config['MATRIX_PASSWORD']):
|
if not await self._matrixHelper.login(self._config['MATRIX_PASSWORD']):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
logging.info("==> Initialized <==")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
async def run(self):
|
async def run(self):
|
||||||
|
@ -182,7 +187,8 @@ class MlmMatrixBot:
|
||||||
if not rc:
|
if not rc:
|
||||||
return
|
return
|
||||||
|
|
||||||
labs = list(map(lambda lab: lab['sAMAccountName'].replace("p_", "").replace("lab", "-lab"), labs))
|
labs = list(map(lambda lab: lab['sAMAccountName'].replace(
|
||||||
|
"p_", "").replace("lab", "-lab"), labs))
|
||||||
await self._create_rooms(labs, joinable_for_space_members=True)
|
await self._create_rooms(labs, joinable_for_space_members=True)
|
||||||
|
|
||||||
return labs
|
return labs
|
||||||
|
@ -264,7 +270,7 @@ async def main():
|
||||||
if not await bot.init():
|
if not await bot.init():
|
||||||
logging.critical("Bot initialization failed")
|
logging.critical("Bot initialization failed")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
await bot.run()
|
await bot.run()
|
||||||
time.sleep(60)
|
time.sleep(60)
|
||||||
|
|
Loading…
Reference in a new issue