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

Reactions #2

Merged
merged 2 commits into from
Apr 4, 2024
Merged

Reactions #2

merged 2 commits into from
Apr 4, 2024

Conversation

lcox74
Copy link
Contributor

@lcox74 lcox74 commented Apr 4, 2024

This PR introduces a Reactions handling system, integrating a message reactions into the rule-based architecture of Tony. Central to this update is the introduction of a reaction handler that leverages a rules system AutoPinRule which automatically pins messages that meet specific reaction criteria.

Key Features

  • Refactoring for Clarity and Flexibility: Updated terminology from "commands" to "applications" and implemented type masking to enhance clarity and system flexibility.

  • Reaction Handler via Rules System: Implemented a reaction handler that operates through a rules-based system.

  • Reaction Example with AutoPinRule: Added an AutoPinRule as a practical example of how the new reaction system can be applied. This rule automatically pins messages that receive a specific reaction (the pin emoji 📌) a predefined number of times, demonstrating the system's potential for automated moderation and user interaction enhancement.

Technical Details

The moderation rules system is now just called application rules which can handle moderations on messages or reactions. By registering reaction rules, the system can respond to reactions in a context-sensitive manner.

To integrate a new reaction rule, one simply adds a registration call such as:

bot.RegisterRules(
    framework.Rule(".*", &rules.AutoPinRule{}), // Run on all channels
)

@lcox74 lcox74 merged commit 9f67f75 into main Apr 4, 2024
@lcox74 lcox74 deleted the reactions branch April 4, 2024 05:53
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