Selaa lähdekoodia

changed long message handling to use pagify

master
Haku 5 vuotta sitten
vanhempi
commit
cc7532bba9
1 muutettua tiedostoa jossa 5 lisäystä ja 11 poistoa
  1. +5
    -11
      founderlessnotify/founderlessnotify.py

+ 5
- 11
founderlessnotify/founderlessnotify.py Näytä tiedosto

@@ -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)



Ladataan…
Peruuta
Tallenna