Browse Source

something

master
Haku 4 years ago
parent
commit
6e4e613c70
1 changed files with 9 additions and 4 deletions
  1. +9
    -4
      founderlessnotify/founderlessnotify.py

+ 9
- 4
founderlessnotify/founderlessnotify.py View File

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


@commands.command() @commands.command()


Loading…
Cancel
Save