Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
🩹 Final 1.3 Patch 🩹
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin O'Brien committed Aug 23, 2020
1 parent baeca8f commit 70f1fef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
18 changes: 8 additions & 10 deletions assets/prism.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,23 @@ async def error_handler(ctx, error):

return await ctx.send(embed = Tools.error(f"You need the {str(error).split('sing ')[1].split(' per')[0]} permission(s) to use this command."))

elif "Forbidden: 403 Forbidden" in str(error):
elif isinstance(error, commands.CommandNotFound):

return

elif "403" in str(error):

try:

return await ctx.send(embed = Tools.error("I'm either missing permission(s) or that user is higher than me."))
return await ctx.send(embed = Tools.error("Missing permission(s)."))

except:

pass

elif "NoSuchUser" in str(error):

return
return await ctx.send(embed = Tools.error("Couldn't find that user."))

await ctx.send(embed = discord.Embed(title = "Unexpected Error", description = "The command you just used generated an unexpected error.\nPrism has sent an automatic bug report about this problem.\n\nIn the meantime, try some of our other commands. :)", color = 0xFF0000))

Expand Down Expand Up @@ -414,10 +418,6 @@ def bought(name, amount):

async def getClosestUser(ctx, user, return_member = False):

if ctx.author.id == user.id:

user = ctx.author.id

user = str(user)

matcher = StringMatcher()
Expand Down Expand Up @@ -464,9 +464,7 @@ async def getClosestUser(ctx, user, return_member = False):

if not matches:

await ctx.send(embed = Tools.error("Couldn't find that user."))

raise AttributeError("NoSuchUser")
raise ValueError("NoSuchUser")

id = int(max(matches.items(), key = itemgetter(1))[0])

Expand Down
2 changes: 1 addition & 1 deletion commands/misc/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async def profile(self, ctx, user = None):

db = loads(open("db/users", "r").read())

user = Tools.getClosestUser(ctx, user if user else ctx.author)
user = await Tools.getClosestUser(ctx, user if user else ctx.author)

if not str(user.id) in db:

Expand Down

0 comments on commit 70f1fef

Please sign in to comment.