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

Commands #36

Open
Stronkfish opened this issue Sep 23, 2019 · 2 comments
Open

Commands #36

Stronkfish opened this issue Sep 23, 2019 · 2 comments
Assignees

Comments

@Stronkfish
Copy link

Idea: Add the ability to use commands such as joindate, this could be implemented by giving the bot a command (e.g. !command joindate) or making the command direct instead of posting "/joindate (username)" in public chat

@starcraft66 starcraft66 self-assigned this Sep 23, 2019
@starcraft66
Copy link
Owner

Thanks for opening this issue. This was brought up a long time ago and I never got to implementing it.

I think we could add a command called something like mc!command or mc!exec to allow users to execute commands via the bot.
My biggest concern at the moment is how to deal with commands that return output back to the user. I don't think that command output should be returned into the main chat feed because it is only relevant to the user who executed the command. The problem is that there is no guaranteed way to find out exactly what received messages to send back to the user executing a command because technically speaking, there is nothing linking the chat output to the executed command.
One way to do it would be to blindly assume that any chat messages received within a few seconds after executing the command that don't match any other regexes are the command's output.

@starcraft66
Copy link
Owner

After having sleept on this for a while, I think that adding a plug-in system to the bridge would be the best way to handle this feature. Since this bridge aims to be compatible with any minecraft server, it is not reasonable for it to attempt to support parsing the output of commands not featured in the vanilla Mojang minecraft server implementation.

For example, a plug-in specifically tailored to the constantiam.net server could be loaded and register a callback associated to a regex pattern corresponding to the output of a command. Another way would be for the plugin to register an event handler for every incoming chat message and decide what to do with them. I still need to think about these approaches some more in order to handle matching command output sprawled over multiple lines (causing multiple seperate events to fire or several passes of the regex parse) that would need to be put back together before being sent to a user.

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