Page MenuHomeAITSYS Dev

[Feature] [ApplicationCommands] Rewrite
Open, Needs TriagePublic

Description

The actual DisCatSharp.ApplicationCommands Module is bad.

It trigger ratelimits multiple times on permission registration.
Furthermore the registration of permissions can't be done on an easy way (See T45: [ApplicationCommands] Refactor Core for it).

I decided, that it needs a full rewrite.

API Plan for DisCatSharp.ApplicationCommands

Methods:

  • Guild Command Registration:

RegisterGlobalCommand<Class>()
RegisterGlobalCommand<Class>(Action<PerGuildPermissions>)
RegisterGlobalCommand(Type)
RegisterGlobalCommand(Type, Action<PerGuildPermissions>)

  • Guild Command Registration:

RegisterGuildCommand<Class>()
RegisterGuildCommand<Class>(Action<GuildPermissions>)
RegisterGuildCommand(Type)
RegisterGuildCommand(Type, Action<GuildPermissions>)

  • Injection into DiscordClient:

UseApplicationCommands(Config)

Properties:

  • Commands
  • Groups
  • GroupCommands

Behaviour:

  • Pre-Register:

Check if commands exist, if yes, check if changed, otherwise internally add but don't re-register

Same for permissions to avoid Ratelimit

  • Sharding:

Per guild commands will be registered on the shard which contains the target guild

Global commands will be registered on each guild

Per guild permissions will be registered on shard with target guild

Extended function:

  • InteractionContext.ApplicationCommandsModule:

.SetPermission(string, ulong, Action<GuildPermissions>)
command name, guildid
.SetPermission(string, string, ulong, Action<GuildPermissions>)
Groupname, commandname, guildid

Automatically find targets and dynamically set permissions on the fly

Event Timeline

Nyuw triaged this task as High priority.Sat, Sep 25, 05:04
Nyuw created this task.
Nyuw created this object with edit policy "DisCatSharp (Project)".
Nyuw added projects: DisCatSharp, Restricted Project, Restricted Project.
Nyuw edited subscribers, added: DisCatSharp, DisCatSharp Contributor, Restricted Project; removed: Nyuw.
aiko moved this task from Backlog to Features on the DisCatSharp board.
aiko updated the task description. (Show Details)
aiko raised the priority of this task from High to Needs Triage.Mon, Sep 27, 06:01
aiko changed the visibility from "Public (No Login Required)" to "DisCatSharp Contributor (Project)".
aiko changed the edit policy from "DisCatSharp (Project)" to "Custom Policy".
aiko updated the task description. (Show Details)
aiko changed the visibility from "DisCatSharp Contributor (Project)" to "Custom Policy".
aiko added a subscriber: aiko.
aiko changed the visibility from "Custom Policy" to "Public (No Login Required)".Wed, Sep 29, 01:38
aiko moved this task from Backlog to Features on the DisCatSharp board.
aiko added a subscriber: Nyuw.
aiko removed Nyuw as the assignee of this task.Sat, Oct 2, 07:36
aiko assigned this task to Nyuw.
aiko moved this task from Features to In Progress on the DisCatSharp board.
aiko reassigned this task from Chibi310 to MuffinAmor.
aiko reassigned this task from MuffinAmor to Badger_2-3.
aiko reassigned this task from Badger_2-3 to Auros.
aiko reassigned this task from Auros to Nyuw.
aiko added a subscriber: Chibi310.
aiko added a subscriber: MuffinAmor.
aiko added a subscriber: Badger_2-3.
aiko added a subscriber: Auros.
aiko reassigned this task from Nyuw to Unknown Object (User).Sun, Oct 3, 05:39
aiko reassigned this task from Unknown Object (User) to DisCatSharp_Contributor.Sun, Oct 3, 05:43
aiko added a subscriber: Unknown Object (User).
aiko added a subscriber: DisCatSharp_Contributor.
aiko removed subscribers: DisCatSharp_Contributor, Unknown Object (User).