Compare commits
No commits in common. "ab5c798b1deb66a0d8fadcf2e83b02c3c3de981d" and "346223d1a2f5c35f0efcee375e4b8d4a403b6d3e" have entirely different histories.
ab5c798b1d
...
346223d1a2
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,4 +3,3 @@
|
||||
**/__pycache__
|
||||
*.pyc
|
||||
config.yaml
|
||||
*.log
|
||||
@ -82,21 +82,8 @@ 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(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user