fix: message too long on some extreme cases

This commit is contained in:
Terry Geng
2020-03-03 16:47:24 +08:00
parent 26345e456f
commit 499186c738
4 changed files with 9 additions and 2 deletions

View File

@ -68,7 +68,7 @@ def send_multi_lines(bot, lines, text):
for newline in lines:
msg += br
br = "<br>"
if len(msg) + len(newline) > 5000:
if (len(msg) + len(newline)) > (bot.mumble.get_max_message_length() - 4) != 0: # 4 == len("<br>")
bot.send_msg(msg, text)
msg = ""
msg += newline
@ -668,6 +668,10 @@ def cmd_last(bot, user, text, command, parameter):
def cmd_remove(bot, user, text, command, parameter):
global log
if bot.download_in_progress:
bot.send_msg(constants.strings("cannot_change_when_download"))
return
# Allow to remove specific music into the queue with a number
if parameter and parameter.isdigit() and int(parameter) > 0 \
and int(parameter) <= var.playlist.length():