Compare commits

..

No commits in common. "ab5c798b1deb66a0d8fadcf2e83b02c3c3de981d" and "346223d1a2f5c35f0efcee375e4b8d4a403b6d3e" have entirely different histories.

2 changed files with 0 additions and 14 deletions

1
.gitignore vendored
View File

@ -3,4 +3,3 @@
**/__pycache__
*.pyc
config.yaml
*.log

View File

@ -82,22 +82,9 @@ class TelegramClient:
await self._app.shutdown()
print(f'[{_ts()}] Telegram service stopped', flush=True)
async def _error_handler(self, update, context):
from telegram.error import NetworkError
cause = context.error
if isinstance(cause, NetworkError) and "ReadError" in str(cause):
print(f'[{_ts()}] [Network Warning] Telegram ReadError occurred. Retrying...', flush=True)
else:
print(f'[{_ts()}] Exception while handling an update: {cause}', flush=True)
# Untuk error selain ReadError, tetap cetak full traceback jika perlu via logging
# atau biarkan default handler mengurusnya.
def _register_handlers(self):
from telegram.ext import MessageHandler, filters, CommandHandler
self._app.add_error_handler(self._error_handler)
self._app.add_handler(
MessageHandler(
filters.TEXT & ~filters.COMMAND & filters.ChatType.PRIVATE,