spongedsc / pathways

Pathways: multi-modal AI/ML models on discord
GNU Affero General Public License v3.0
3 stars 1 forks source link

[v2/refactor] Move interactionCreate to dedicated file/module, add Actions (context menu) support #59

Closed daniwasonline closed 1 month ago

daniwasonline commented 1 month ago

Description

Currently, the interactionCreate event is colocated within the event register; this is because of the command map, which is passed into the register.

This PR moves interactionCreate to its' own module (similar to the other events). The command map is passed into the client context, which is then accessed by interactionCreate during command runs.

Why is this useful?

The colocation of interactionCreate in the register may be confusing to contributors, and/or it may be treated "specially". This shouldn't be the case.

daniwasonline commented 1 month ago

Post-PR creation addition

I accidentally pushed the Actions stuff into this refactor, so I'll have to add it as a new part of the PR itself. Requesting re-review.

Description

This pull request adds support for Discord's Context Menu Interactions. In SpongeChat, these are referred to as "Actions".

Why is this useful?

Other functions that may be more suitable as an Action than a regular Command will be added in the future (see: #57). Adding first-class support for them will be extremely useful for future usage and will reduce the total clutter / technical debt that adding such a feature may otherwise add.