FlexHub Forum

Send unknown commands to MC

Send unknown commands to MC
« on: November 23, 2011, 23:44:56 »

Have a request.

We're using an external bot that needs commands to be sent in MC.
But now it's not possible (what I can see) to use same prefix as the hub, but if we do the hub will respond with "Unknown command: XYZ"

My request is: For unknown commands just send it to main (so the external bot can see and act on it)
have tried this by changing line 1838 to: tSend:ChatToAll(line, sid) in Hub-funcs.lua and it do the trick...
(in the last Else statement in the - ["HubCommand"] = function(self, sid, line, tosid) - function)

Maybe a good solution is to add "pass-through" commands in a table instead of as my test above thats sends all unknown commands to make it possible just for some commands to go through and show "Unknown command: ..." for the others.

// Mike
« Last Edit: November 23, 2011, 23:46:46 by mike99 »

Re: Send unknown commands to MC
« Reply #1 on: November 24, 2011, 02:10:19 »
Rather than trying to edit the hub, why not just set the external bot to use a different prefix? so instead of ! or + set it to use @ or #

Reason I say that is because the hub itself tries to suggest the correct commands, or explains why they failed. Allowing commands through isn't really the best idea.

Also try looking closer into how the external bot works. As you may find it could reply to the error's posted in the feed.

Oh and most importantly. Avoid at all costs editing the main lua files as you can cause more problems than it's worth, if you damage the main files and get problems you will be advised to return them to release versions before getting support.

Re: Send unknown commands to MC
« Reply #2 on: November 24, 2011, 22:24:51 »
My idea to have same prefix (and yes I thought about that) is that the users normally use + (we used YnHub and now PX) and for them the it's harder to understand what prefix they have to use for what.
For examples all textcommands use the Hub prefix and all bots the "x" one.
Non of the other hubsoft acted like this, instead only acts on there own commands - and gives error if used wrong.

And yes I know that changing the code is a bad idea, so I did it for testing (in a test-hub) if it was possible and then filed a request for it.

If it was possible to add a Command (addcmd) that could use the parameters in "<Text>" as a variable (example %[param]) we maybe could use that.

Offline FlipFlop™

  • FlexHub Developer
  • *****
  • 505
Re: Send unknown commands to MC
« Reply #3 on: November 25, 2011, 00:15:16 »
I think we can add a setting to allow unknown commands to be sent to mainchat, for cases like this.
Personally i'd prefer a separate prefix for commands to the bot as ProProductions mentioned, but I can see the benefit for others when allowed to use the same prefix.

Another option would indeed be to create textcommands with addcmd to allow specific commands, but that would need a change in code as well, to allow such a command with a random number of arguments. And it takes a lot of maintenance, since each botcommand would need such an addcmd entry.
Check the new FlexHubList!           Add awesome statistics like this for your hub!

This post is a natural product. The slight variations in spelling and grammar enhance its individual character and beauty and in no way are to be considered flaws or defects.