Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch help command #416

Merged
merged 8 commits into from
Sep 26, 2023
Merged

Switch help command #416

merged 8 commits into from
Sep 26, 2023

Conversation

modernNeo
Copy link
Member

@modernNeo modernNeo commented Sep 16, 2023

Description

Help Revamp

text command annotation example:

    @commands.command(
        brief="string that is displayed when shown in .help output",

        description='the description',
        help=(
            "Arguments:\n"
            "\tthe message: message to post to channel\n\n"
            "Example:\n"
            "\t.announce 'the example'"
        ),
        usage='"the message"'
    )

what is displayed:
Screenshot from 2023-09-24 12-19-06

Screenshot from 2023-09-24 12-17-36

slash command annotation example

    @app_commands.command(name="echo", description="repeats what the user said back at them")
    @app_commands.describe(string1="string to echo1")
    @app_commands.describe(string2="string to echo2")
    async def echo(self, interaction: discord.Interaction, string1: str, string2: str):

what is displayed
Screenshot from 2023-09-24 11-59-28
Screenshot from 2023-09-24 11-57-33
Screenshot from 2023-09-24 11-57-48

Permission Checking

text command example

@commands.has_any_role("Bot_manager", "Minions", "Moderator") # invoking user has any of these roles
@commands.has_role("Bot_manager") # invoking user has this role

@commands.check(user_can_manage_roles) # ensure that the invoking user has any of these permissions
def user_can_manage_roles(ctx):
    return ctx.author.guild_permissions.administrator or ctx.author.guild_permissions.manage_roles

slash command example

PR Checklist

These are the things you need to ensure are covered in your PR, otherwise the CODEOWNERS will not approve your PR, not matter how much you ping them to do so on the Discord

  1. The description in the PR is a fair representation of what the PR is about.
  2. The PR is fixing one thing and one thing only.
  3. Logging. if you have N variables initialzed/used in your function, you should print all of them out to the log using logging module at least once or have a good reason why you arent.
  4. If your PR is doing something like adding a new line or removing a new line, CODEOWNERS reserve the right to ask that you undo that change unless it was for a specific reason.
  5. If you are adding a new command....document. Document the following things on help.json and the README.md
    1. The purpose of the command
    2. If the argument is called with any arguments.
      1. If it is called with any arguments, please either provide a good enough explanation of the arg that a user can tell what it will do before using the command. adding an example of how to call it with the args is not necessary but good practice.
  6. If you are making a new Class of commands, add the class to bot.json following the convention already there.
  7. Evidence of Testing. This one needs to be completed after the PR is opened. At that point, you will go on the channel on the CSSS Wall-E Test Server that was automatically created when the PR was opened and then test the following functionality. Once you had done so, you can leave a comment on the PR stating that you had done the necessary testing.
  8. Please provide ways to test whatever you just modified on the bot in the Test Cases section so that future PRs can be tested to ensure they dont break your code when merging to master

@modernNeo modernNeo requested a review from a team as a code owner September 16, 2023 19:21
@modernNeo modernNeo marked this pull request as draft September 16, 2023 19:23
@modernNeo modernNeo force-pushed the switch_help_command branch 3 times, most recently from 9dc126d to 78cbcb6 Compare September 26, 2023 00:44
@modernNeo modernNeo force-pushed the switch_help_command branch 6 times, most recently from 7335428 to c0f9c9a Compare September 26, 2023 01:15
@modernNeo modernNeo marked this pull request as ready for review September 26, 2023 01:24
@modernNeo modernNeo merged commit a1c6b72 into master Sep 26, 2023
@modernNeo modernNeo mentioned this pull request Sep 26, 2023
@modernNeo modernNeo deleted the switch_help_command branch September 26, 2023 01:26
modernNeo added a commit that referenced this pull request Sep 26, 2023
* switching from the custom help command to instead customizing the built-in help command

* updating privilege check so it now works off of the annotations instead of manually overriding that behavior

* updating the logic for ensuring that the TEST versions of wall-e only respond to commands from channels they are assigned to

* adding a command to easily purge whatever messages I sent when doing local dev work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant