Skip to content

Commit

Permalink
[NotSoBot] Don't try to look through guild for user names when in DM's
Browse files Browse the repository at this point in the history
  • Loading branch information
TrustyJAID committed Mar 9, 2024
1 parent 734e9f1 commit a79d38b
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions notsobot/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,17 @@ async def convert(
for attachment in attachments:
urls.append(attachment.url)
if not urls:
for m in ctx.guild.members:
if argument.lower() in unidecode.unidecode(m.display_name.lower()):
# display_name so we can get the nick of the user first
# without being NoneType and then check username if that matches
# what we're expecting
urls.append(m.display_avatar.replace(format="png").url)
continue
if argument.lower() in unidecode.unidecode(m.name.lower()):
urls.append(m.display_avatar.replace(format="png").url)
continue
if ctx.guild:
for m in ctx.guild.members:
if argument.lower() in unidecode.unidecode(m.display_name.lower()):
# display_name so we can get the nick of the user first
# without being NoneType and then check username if that matches
# what we're expecting
urls.append(m.display_avatar.replace(format="png").url)
continue
if argument.lower() in unidecode.unidecode(m.name.lower()):
urls.append(m.display_avatar.replace(format="png").url)
continue

if not urls:
raise BadArgument("No images provided.")
Expand Down

0 comments on commit a79d38b

Please sign in to comment.