Unihedro / JavaBot

Java based chat bot that runs in Java room of Stack Overflow Chat.
Apache License 2.0
15 stars 4 forks source link

Make Commands return a String #23

Closed Vogel612 closed 9 years ago

Vogel612 commented 9 years ago

Currently commands are done using a Consumer, which ends up returning nothing and taking a ChatInterface. This makes implementing replies and substituting commands a little... incoherent.

To "prevent" this from happening we should remove the connection Command -> ChatInterface, by having commands return their message output as a String instead of directly sending it. This also may allow us to just pass a String to the commands instead of the whole ChatMessage, but this may be unsuitable for commands requiring certain permissions

This would give the DefaultBot another responsibility, namely using the commands' "response" to create a message from them, that can be sent using the ChatInterface. In turn this would couple the bot with the ChatInterface, and that's not a nice way to do things... it might be interesting to extract the whole command processing to a separate class and have the bot act as a proxy / filter of sorts for the mindjail. I'd like to solicit discussion on a properly decoupled design for this before any implementation is carried out

Vogel612 commented 9 years ago

This will most probably change the way #17 will be implemented. Until this discussion is resolved I'll put it on-hold accordingly.

Unihedro commented 9 years ago

Yes.