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

Commit baeca8f

Browse files
author
Benjamin O'Brien
committed
🩹 Prism 1.3 Patch 🩹
1 parent fcddab8 commit baeca8f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+67
-339
lines changed

assets/prism.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ async def error_handler(ctx, error):
118118

119119
pass
120120

121+
elif "NoSuchUser" in str(error):
122+
123+
return
124+
121125
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))
122126

123127
base = ctx.message.content.split(" ")[0] if " " in ctx.message.content else ctx.message.content
@@ -408,7 +412,7 @@ def bought(name, amount):
408412

409413
return embed
410414

411-
def getClosestUser(ctx, user, return_member = False):
415+
async def getClosestUser(ctx, user, return_member = False):
412416

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

@@ -460,7 +464,9 @@ def getClosestUser(ctx, user, return_member = False):
460464

461465
if not matches:
462466

463-
return await ctx.send(embed = Tools.error("Couldn't find that user."))
467+
await ctx.send(embed = Tools.error("Couldn't find that user."))
468+
469+
raise AttributeError("NoSuchUser")
464470

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

assets/res/plain-text/update.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

commands/currency/balance.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,11 @@ async def balance(self, ctx, user: str = None):
2020

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

23-
if not user:
24-
25-
user = ctx.author.name + "#" + str(ctx.author.discriminator)
26-
27-
user = Tools.getClosestUser(ctx, user)
28-
29-
if not user:
30-
31-
return await ctx.send(embed = Tools.error(f"I couldn't find that user; try again with more letters."))
23+
user = await Tools.getClosestUser(ctx, user if user else ctx.author)
3224

33-
elif not str(user.id) in db:
25+
if not str(user.id) in db:
3426

35-
return await ctx.send(embed = Tools.error(f"{user.name} doesn't have an account."))
27+
return await ctx.send(embed = Tools.error(f"{user.name} doesn't have a Prism account."))
3628

3729
_user = db[str(user.id)]
3830

commands/currency/bank.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Prism Rewrite - Basic Command
2-
31
# Modules
42
import discord
53
from json import loads, dumps

commands/currency/beg.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,7 @@ async def beg(self, ctx, member: str = None):
3434

3535
if member:
3636

37-
member = Tools.getClosestUser(ctx, member)
38-
39-
if not member:
40-
41-
return await ctx.send(embed = Tools.error(f"I couldn't find that user; try again with more letters."))
37+
member = await Tools.getClosestUser(ctx, member)
4238

4339
user = member.name
4440

commands/currency/bet.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Prism Rewrite - Basic Command
2-
31
# Modules
42
import discord
53
from random import randint

commands/currency/buy.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Prism Rewrite - Basic Command
2-
31
# Modules
42
from asyncio import sleep
53
from json import loads, dumps

commands/currency/daily.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Prism Rewrite - Basic Command
2-
31
# Modules
42
import discord
53
from json import loads, dumps

commands/currency/deposit.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Prism Rewrite - Basic Command
2-
31
# Modules
42
import discord
53
from json import loads, dumps

commands/currency/inventory.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,7 @@ def __init__(self, bot):
1818
@commands.command(aliases = ["inv"])
1919
async def inventory(self, ctx, user = None):
2020

21-
if not user:
22-
23-
user = ctx.author.name + "#" + str(ctx.author.discriminator)
24-
25-
user = Tools.getClosestUser(ctx, user)
26-
27-
if not user:
28-
29-
return await ctx.send(embed = Tools.error(f"I couldn't find that user; try again with more letters."))
30-
21+
user = await Tools.getClosestUser(ctx, user if user else ctx.author)
3122

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

0 commit comments

Comments
 (0)