quait / madcow

Automatically exported from code.google.com/p/madcow
GNU General Public License v3.0
0 stars 0 forks source link

feature request #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What is the expected output? What do you see instead?
have it answer to commands beginning with a symbol such as ! @ $ & or .
using the botname is too long and time consuming :)

What version of the product are you using? On what operating system?
1.6.1 on Ubuntu 9.04

Please provide any additional information below.

Original issue reported on code.google.com by michael....@gmail.com on 4 Aug 2009 at 7:52

GoogleCodeExporter commented 9 years ago
oops, not a defect, just a request.

Original comment by michael....@gmail.com on 4 Aug 2009 at 7:59

GoogleCodeExporter commented 9 years ago
Added a new setting 'aliases', which are other things the bot will respond to, 
so you can set them yourself.

It's in subversion if you want to get it before the next release, as I am not 
sure when I'll be doing that.

Original comment by cjo...@gmail.com on 7 Aug 2009 at 4:36

GoogleCodeExporter commented 9 years ago
Perhaps I'm not using it correctly but it seems an alias you add requires a 
space
between the alias and the bot command. I just have alias=! set in the ini and it
seems that only '! txt' and similar will work. Is there something I can change 
or
will it not work that way as it's coded presently?

Original comment by fminus%h...@gtempaccount.com on 12 Aug 2009 at 1:09

GoogleCodeExporter commented 9 years ago
Hmm yeah, this is because internally it replaces the alias with the botname, 
and a space is expected after that.  
I'll see about changing the logic for that.

Original comment by cjo...@gmail.com on 12 Aug 2009 at 8:36

GoogleCodeExporter commented 9 years ago
Why not add that to you protocol source file?
e.g. in irc.py:

in pubmsg event handler:

a = string.split(e.arguments()[0], ":", 1)
if len(a) > 1 and irclib.irc_lower(a[0]) == irclib.irc_lower(c.get_nickname()):
    self.do_command(e, string.strip(a[1]))
elif (len(a) == 1 and len(a[0]) > 2) and
string.strip(a[0]).startswith(self.config.irc.commandChar):    #
self.config.irc.commandChar = '?' or something else
    self.do_command(e, string.strip(e.arguments()[0][1:]))

do_command looks like this:

def do_command(self, e, cmd, source_privmsg=False):
    cmds = cmd.strip().split(" ")
    try:
        cmd_handler = getattr(self, "cmd_" + cmds[0])
        cmd_handler(cmds[1:], target)
    except AttributeError:
        cmd_handler = None
        print 'Unknown command'

and command handlers are defined like e.g.:
    def cmd_names(self, args, targ):
    self.server.send_raw('NAMES ' + args[0])
    self._privmsg(targ, 'Sent names cmd for %s' % args[0])

and now you type on channel: ?names #channel
and bot responds to command 'names'

this is not full working solution, it is only example, i'm using something like 
this
on my modified version of protocols/irc.py

Original comment by SpeedyGhost@gmail.com on 12 Aug 2009 at 9:14

GoogleCodeExporter commented 9 years ago
Well, that is interesting functionality; but it is IRC-specific and I want the 
alias feature to work for the AIM people 
as well.  I figure they could probably use it, with not having tab complete for 
nick's.  When I get a chance, I will 
probably modify the algorithm to match on word boundary so that punctuation 
aliases don't require a space, 
whereas a real name would.

Also considering the RAW commands... although probably only for authenticated 
admins, as it seems ripe for 
abuse.

Original comment by cjo...@gmail.com on 12 Aug 2009 at 7:50

GoogleCodeExporter commented 9 years ago
this is fixed in next release.. i didn't add RAW functionality, you'll have to 
patch this back in if you use this 
update.  i might consider this for the future, but it's quite a can of worms

Original comment by cjo...@gmail.com on 29 Sep 2009 at 10:15

GoogleCodeExporter commented 9 years ago

Original comment by cjo...@gmail.com on 29 Sep 2009 at 10:16