Skip to content

Commit

Permalink
Ensures quote i can fetch user
Browse files Browse the repository at this point in the history
  • Loading branch information
Pythonic-Rainbow committed Mar 8, 2021
1 parent db4ae1b commit 2e4564c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bottas.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ async def index(self, ctx, index: int = 0):
while not quote: # Randomly generates a valid quote
index = random.randint(1, count)
quote = self.get_quote(index)
content += f"Quote #{index}:\n> {quote[0]} - {quote[1]}\n Uploaded by {self.bot.get_user(quote[2])}"
user = self.bot.get_user(quote[2])
if not user:
user = await self.bot.fetch_user(quote[2])
content += f"Quote #{index}:\n> {quote[0]} - {quote[1]}\n Uploaded by {user}"
await ctx.send(content) # Sends the quote

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

0 comments on commit 2e4564c

Please sign in to comment.