Better logging message

* Minor change in init message
This commit is contained in:
BreadTube 2026-05-27 16:53:10 +09:00
commit b509a97a8a

View file

@ -33,8 +33,8 @@ class BotCommand(StrEnum):
class Bot: class Bot:
DEFAULT_MESSAGE_LIST_LIMIT: int = 50 DEFAULT_MESSAGE_LIST_LIMIT: int = 50
INIT_MESSAGE: str = ( INIT_MESSAGE: str = (
'Bot initialized.\nThis is the current configuration used.\n' 'Bot initialized.\n'
'You can upload a new one to update the configuration.\n' 'You can upload new `config.txt` or `subscriptions.csv` to update them.\n'
f"Available commands: {', '.join(['`' + c.value + '`' for c in BotCommand if c != BotCommand.UNKNOWN])}") f"Available commands: {', '.join(['`' + c.value + '`' for c in BotCommand if c != BotCommand.UNKNOWN])}")
MAX_DOWNLOAD_SIZE: int = 50_000 MAX_DOWNLOAD_SIZE: int = 50_000
YT_CHANNEL_NAME_URL = 'https://www.youtube.com/@' YT_CHANNEL_NAME_URL = 'https://www.youtube.com/@'
@ -575,12 +575,15 @@ class Bot:
try: try:
self._refresh_sub(yt_connection, sub_info, channel_dict, category_ranges) self._refresh_sub(yt_connection, sub_info, channel_dict, category_ranges)
except RuntimeError as error: except RuntimeError as error:
self.logger.error('Refreshing subscription %s failed: %s', sub_info.channel_id, error) self.logger.error('Refreshing subscription %s (%s) failed: %s', sub_info.name, sub_info.channel_id,
error)
except TimeoutError as error: except TimeoutError as error:
self.logger.error('Timeout error refreshing subcription: %s', error) self.logger.error(
'Timeout error refreshing subcription %s (%s): %s', sub_info.name, sub_info.channel_id, error)
break break
except Exception as error: except Exception as error:
self.logger.error('Refreshing subscription %s unexpectedly failed: %s', sub_info.channel_id, error) self.logger.error('Refreshing subscription %s (%s) unexpectedly failed: %s', sub_info.name,
sub_info.channel_id, error)
break break
yt_connection.close() yt_connection.close()
self.logger.info('Subs refreshed') self.logger.info('Subs refreshed')