Add option to make the bot respond to command characters



8 years ago
4 years ago


(Reporter: darrob, Unassigned)


Firefox Tracking Flags

(Not tracked)



(1 attachment, 1 obsolete attachment)



8 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv: Gecko/20100401 Firefox/3.6.3
Build Identifier: 2.6

It would be nice if mozbot could be addressed using a command character like '!' or '@'. '!topic' would be equivalent to 'mozbot: what is topic?'. This is a much used feature of other infobots like #debian's blootbot.

Reproducible: Always
I'll get a patch ready in the next couple of days.
Assignee: nobody → mozilla.bugs
Ever confirmed: true

Comment 2

8 years ago
This will have to be per-channel disable-able since a channel with two bots will conflict.  It should also be per-module disable-able since some module's commands may conflict with others and some modules may do things twice (like the bugzilla module which would respond to !bug 123456 anyway so there's no need to have deliberate prefacing).  You need to make sure that "mozbot: !topic" also responds correctly.

The way to do this is to route all things that mozbot "hears" in the approved channels through a loop that checks for ! and then passes to an approved list of modules turning a "heard" to a "told".  To prevent doubling up, you'll need to then pull out the "used" modules from the normal flow of processing.

What's significantly easier is to have each module have commands that are !-prefaced like the seen module and have it be controlled per-module.  The downside is new modules don't get this functionality unless it's written in.

As for handling !topic, there's a topic module but it requires changes to the mozbot central program that requires perl 5.10 which means a perl upgrade on most systems running it.  (Which is why I haven't posted it.)  But to be fair if you just want to read the topic rather than set it, use /topic, it's faster and avoids spamming everyone else in the channel.

Comment 3

8 years ago
Cww, I apologize for using "topic" as an example. I don't care about reading/changing the channel's topic at all. I should have said "foo" or "firefox". You guys obviously got the overall idea anyway, but just to be clear:

"!foo" would be equivalent to "mozbot: what is foo?".
"!tell user about firefox" would be equivalent to "mozbot: tell user about firefox".

I don't know anything about the technical aspect of this. Personally I think it would be sufficient to make only the Infobot module listen for the command character if that makes things any easier.

Thanks to the both of you.
Could we go with "@" since that wont conflict with any of the other commands?

Comment 5

8 years ago
I've generally seen people who are new to mozbot in a channel use !, particularly for infobot. So @ doesn't seem useful to me.

I don't agree that it needs all the complexity that Comment 2 implies. Specifically, adding a bunch of configuration options just adds even more pain to configuring mozbot.

My personal thought here is to start with this as infobot specific. Not every command in every module is worth having as !foo. So work from there.

Comment 6

8 years ago
I think the comchar shouldn't be hard-coded but settable somehow, so that bots don't interfere with each other.
Created attachment 446286 [details] [diff] [review]
Patch v. 1.0

This has a fix where the bot replies to any ![info item] head in the channel if eagerToHelp is turned on.  I didn't add a pref to change the character, but for the moment, that is easy to do by hand for those with access to the source code.

I apologize that this patch also contains the reviewed patch for Bug 555478, but in the interest of time--and since that patch has already been granted review, I left it in anyway.
Attachment #446286 - Flags: review?(bugtrap)
Created attachment 446293 [details] [diff] [review]
WIP v. 1.1

This patch ignores the !8ball and !topic commands.  Any others that we want ignored can be put in that regular expression.
Attachment #446286 - Attachment is obsolete: true
Attachment #446293 - Flags: review?(bugtrap)
Attachment #446286 - Flags: review?(bugtrap)

Comment 9

8 years ago
The patch works great. Thank you very much for your work.

However, after a few days of using it I have to report that it seems to be counter-intuitive that the command character can only be used for asking questions and not for teaching or using "tell".
What would you like as the syntax for tell?

"!something is something"?

Comment 11

8 years ago
I think people generally expect the command character to have the exact same effect as addressing the bot by nickname.

That means that the following commands should be equivalent.

1) Asking:
mozbot: what is firefox?
!what is firefox?
mozbot: firefox

2) Teaching:
mozbot: Firefox is a browser.
!Firefox is a browser.

3) Tell:
mozbot: tell user about firefox
!tell user about firefox

Ideally things covered by other modules would work too. I am specifically thinking of the Greetings module.

"!Hello" should be the same as "mozbot: Hello" (triggers Greeting) and not "mozbot: what is Hello?" (triggers Infobot).

I can imagine that this is harder to implement though and I think the Infobot module should be the focus of this feature.
Comment on attachment 446293 [details] [diff] [review]
WIP v. 1.1

I will have a new patch in a few days.
Attachment #446293 - Flags: review?(bugtrap)
Scratch that, I don't have time to make the changes suggested in comment 11.
Assignee: mozilla.bugs → nobody
Attachment #446293 - Attachment description: Patch v. 1.1 → WIP v. 1.1
You need to log in before you can comment on or make changes to this bug.