You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.
I have been using your Claude-Telegram-Bot and I am quite satisfied with its functionality. However, I have come across a requirement that I believe could be a valuable addition to the bot's capabilities.
Currently, when the bot is required to send a long message (more than 4000 characters) or to forward a code file, it attempts to send it as a text message. This can cause issues due to the maximum limit of characters in a single message imposed by Telegram.
I propose a modification to the bot's sending functionality. When a message exceeds 4000 characters or when a file needs to be forwarded, the bot could write the content to a file and send it as a document instead of a text message.
The modification could look something like this in the code:
def send_message_or_file(update, text):
if len(text) <= 4000:
bot.send_message(chat_id=update.effective_chat.id, text=text)
else:
with open('message.txt', 'w') as f:
f.write(text)
with open('message.txt', 'rb') as doc:
bot.send_document(chat_id=update.effective_chat.id, document=doc)
This function would replace all occurrences of bot.send_message.
I believe this would be a valuable enhancement to the bot's functionality, allowing it to handle longer texts and file forwarding more effectively. Could you consider implementing this change, or guide me through doing it myself if it aligns with the project's direction?
Thank you for considering my suggestion. I look forward to hearing your thoughts.
Thank you for your support and suggestions 😊. Implementing message segmentation involves a bit more complexity, considering the transitions between different responses and other functionalities (like with Google Bard), so it's not quite a simple fix 🤔. My schedule has been pretty packed lately, so it's tough to carve out time for updates . But hey, feel free to fork the repo and tweak it to your liking 👍!
Hello,
I have been using your Claude-Telegram-Bot and I am quite satisfied with its functionality. However, I have come across a requirement that I believe could be a valuable addition to the bot's capabilities.
Currently, when the bot is required to send a long message (more than 4000 characters) or to forward a code file, it attempts to send it as a text message. This can cause issues due to the maximum limit of characters in a single message imposed by Telegram.
I propose a modification to the bot's sending functionality. When a message exceeds 4000 characters or when a file needs to be forwarded, the bot could write the content to a file and send it as a document instead of a text message.
The modification could look something like this in the code:
def send_message_or_file(update, text):
if len(text) <= 4000:
bot.send_message(chat_id=update.effective_chat.id, text=text)
else:
with open('message.txt', 'w') as f:
f.write(text)
with open('message.txt', 'rb') as doc:
bot.send_document(chat_id=update.effective_chat.id, document=doc)
This function would replace all occurrences of bot.send_message.
I believe this would be a valuable enhancement to the bot's functionality, allowing it to handle longer texts and file forwarding more effectively. Could you consider implementing this change, or guide me through doing it myself if it aligns with the project's direction?
Thank you for considering my suggestion. I look forward to hearing your thoughts.
Best regards,
Ruslan
Projekt Xamelion AG
The text was updated successfully, but these errors were encountered: