03-25-2017, 22:32 +0100
Forum: Overview#tclcode snippets
public commands with wildcards
AuthorPost
CyBex  04-22-2006, 00:18   | [EGG] pub command Jabber  ICQ  AOL IM  Yahoo IM  MSN  Homepage
nie da
(Administrator)

Avatar

Member since 01/2004
260 Posts
Location: Berlin
                                                                                                                              
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# help function

# converts special chars for match pattern
proc stringtopattern {string} {
    return [string map [list \\ \\\\ \[ \\\[ \] \\\] ] $string]
}

# do the mode for the command
proc do_mode {channel mode text} {
    # leave when bot dont has op
    if {![botisop $channel]} {return 0}
    # loop every user
    foreach nick [chanlist $channel] {
        # if your text match the nick and isnt himself
        if {![isbotnick $nick] && [string match [stringtopattern $text] $nick]} {
            # give op
            pushmode $channel $mode $nick
        }
    }
    # clear queue (not required)
    flushmode $channel
    # return with log
    return 1
}

# main function for binds/command/trigger
proc pub_op {nick userhost handle channel text} {
    return [do_mode $channel +o $text]
}
proc pub_deop {nick userhost handle channel text} {
    return [do_mode $channel -o $text]
}
proc pub_voice {nick userhost handle channel text} {
    return [do_mode $channel +v $text]
}
proc pub_devoice {nick userhost handle channel text} {
    return [do_mode $channel -v $text]
}

# bind/command/trigger for owner,master and ops
bind pub nmo|nmo !op pub_op
bind pub nmo|nmo !deop pub_deop
bind pub nmo|nmo !voice pub_voice
bind pub nmo|nmo !devoice pub_devoice



use:
!op a* (everyone who begins with a..)
!devoice *-* (everyone who has a minus in his nick)
!deop d??f (like doof, deaf, d..f)

mfG CyBex @ QuakeNet, UnderNet, EFNet, Freenode, euIRC, GameSurge & ShadowWorld - Files
This post was edited 2 times, last on 08-14-2009, 04:26 by thommey
  The user has attached a file: pubcmd.tcl (Save, 1,193 Bytes, downloaded 47 times)
Advanced options for this topic:

Ignore this topic (Do not list this topic in the "unread topics" search. You are currently not ignoring this topic.)
Hide this topic (Hidden topics are not displayed in the topics list. This topic is currently not hidden.)
Go to forum

Unclassified NewsBoard 1.5.3-d | © 2003-4 by Yves Goergen