Add chunking to messages

Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
This commit is contained in:
Ari Archer 2022-08-11 15:35:29 +03:00
parent f3af4442cf
commit 6ba14ef218
Signed by untrusted user who does not match committer: ari
GPG key ID: A50D5B4B599AF8A2

View file

@ -116,7 +116,8 @@ class BotCommandsParser:
self.bot = bot
async def _send_message(self, message: str) -> None:
await self.bot.cchannel.send(message)
for chunk in [message[i : i + 2000] for i in range(0, len(message), 2000)]:
await self.bot.cchannel.send(f"{chunk}\n")
def _note_exists(self, note_name: str) -> bool:
return DB_SESSION.query(Note).filter_by(name=note_name).first() is not None