Added user's score to Candy Command - Closes #947#978
Conversation
| async with self.bot.http_session.get(pulls_url) as p: | ||
| pull_data = await p.json() | ||
| if pull_data["draft"]: | ||
| if "draft" in pull_data and pull_data["draft"]: |
There was a problem hiding this comment.
How about using pull_data.get("draft") instead?
Same review as 979
There was a problem hiding this comment.
hm, this commit shouldn't even be on this pr.
@evgriff this change is out of scope of this pr, so you'll need to remove it. you can do it with either resetting your HEAD and then forcepushing, or making a commit which will revert this commit.
| def get_user_candy_score() -> str: | ||
| for user_id, score in records: | ||
| if user_id == user.id: | ||
| return f'<@{user.id}>: {score}' | ||
| return f'<@{user.id}>: 0' |
There was a problem hiding this comment.
Use user.mention instead of manually writing the user mention and double quotes :)
| async def candy(self, ctx: commands.Context) -> None: | ||
| """Get the candy leaderboard and save to JSON.""" | ||
| records = await self.candy_records.items() | ||
| user = await self.bot.fetch_user(ctx.author.id) |
There was a problem hiding this comment.
We don't need to fetch the user here, we are using the user object to get the id/mention which can be done on ctx.author also, the two are the same objects.
From @Shivansh-007 Co-authored-by: Shivansh-007 <shivansh-007@outlook.com>
|
@katimoth I agree with Shivnash's comments. Could you quickly make those changes? |
|
@HassanAbouelela Committed the suggestions |
HassanAbouelela
left a comment
There was a problem hiding this comment.
Thanks for your work, and congrats on your first PR here 🎉
Thank you ! |
D0rs4n
left a comment
There was a problem hiding this comment.
Tested out locally, works as expected.
Congrats on you first PR 🎉
Relevant Issues
Closes #947
Description
Added user's score to Candy command by adding one additional function/variable, and including verbose to the candy commands message. Invoker of candy command will now see their candy score.
Did you: