diff --git a/ytdlbot/tasks.py b/ytdlbot/tasks.py index 7d54064..7ecc58e 100644 --- a/ytdlbot/tasks.py +++ b/ytdlbot/tasks.py @@ -317,14 +317,14 @@ def upload_processor(client, bot_msg, url, vp_or_fid: "typing.Any[str, pathlib.P def gen_cap(bm, url, video_path): chat_id = bm.chat.id user = bm.chat - if user is None: - user_info = "" - else: + try: user_info = "@{}({})-{}".format( user.username or "N/A", user.first_name or "" + user.last_name or "", user.id ) + except Exception: + user_info = "" if isinstance(video_path, pathlib.Path): meta = get_metadata(video_path) diff --git a/ytdlbot/ytdl_bot.py b/ytdlbot/ytdl_bot.py index e8d4802..cacc02e 100644 --- a/ytdlbot/ytdl_bot.py +++ b/ytdlbot/ytdl_bot.py @@ -347,7 +347,7 @@ def periodic_sub_check(): logging.warning("User is blocked or deleted. %s", e) vip.deactivate_user_subscription(uid) except Exception as e: - logging.error("Unknown error when sending message to user. %s", e) + logging.error("Unknown error when sending message to user. %s", traceback.format_exc()) finally: time.sleep(random.random() * 3)