diff --git a/founderlessnotify/founderlessnotify.py b/founderlessnotify/founderlessnotify.py index f4b1953..38f1b9c 100644 --- a/founderlessnotify/founderlessnotify.py +++ b/founderlessnotify/founderlessnotify.py @@ -1,4 +1,5 @@ from redbot.core import commands, checks, Config +from redbot.core.utils.chat_formatting import pagify import discord import asyncio import requests @@ -106,17 +107,10 @@ class FounderlessNotify(commands.Cog): message_content = '' await channel.send('The following regions are now **Founderless**:') for region in now_founderless: - if len(message_content) <= 1800: - message_content += f'https://www.nationstates.net/region={canonicalize(region)} ' \ - f'({now_founderless_endos[region]}e)\n' - else: - await channel.send(message_content) - message_content = "" - message_content += f'https://www.nationstates.net/region={canonicalize(region)} ' \ - f'({now_founderless_endos[region]}e)\n' - # Send the remaining contents just in case - if message_content: - await channel.send(message_content) + message_content += f"https://www.nationstates.net/region={canonicalize(region)} " \ + f"({now_founderless_endos[region]})" + for page in pagify(message_content): + await channel.send(page) await self.config.previous_founderless.set(new_founderless_regions)