1

Let me explain: I want to write a script for Teamspeak in python and i want to send splitted text messages. This is the code i got so far:

msg = [msg[i:i + 1024] for i in range(0, len(msg), 1024)]
for message in msg: ts3lib.requestSendPrivateTextMsg(schid, "{0}".format(message), clientID)

Please note that teamspeak's maximal character limit is 1024. but not really since some chars like ♠ use 3 chars of the character limit.

So what i want is to have it check where it would split at 1024 chars then go back to the last \n or . and split there.

ekhumoro
  • 115,249
  • 20
  • 229
  • 336
Bluscream
  • 255
  • 1
  • 3
  • 18
  • 2
    Do you have an example of input and desired output? – Eric Duminil Mar 17 '17 at 09:01
  • @EricDuminil Yes, input would be https://github.com/Bluscream/pyTSon_plugins/blob/master/scripts/welcomeBot/__init__.py#L35 and output currently looks like: https://i.imgur.com/HSYnfAt.png – Bluscream Mar 17 '17 at 09:11
  • Don't expect people to read hundreds of line of code to solve a small problem. Create a Minimal, Complete, and Verifiable example: https://stackoverflow.com/help/mcve – FLab Mar 17 '17 at 09:14
  • @FLab: No need to inspect all of my code. The line in question will be highlighted when you visit the link. – Bluscream Mar 17 '17 at 09:15
  • Do you want people to help you or not? Please update your question with **all** the information (not links) necessary to answer your question. – ekhumoro Mar 17 '17 at 16:54

0 Answers0