Procházet zdrojové kódy

changed long message handling to use pagify

master
Haku před 5 roky
rodič
revize
cc7532bba9
1 změnil soubory, kde provedl 5 přidání a 11 odebrání
  1. +5
    -11
      founderlessnotify/founderlessnotify.py

+ 5
- 11
founderlessnotify/founderlessnotify.py Zobrazit soubor

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



Načítá se…
Zrušit
Uložit