Chew / JDA-Chewtils

Chew's fork of JDA-Applications/JDA-Utilities, with support for modern features such as Slash Commands, Context Menus, and more.

Home Page:https://chew.pro/JDA-Chewtils

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CommandClientBuilder#setGuildOnly(boolean) method

Andre601 opened this issue · comments

Issue Checklist

  • I have checked for similar issues on the Issue tracker
  • I have updated to the latest version of JDA-Chewtils.
  • I have checked the branches or the maintainer's PRs for upcoming features and updates.

Affected Modules

Command

Description

The CommandClientBuilder should have a setGuildOnly setting that when applied would set all slash commands to be guild only.

The reason behind this is to reduce duplicated code, namely the guildOnly boolean you set in the constructors of each Class.

I'm not sure how this should be implemented tho, but I'm sure it could be a beneficial feature, especially once #8 is being looked into and perhaps even implemented...

This already exists with forceGuildId if it's set to anything other than null, it will only upsert to that server.

This already exists with forceGuildId if it's set to anything other than null, it will only upsert to that server.

My goal is a global option, not one that reatricts a command to one servr only.

This is in the commandclientbuilder, ALL slash commands would upsert to that one server.

See: https://github.com/Chew/ChanServ/blob/main/src/main/java/pw/chew/chanserv/ChanServ.java#L73

This is not what I suggest.
Not a command for one specific guild, but all...

Now I'm confused, what do you want?

I just want a way to globally set all commands to guild only without the need of setting this.guildOnly = true; in each command class itself.

Yes, CommandClientBuilder#forceGuildId("id here") essentially does this.guildOnly = true AND this.guildId = "id here"; for ALL Slash Commands.

Yes, CommandClientBuilder#forceGuildId("id here") essentially does this.guildOnly = true AND this.guildId = "id here"; for ALL Slash Commands.

...which is not what I want, because I don't want the commands to only work in a single guild alone.

Ohh I see what you mean, you want all commands to be this.guildOnly by default, which it is. It'd only be useful if you set it to false.

True.
But maybe we could have some other setters/methods to apply default values. Like default allowed roles, users, permissions, etc.

But when I recall correctly could you make a own custom command client for this to apply default settings, but not sure here...

Yeah, the way it's done now is... very weird. I'm sure there's a better way to specify things without having a method with 30 parameters and counting...