Add pagination to [p]alias list and [p]alias global list #3844

Merged
DariusStClair merged 18 commits from sigh into V3/develop 2020-05-14 17:05:36 +02:00
DariusStClair commented 2020-05-11 15:04:43 +02:00 (Migrated from github.com)

Type

  • Bugfix
  • Enhancement
  • New feature

Description of the changes

Fixes #3834

This is my first attempt at contributing and it's Jack's fault!!1! 😟

### Type - [x] Bugfix - [ ] Enhancement - [ ] New feature ### Description of the changes Fixes #3834 This is my first attempt at contributing and it's Jack's fault!!1! 😟
tekulvw (Migrated from github.com) reviewed 2020-05-11 15:04:43 +02:00
Jackenmen (Migrated from github.com) reviewed 2020-05-11 16:47:59 +02:00
Jackenmen (Migrated from github.com) commented 2020-05-11 16:47:59 +02:00

IMO, we should just not allow the command to run if bot doesn't have add_reactions perm (using @commands.bot_has_permissions deco) but if you think it should allow that, you should use ctx.send_interactive() to avoid a lot of message spam.

        else:
            await ctx.send_interactive(alias_list)
IMO, we should just not allow the command to run if bot doesn't have `add_reactions` perm (using `@commands.bot_has_permissions` deco) but if you think it *should* allow that, you should use `ctx.send_interactive()` to avoid a lot of message spam. ```suggestion else: await ctx.send_interactive(alias_list) ```
DariusStClair commented 2020-05-11 23:10:41 +02:00 (Migrated from github.com)

Uh pagination is wrong I'll fix this later

Uh pagination is wrong I'll fix this later
Jackenmen (Migrated from github.com) requested changes 2020-05-12 16:00:29 +02:00
Jackenmen (Migrated from github.com) left a comment

Looks good, just few small changes needed. (FYI, if I say something is a "nitpick", it means the change is not required, but it's welcome)

Looks good, just few small changes needed. (FYI, if I say something is a "nitpick", it means the change is not required, but it's welcome)
Jackenmen (Migrated from github.com) commented 2020-05-11 20:56:30 +02:00

This can be simplified by using .join() as it were before the change. This will also get rid of the trailing \n that makes the last page look different.

        message = "\n".join(names)
This can be simplified by using `.join()` as it were before the change. This will also get rid of the trailing `\n` that makes the last page look different. ```suggestion message = "\n".join(names) ```
Jackenmen (Migrated from github.com) commented 2020-05-12 01:35:15 +02:00

This can be simplified by using .join() as it were before the change. This will also get rid of the trailing \n that makes the last page look different.

        message = "\n".join(names)
This can be simplified by using `.join()` as it were before the change. This will also get rid of the trailing `\n` that makes the last page look different. ```suggestion message = "\n".join(names) ```
Jackenmen (Migrated from github.com) commented 2020-05-12 15:02:21 +02:00

"Page {}/{}" needs to be put in _() for i18n support. Format fields should also have names to help translators (probably not particularly important in this case, but it's better to do it like that anyway for consistency):

            page = (
                _("Aliases:\n")
                + page
                + _("\n\nPage {page}/{total}").format(page=count, total=len(temp))
            )
"Page {}/{}" needs to be put in `_()` for i18n support. Format fields should also have names to help translators (probably not particularly important in this case, but it's better to do it like that anyway for consistency): ```suggestion page = ( _("Aliases:\n") + page + _("\n\nPage {page}/{total}").format(page=count, total=len(temp)) ) ```
Jackenmen (Migrated from github.com) commented 2020-05-12 15:02:35 +02:00

"Page {}/{}" needs to be put in _() for i18n support. Format fields should also have names to help translators (probably not particularly important in this case, but it's better to do it like that anyway for consistency):

            page = (
                _("Aliases:\n")
                + page
                + _("\n\nPage {page}/{total}").format(page=count, total=len(temp))
            )
"Page {}/{}" needs to be put in `_()` for i18n support. Format fields should also have names to help translators (probably not particularly important in this case, but it's better to do it like that anyway for consistency): ```suggestion page = ( _("Aliases:\n") + page + _("\n\nPage {page}/{total}").format(page=count, total=len(temp)) ) ```
Jackenmen (Migrated from github.com) commented 2020-05-12 15:39:31 +02:00

A nitpick

        if count == 1:
A nitpick ```suggestion if count == 1: ```
Jackenmen (Migrated from github.com) commented 2020-05-12 15:39:49 +02:00

A nitpick

        if count == 1:
A nitpick ```suggestion if count == 1: ```
Jackenmen (Migrated from github.com) reviewed 2020-05-14 01:12:42 +02:00
@ -100,6 +101,28 @@ class Alias(commands.Cog):
)
Jackenmen (Migrated from github.com) commented 2020-05-14 01:12:42 +02:00

Improved typing (you need to add List to imports from typing at the top too):

    async def paginate_alias_list(
        self, ctx: commands.Context, alias_list: List[AliasEntry]
    ) -> None:
Improved typing (you need to add `List` to imports from `typing` at the top too): ```suggestion async def paginate_alias_list( self, ctx: commands.Context, alias_list: List[AliasEntry] ) -> None: ```
Jackenmen (Migrated from github.com) approved these changes 2020-05-14 17:02:58 +02:00
Jackenmen (Migrated from github.com) left a comment

Looks good to me, thanks for the PR. I hope it's not the last time we see you here <3

Looks good to me, thanks for the PR. I hope it's not the last time we see you here <3
Sign in to join this conversation.
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!3844
No description provided.