fixes-logs-imports

This commit is contained in:
2023-09-18 10:50:48 +03:00
parent cf4f13ae9b
commit 95071ec301
14 changed files with 98 additions and 61 deletions

View File

@@ -2,7 +2,9 @@ from storage import Profile, scan
from api import get_member, send_message, get_chat_administrators
from utils.mention import userdata_extract
import json
import logging
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
async def construct_unlink_buttons(actor):
print(f"constructing unlink buttons for {actor['children']}")
@@ -10,12 +12,13 @@ async def construct_unlink_buttons(actor):
for vouch in actor["children"]:
for chat_id in actor["chats"]:
r = await get_member(chat_id, vouch)
print(r)
member = r["result"]["user"]
_uid, identity, username = userdata_extract(member)
buttons.append(
{"text": f"{identity} {username}", "callback_data": "unlink" + vouch}
)
logger.debug(r)
if "result" in r:
member = r["result"]["user"]
_uid, identity, username = userdata_extract(member)
buttons.append(
{"text": f"{identity} {username}", "callback_data": "unlink" + vouch}
)
return buttons
@@ -41,7 +44,7 @@ async def handle_command_my(msg, state):
"Nobody recognized you? Speak, I will pass your message to the circle"
)
r = await send_message(from_id, body)
print(r)
logger.debug(r)
chat_id = msg["chat"]["id"]
state.make_talking(from_id, chat_id)
else:
@@ -58,7 +61,7 @@ async def handle_command_owner_my(msg):
chat_id = msg["chat"]["id"]
if chat_id < 0: # is not private
r = await get_chat_administrators(chat_id)
print(r)
logger.debug(r)
owner_id = ""
for admin in r["result"]:
if admin["status"] == "creator":