Timendus / meshbot

A simple bot for Meshtastic
GNU General Public License v3.0
0 stars 0 forks source link

Bot crashes on long messages #2

Open Timendus opened 4 hours ago

Timendus commented 4 hours ago

Meshtastic messages can only be quite short. The app lets me send no more than 234 characters (emoji are four characters). If the bot stores a long message and combines that with a long username, then it will crash as the total message size exceeds the maximum one packet can send. This needs to be paginated more intelligently.

Timendus commented 4 hours ago

This gives the correct message length, I think, taking emoji into account:

len(message.encode("utf-8"))