|
|
|
@@ -99,18 +99,23 @@ class FounderlessNotify(commands.Cog): |
|
|
|
new_founderless_regions = get_founderless_regions() |
|
|
|
previous_founderless_regions = await self.config.previous_founderless() |
|
|
|
# A region is now founderless if it is in the current list, but wasn't in the previous list |
|
|
|
now_founderless = [region for region in new_founderless_regions if (region not in previous_founderless_regions)] |
|
|
|
now_founderless = list() |
|
|
|
for region in new_founderless_regions: |
|
|
|
if region in previous_founderless_regions: |
|
|
|
continue |
|
|
|
now_founderless.append(region) |
|
|
|
print(now_founderless) |
|
|
|
# Get the region endos for both lists |
|
|
|
now_founderless_endos = get_region_endos(now_founderless) |
|
|
|
# Create an ordered set with each region's name and delegate endorsement level |
|
|
|
out = [] |
|
|
|
out = list() |
|
|
|
for region in now_founderless: |
|
|
|
try: |
|
|
|
region_endos = now_founderless_endos[region] |
|
|
|
except KeyError: |
|
|
|
region_endos = -1 |
|
|
|
out.append((region_endos, region)) |
|
|
|
print(out) |
|
|
|
print(now_founderless_endos["the_north_pacific"]) |
|
|
|
# Sort the output by delegate endos in descending order |
|
|
|
out.sort() |
|
|
|
out.reverse() |
|
|
|
@@ -181,7 +186,7 @@ class FounderlessNotify(commands.Cog): |
|
|
|
@checks.is_owner() |
|
|
|
async def clear_founderless(self, ctx): |
|
|
|
"""Clear the cached founderless regions.""" |
|
|
|
await self.config.previous_founderless.clear() |
|
|
|
await self.config.previous_founderless.set([]) |
|
|
|
await ctx.send("Cleared cached founderless regions.") |
|
|
|
|
|
|
|
@commands.command() |
|
|
|
|