Skip to content

Commit 2e4564c

Browse files
Ensures quote i can fetch user
1 parent db4ae1b commit 2e4564c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

bottas.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ async def index(self, ctx, index: int = 0):
5353
while not quote: # Randomly generates a valid quote
5454
index = random.randint(1, count)
5555
quote = self.get_quote(index)
56-
content += f"Quote #{index}:\n> {quote[0]} - {quote[1]}\n Uploaded by {self.bot.get_user(quote[2])}"
56+
user = self.bot.get_user(quote[2])
57+
if not user:
58+
user = await self.bot.fetch_user(quote[2])
59+
content += f"Quote #{index}:\n> {quote[0]} - {quote[1]}\n Uploaded by {user}"
5760
await ctx.send(content) # Sends the quote
5861

5962
@quote.command(aliases=['q'])

0 commit comments

Comments
 (0)