Skip to content

Commit

Permalink
[Flags] v1.1.6 Fix [p]flagemojis
Browse files Browse the repository at this point in the history
  • Loading branch information
Kreusada committed Feb 29, 2024
1 parent 00b938f commit ef63a04
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions flags/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ async def convert(self, ctx: Context, argument: str) -> Optional[Dict[str, Union
class Flags(Cog):
"""Get flags from country names."""

__version__ = "1.1.5"
__version__ = "1.1.6"
__author__ = "Kreusada"

def __init__(self, bot: Red):
Expand Down Expand Up @@ -205,13 +205,7 @@ async def flagemojis(self, ctx: commands.Context, *countries: CountryConverter):
"""
if not countries:
return await ctx.send_help()
# Here, I am removing duplicates. Cannot do set(countries)
# because set takes hashable objects of which dict is not
# using dict.fromkeys() instead of set() to retain insertion order
unique_countries = [
dict(s) for s in dict.fromkeys(frozenset(d.items()) for d in countries)
]
message = "\n".join(f"{c['Emoji']} - `{c['Emoji']}`" for c in unique_countries)
message = "\n".join(f"{c['Emoji']} - `{c['Emoji']}` ({c['Name']})" for c in countries)
for page in pagify(message):
await ctx.send(page)

Expand Down

0 comments on commit ef63a04

Please sign in to comment.