Skip to content

Commit 01de103

Browse files
committed
fix: telegram bot api limit message as 4096 characters
1 parent e3d59df commit 01de103

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

efb_telegram_master/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,11 @@ def info(self, update: Update, context: CallbackContext):
215215
else: # Talking to the bot.
216216
msg = self.info_general()
217217

218-
update.effective_message.reply_text(msg)
218+
if len(msg) > 4095:
219+
for x in range(0, len(msg), 4095):
220+
update.effective_message.reply_text(msg[x:x+4095])
221+
else:
222+
update.effective_message.reply_text(msg)
219223

220224
def info_topic(self, update: Update):
221225
"""Generate string for chat linking info of a topic."""

0 commit comments

Comments
 (0)