CloudBotIRC / CloudBot

CloudBot - The simple, fast, expandable, open-source Python IRC Bot!
GNU General Public License v3.0
273 stars 250 forks source link

paraml equivelent on cloudbot? #234

Closed ghost closed 8 years ago

ghost commented 8 years ago
`@hook.command("rape", "spankk", "diddle", "pet", "honk", autohelp=False)
def honk(text, nick=None, conn=None, chan=None, db=None, paraml=None):
    "honk <nick> -- Honks at someone."
    target = text.strip()
    command = paramll[-1].split(' ')[0][1:].lower()

    if len(text) == 0:
        if random.randint(1, 3) == 2: 
            out = citation(db,chan,nick,"for {}".format(actions[command][1]))
        else:
            out = "PRIVMSG {} :\x01ACTION {}s {}\x01".format(chan, command, nick)
    else:
        randnum = random.randint(1, 4)
        if randnum == 1: 
            out = citation(db,chan,nick,"for {}".format(actions[command][1]))
        elif randnum == 2: 
            out = citation(db,chan,target,"for being too lewd and getting {}".format(actions[command][0]))
        else:
            out = "PRIVMSG {} :\x01ACTION {}s {}\x01".format(chan, command, target)
    conn.send(out)`
``` What's the paraml equivalent on cloudbot if there is any?
ctian1 commented 8 years ago

paraml?

Red-M commented 8 years ago

How about you just use input...

On 1 June 2016 at 12:25, Pangea notifications@github.com wrote:

paraml?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/CloudBotIRC/CloudBot/issues/234#issuecomment-222875961, or mute the thread https://github.com/notifications/unsubscribe/ABZoEecSTJ04bw7Nki6JbjcH_B2lZaqgks5qHO21gaJpZM4IrCJ4 .

ghost commented 8 years ago

Because I need to use a different part of the table based on which alias was used and I don't want 50 if statements, and I don't want 50 different functions that do the same thing.

Red-M commented 8 years ago

I think you're, firstly, exaggerating what you'd need to do. Secondly, you should just make the main guts of this a function then pass in what you need from each command into that function. I can't be bothered reading directly into cloudbot's run statements for commands.

On 1 June 2016 at 13:21, ihatevim notifications@github.com wrote:

Because I need to use a different part of the table based on which alias was used and I don't want 50 if statements, and I don't want 50 different functions that do the same thing.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/CloudBotIRC/CloudBot/issues/234#issuecomment-222882591, or mute the thread https://github.com/notifications/unsubscribe/ABZoEUlzmJe6mvjVWmsGJb1M-zztCN2dks5qHPqrgaJpZM4IrCJ4 .

edwardslabs commented 8 years ago

I think you are looking for triggered_command https://github.com/CloudBotIRC/CloudBot/blob/master/cloudbot/event.py#L335

ghost commented 8 years ago

<3 i love u, thank u edwardslabs