rebolbot
rebolbot copied to clipboard
Rework how current message components are made visible to commands
After modularization, some methods invoked by command parse rules still take as parameters some variables which are global (e.g. message-id, parent-id) and are set to the component of the current message being processed.
This is redundant and the current message handling should be reworked depending on how the bot is going to evolve (i.e. will it be always single tasking, handling just one chat room at once, handling just one chat system at once, etc.).
I was going to rework it to pass the message as an object parameter
Sent from my iPod
On 12/04/2013, at 8:43 PM, asampal [email protected] wrote:
After modularization, some methods invoked by command parse rules still take as parameters some variables which are global (e.g. message-id, parent-id) and are set to the component of the current message being processed.
This is redundant and the current message handling should be reworked depending on how the bot is going to evolve (i.e. will it be always single tasking, handling just one chat room at once, handling just one chat system at once, etc.).
— Reply to this email directly or view it on GitHub.
You can try that, but where would you want to define this object? In process-dialect? The individual command rules are concatenated there, but they are bound to variables in the particular command modules when the command module is created. I'm not clear myself (I'd have to experiment a little) how a newly created message object would be passed to functions of the command module by a function call in a rule.
I'd create the object here https://github.com/gchiu/rebolbot/blob/master/rebolbot.r3#L303