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

chore: Update permCheck.ts #112

Merged
merged 9 commits into from
Jul 9, 2024
Merged

Conversation

Peter-MJ-Parker
Copy link
Contributor

@Peter-MJ-Parker Peter-MJ-Parker commented Jul 7, 2024

Allows users to check member perms before using specific sub command groups, sub commands, and options!

Plugin Submission Checklist

Before submitting your plugin, please ensure that you have followed the specifications below:

  • Your plugin code includes a JSDoc block with @plugin at the beginning and @end at the end.
  • The order of plugin metadata within the JSDoc block follows the structure provided:
    1. @plugin
    2. description
    3. @author (you can have multiple authors in this format: @author @jacoobes [<@182326315813306368>])
    4. @version (with the version number)
    5. @example (a nice example of how to use your plugin)
    6. @end

this is an example:

/** 
 * @plugin
 * filters autocomplete interaction that pass the criteria
 * @author @jacoobes [<@182326315813306368>]
 * @version 1.0.0
 * @example
 * ```ts
 * import { CommandType, commandModule } from "@sern/handler";
 * import { filterA } from '../plugins/filterA.js'
 * export default commandModule({
 *    type : CommandType.Slash,
 *    options: [
 *       {  
 *          autocomplete: true,
 *          command : {
 *             //only accept autocomplete interactions that include 'poo' in the text
 *             onEvent: [filterA(s => s.includes('poo'))],
 *             execute: (autocomplete) => {
 *                let data = [{ name: 'pooba', value: 'first' }, { name: 'pooga', value: 'second' }]
 *                autocomplete.respond(data) 
 *             }
 *          }
 *       }
 *    ],
 *    execute: (ctx, args) => {}
 * })
 * @end
 */

Plugin Submission Details

Allows users to dynamically require certain permissions to use separate subcommands, subcommand groups, and hoisted options.

Additional Notes

Reverted the original function and changed the parameters up a bit.

Allows users to check member perms before using specific sub command groups, sub commands, and options!
Copy link
Member

@SrIzan10 SrIzan10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well done, @jacoobes or @EvolutionX-10 can check if i got some reviews & javacsript syntax fixes right

plugins/permCheck.ts Outdated Show resolved Hide resolved
plugins/permCheck.ts Outdated Show resolved Hide resolved
Reverted permCheck back to a function to avoid breaking changes.
@SrIzan10 SrIzan10 requested a review from DuroCodes July 7, 2024 21:27
Remove console logs
plugins/permCheck.ts Outdated Show resolved Hide resolved
plugins/permCheck.ts Outdated Show resolved Hide resolved
plugins/permCheck.ts Outdated Show resolved Hide resolved
plugins/permCheck.ts Outdated Show resolved Hide resolved
plugins/permCheck.ts Outdated Show resolved Hide resolved
plugins/permCheck.ts Outdated Show resolved Hide resolved
plugins/permCheck.ts Outdated Show resolved Hide resolved
plugins/permCheck.ts Outdated Show resolved Hide resolved
plugins/permCheck.ts Outdated Show resolved Hide resolved
plugins/permCheck.ts Outdated Show resolved Hide resolved
jacoobes and others added 2 commits July 7, 2024 18:48
Fixed overall formatting
simplified ephemeral booleans
No longer destructuring interaction from ctx
fixed in guild from not fully returning controller.stop()
remove `no_guild` function in favor of hard coding
imported type CommandType
@Peter-MJ-Parker
Copy link
Contributor Author

If anyone is in favor of Object.assign(...), please show me the best way to do it in this plugin. I can't figure it out with messing up the original plugin.

Remove ALL destructures `({ ctx })` --> `(ctx)`
edit response for not being in guild
Remove all breaking changes while maintaining integrity of new features as well as original!
Copy link
Contributor Author

@Peter-MJ-Parker Peter-MJ-Parker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assigned functions to object with help of @jacoobes !

Thanks to Duro for simplifying the code into one function!
@jacoobes jacoobes self-requested a review July 9, 2024 16:47
@jacoobes jacoobes requested a review from SrIzan10 July 9, 2024 16:48
@SrIzan10
Copy link
Member

SrIzan10 commented Jul 9, 2024

@sernbot ready to merge

@jacoobes jacoobes merged commit 21d18bb into sern-handler:main Jul 9, 2024
1 check passed
@Peter-MJ-Parker Peter-MJ-Parker deleted the patch-2 branch July 9, 2024 21:00
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.

3 participants