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

Add config for different command trigger #189

Open
vwbusguy opened this issue May 24, 2021 · 2 comments
Open

Add config for different command trigger #189

vwbusguy opened this issue May 24, 2021 · 2 comments

Comments

@vwbusguy
Copy link
Contributor

vwbusguy commented May 24, 2021

The current code hard codes commands to start with '.' (Ref. https://github.com/JohnMaguire/Cardinal/blob/master/cardinal/plugins.py#L30). This is a problem for joining it to a room with other historical bots that are already listening on . and may have overlapping command keys. Looking at this, we should be able to add a char config option and cast it to the regex (replace \. with %c and make "." the default config). However, it appears that the regex is currently defined outside of the context of an available config., but setting it during __init__() instead should suffice without having to update https://github.com/JohnMaguire/Cardinal/blob/master/cardinal/plugins.py#L688, too.

@johnmaguire
Copy link
Owner

Wondered when this request would come in. Seems like an easy enough change. If you want to put up a PR, I'd likely merge it. Otherwise, I'll look into it hopefully soon.

One thing to keep in mind is that plugins can also define regex-based commands, and so there may be some cases where this won't work perfectly.

For example the ticker plugin which uses ! instead of . because Cardinal replaced functionality of a since-removed bot in a channel that used !. I'd like to move this one back into a regular @command, but there's some additional work to support relayed bots. Currently ticker and crypto implement relayed bot support themselves, but this should probably move into the core.

I am pretty sure ticker is the only plugin today that doesn't use COMMAND_REGEX for its commands.

@johnmaguire
Copy link
Owner

Hm, I recall the issue with implementing this now - currently help for commands is implemented via raw text (both passed in the @help() decorator as well as common responses for invalid command syntax.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants