Fix display bug
This commit is contained in:
parent
8048622707
commit
8ad287e766
1 changed files with 4 additions and 2 deletions
|
@ -147,6 +147,7 @@ class TwitterCog(commands.Cog):
|
||||||
return
|
return
|
||||||
|
|
||||||
options = []
|
options = []
|
||||||
|
handlemap = {x.id: x.handle for x in twitters}
|
||||||
for twitter in twitters:
|
for twitter in twitters:
|
||||||
option = create_select_option(label=twitter.handle, value=str(twitter.id))
|
option = create_select_option(label=twitter.handle, value=str(twitter.id))
|
||||||
options.append(option)
|
options.append(option)
|
||||||
|
@ -170,7 +171,7 @@ class TwitterCog(commands.Cog):
|
||||||
for row in components:
|
for row in components:
|
||||||
for component in row["components"]:
|
for component in row["components"]:
|
||||||
component["disabled"] = True
|
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)
|
await context.edit_origin(content=f"Unfollowed the following:\n```\n{block}\n```", components=components)
|
||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
for row in components:
|
for row in components:
|
||||||
|
@ -219,6 +220,7 @@ class TwitterCog(commands.Cog):
|
||||||
context = await wait_for_component(
|
context = await wait_for_component(
|
||||||
self.bot, check=lambda x: ctx.author.id == x.author.id, messages=message, timeout=60 * 5
|
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:
|
for to_update in context.selected_options:
|
||||||
t = Twitter.objects(guild=ctx.guild.id, id=ObjectId())
|
t = Twitter.objects(guild=ctx.guild.id, id=ObjectId())
|
||||||
t.retweets = retweets
|
t.retweets = retweets
|
||||||
|
@ -226,7 +228,7 @@ class TwitterCog(commands.Cog):
|
||||||
for row in components:
|
for row in components:
|
||||||
for component in row["components"]:
|
for component in row["components"]:
|
||||||
component["disabled"] = True
|
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(
|
await context.edit_origin(
|
||||||
content=f"{'Unfollowed' if not retweets else 'Followed'} retweets from the following:"
|
content=f"{'Unfollowed' if not retweets else 'Followed'} retweets from the following:"
|
||||||
f"\n```\n{block}\n```",
|
f"\n```\n{block}\n```",
|
||||||
|
|
Loading…
Add table
Reference in a new issue