-
-
Notifications
You must be signed in to change notification settings - Fork 0
CreateRule
Imani brown edited this page Aug 1, 2024
·
1 revision
The createRule store is a helper function that allows you to create Rule rules while giving you types the
While developing this package, I encountered an issue with the RuleStore and its type definitions. When using a RuleStore with multiple event types, the type definitions would often become inconsistent or incomplete. To address this problem, I created the createRule function. This function provides a simple and effective solution by ensuring that type definitions remain accurate and reliable, even when multiple event types are used within a single RuleStore.
- Purpose: Creates a transformation rule for replacing placeholders in Discord bot messages.
-
Parameters:
-
identifier
: Placeholder identifier (e.g.,{username}
). -
event
: Discord.js event type (e.g.,"messageCreate"
). -
handler
: Function handling the event to return the replacement value.
-
-
Returns: A
Rule
object defining the transformation rule.