Added support for getting leaderboard size back with position #4433

Manually merged
MrBillson merged 0 commits from MrBillson/issue4200 into V3/develop 2026-11-21 16:09:20 +01:00
MrBillson commented 2020-09-17 18:56:52 +02:00 (Migrated from github.com)

Type

  • Bugfix
  • Enhancement
  • New feature

Description of the changes

Added support for getting leaderboard size back with position. You can now pass in an optional param that is a flag to return the overall leaderboard size or not. This is the enhancement requested in issue 4200. This is a backwards compatible non-breaking change.

closes #4200

### Type - [ ] Bugfix - [X] Enhancement - [ ] New feature ### Description of the changes Added support for getting leaderboard size back with position. You can now pass in an optional param that is a flag to return the overall leaderboard size or not. This is the enhancement requested in issue 4200. This is a backwards compatible non-breaking change. closes #4200
Drapersniper (Migrated from github.com) requested changes 2020-09-17 20:20:08 +02:00
Drapersniper (Migrated from github.com) left a comment

Just a quick initial review from my phone, also I noticed something like 578 states the return type in an int, that's incorrect since it's an Optional[int], would you mind tweaking that while working on this pr? If not it's fine it can be done in a separate PR.

You will notice I've renamed some of the variables you have added, this is to ensure we are following PEP and keeping variable naming motion consistent across the project.

Just a quick initial review from my phone, also I noticed something like 578 states the return type in an int, that's incorrect since it's an Optional[int], would you mind tweaking that while working on this pr? If not it's fine it can be done in a separate PR. You will notice I've renamed some of the variables you have added, this is to ensure we are following PEP and keeping variable naming motion consistent across the project.
Drapersniper (Migrated from github.com) commented 2020-09-17 20:10:55 +02:00
) -> Union[Optional[int], Tuple[Optional[int], int]]:
```suggestion ) -> Union[Optional[int], Tuple[Optional[int], int]]: ```
Drapersniper (Migrated from github.com) commented 2020-09-17 20:11:47 +02:00
    member: Union[discord.User, discord.Member], return_lb_size: bool = False
```suggestion member: Union[discord.User, discord.Member], return_lb_size: bool = False ```
Drapersniper (Migrated from github.com) commented 2020-09-17 20:13:07 +02:00
    return_lb_size : bool
        Whether or not to return a tuple with position and size of leaderboard
```suggestion return_lb_size : bool Whether or not to return a tuple with position and size of leaderboard ```
Drapersniper (Migrated from github.com) commented 2020-09-17 20:13:55 +02:00
```suggestion ```
Drapersniper (Migrated from github.com) commented 2020-09-17 20:14:32 +02:00
```suggestion ```
Drapersniper (Migrated from github.com) commented 2020-09-17 20:16:15 +02:00
   Tuple[Optional[int], int]
```suggestion Tuple[Optional[int], int] ```
Drapersniper (Migrated from github.com) commented 2020-09-17 20:15:14 +02:00
    if return_lb_size is True:
```suggestion if return_lb_size is True: ```
Drapersniper (Migrated from github.com) commented 2020-09-17 20:17:20 +02:00
            return_pos = None
```suggestion return_pos = None ```
Drapersniper (Migrated from github.com) commented 2020-09-17 20:17:35 +02:00
            return_pos = pos[0]
```suggestion return_pos = pos[0] ```
Drapersniper (Migrated from github.com) commented 2020-09-17 20:17:48 +02:00
        return return_pos, len(leaderboard)
```suggestion return return_pos, len(leaderboard) ```
Drapersniper (Migrated from github.com) commented 2020-09-17 20:18:00 +02:00
        return return_pos
```suggestion return return_pos ```
MrBillson commented 2020-09-19 22:32:01 +02:00 (Migrated from github.com)

Great feedback. I have a better idea on contributing to this project now!

Great feedback. I have a better idea on contributing to this project now!
MrBillson commented 2020-09-23 17:12:41 +02:00 (Migrated from github.com)

I think all of the requested changes are done. Let me know if not. Thanks!

I think all of the requested changes are done. Let me know if not. Thanks!
Drapersniper (Migrated from github.com) approved these changes 2021-05-31 14:10:02 +02:00
Drapersniper (Migrated from github.com) left a comment

This is awkward, I forgot to assign it to me so I missed your changed, Approving for now.

@jack1142 this one is on the milestone for 3.4.11, but just in case merging would make your life harder, please go ahead and merge when it is a good time.

This is awkward, I forgot to assign it to me so I missed your changed, Approving for now. @jack1142 this one is on the milestone for 3.4.11, but just in case merging would make your life harder, please go ahead and merge when it is a good time.
Drapersniper (Migrated from github.com) reviewed 2021-05-31 15:14:44 +02:00
Drapersniper (Migrated from github.com) commented 2021-05-31 15:14:43 +02:00
    member: Union[discord.User, discord.Member], *, return_lb_size: bool = False

Jack suggested this should be changed into a keyword-only arg, so if you can do this too it would be awesome.

```suggestion member: Union[discord.User, discord.Member], *, return_lb_size: bool = False ``` Jack suggested this should be changed into a keyword-only arg, so if you can do this too it would be awesome.
Drapersniper (Migrated from github.com) requested changes 2021-05-31 15:17:08 +02:00
Drapersniper (Migrated from github.com) left a comment

Once the pending suggestion is addressed I can merge this one for you @MrBillson

Once the pending suggestion is addressed I can merge this one for you @MrBillson
Jackenmen commented 2026-05-19 02:33:46 +02:00 (Migrated from github.com)

I'm not sure that I like returning a tuple or an integer depending on a kwarg value here instead of just having a new function. Or maybe even not doing either, because one can just use get_leaderboard() and manually get the data. It's not like get_leaderboard_position() has some optimisations. Marking for discussion.

I'm not sure that I like returning a tuple or an integer depending on a kwarg value here instead of just having a new function. Or maybe even not doing either, because one can just use `get_leaderboard()` and manually get the data. It's not like `get_leaderboard_position()` has some optimisations. Marking for discussion.
Mrcoolgamer11 manually merged commit a8bc3fb018 into V3/develop 2026-11-21 16:09:20 +01:00
Sign in to join this conversation.
No reviewers
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot!4433
No description provided.