Skip to content

Commit

Permalink
fix: misc for fetching fb creds
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyqu committed Mar 30, 2024
1 parent 2c0bd2c commit f1bad9a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/tg/handlers/get_board_credentials_handler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import json
import logging
import os
import telegram

from ...db.db_client import DBClient
Expand All @@ -20,19 +19,20 @@ def get_board_credentials(update: telegram.Update, tg_context):
reply(load('get_board_credentials_handler__not_found'), update)
return
try:
print(member.trello)
with open('board_credentials.json', encoding="utf-8") as fin:
try:
board_json = json.loads(fin.read())
creds = next((
cred for cred in board_json if cred["trelloUsername"] == f"@{member.trello}"
cred for cred in board_json if cred["trelloUsername"] == member.trello
), None)
if not creds:
reply(load('get_board_credentials_handler__not_found'), update)
return
reply(
load(
'get_board_credentials_handler__found',
username=creds["focalboardUsername"],
username=creds["focalboardUsername"][1:],
password=creds["focalboardPassword"]
),
update
Expand Down

0 comments on commit f1bad9a

Please sign in to comment.