| Conditions | 4 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | # Copyright 2017 Starbot Discord Project |
||
| 31 | def msg_split(msg, characters: int = 2000): |
||
| 32 | '''Split a big message into several smaller ones''' |
||
| 33 | if not msg: |
||
| 34 | return None |
||
| 35 | |||
| 36 | # Create message list. |
||
| 37 | text_list = textwrap.wrap(msg, characters, break_long_words=True, replace_whitespace=False) |
||
| 38 | if not text_list: |
||
| 39 | return None |
||
| 40 | |||
| 41 | # Create message list objects. |
||
| 42 | msg_list = [] |
||
| 43 | for msg in text_list: |
||
| 44 | msg_list.append(Message(msg)) |
||
| 45 | |||
| 46 | # Return the list. |
||
| 47 | return msg_list |
||
| 48 |