Fix display bug

This commit is contained in:
Zeva Rose 2021-11-01 17:14:26 -06:00
parent 8048622707
commit 8ad287e766

View file

@ -147,6 +147,7 @@ class TwitterCog(commands.Cog):
return
options = []
handlemap = {x.id: x.handle for x in twitters}
for twitter in twitters:
option = create_select_option(label=twitter.handle, value=str(twitter.id))
options.append(option)
@ -170,7 +171,7 @@ class TwitterCog(commands.Cog):
for row in components:
for component in row["components"]:
component["disabled"] = True
block = "\n".join(x for x in context.selected_options)
block = "\n".join(handlemap[x] for x in context.selected_options)
await context.edit_origin(content=f"Unfollowed the following:\n```\n{block}\n```", components=components)
except asyncio.TimeoutError:
for row in components:
@ -219,6 +220,7 @@ class TwitterCog(commands.Cog):
context = await wait_for_component(
self.bot, check=lambda x: ctx.author.id == x.author.id, messages=message, timeout=60 * 5
)
handlemap = {x.id: x.handle for x in twitters}
for to_update in context.selected_options:
t = Twitter.objects(guild=ctx.guild.id, id=ObjectId())
t.retweets = retweets
@ -226,7 +228,7 @@ class TwitterCog(commands.Cog):
for row in components:
for component in row["components"]:
component["disabled"] = True
block = "\n".join(x for x in context.selected_options)
block = "\n".join(handlemap[x] for x in context.selected_options)
await context.edit_origin(
content=f"{'Unfollowed' if not retweets else 'Followed'} retweets from the following:"
f"\n```\n{block}\n```",