This commit is contained in:
deathbybandaid 2019-10-01 15:19:19 -04:00
parent 348b8f2fdb
commit 50f3e170c3

View File

@ -92,16 +92,13 @@ class ToolsOSD:
if text_method == 'ACTION':
text_method = 'PRIVMSG'
available_bytes = 512
reserved_irc_bytes = 15
available_bytes -= reserved_irc_bytes
# available_bytes = 512
# reserved_irc_bytes = 15
# available_bytes -= reserved_irc_bytes
try:
hostmaskbytes = len((bot.users.get(bot.nick).hostmask).encode('utf-8'))
available_bytes -= hostmaskbytes
except AttributeError:
# hostmaskbytes = len((bot.nick).encode('utf-8')) + 12 + 63
hostmaskbytes = len((bot.nick).encode('utf-8')) + 12 + 63
available_bytes -= hostmaskbytes
hostmaskbytes = (len((bot.nick).encode('utf-8')) # Bot's NICKLEN
+ 1 # (! separator)
+ len('~') # (for the optional ~ in user)
@ -117,7 +114,7 @@ class ToolsOSD:
groupbytes.append(len((recipients_part).encode('utf-8')))
max_recipients_bytes = max(groupbytes)
available_bytes -= max_recipients_bytes
# available_bytes -= max_recipients_bytes
allowedLength = (512
- len(':') - hostmaskbytes
@ -127,8 +124,6 @@ class ToolsOSD:
- len('\r\n')
)
bot.say("old length of " + text_method + " to " + str(recipientgroups) + " is " + str(allowedLength), "#deathbybandaid")
bot.say("new length of " + text_method + " to " + str(recipientgroups) + " is " + str(available_bytes), "#deathbybandaid")
return allowedLength
def get_sendable_message_list(messages, max_length=400):