source: GuardChan/guardchan.tcl @ 39

Revision 39, 1.4 KB checked in by james, 4 years ago (diff)

add ban option

Line 
1# GuardChan by JamesOff
2# Kickbans people if they're not in the bot's userfile
3# No other filtering options, sorry
4#
5# Released under the BSD licence
6# http://jamesoff.net/site/projects/eggdrop-scripts/guardchan
7
8# Instructions:
9#  - edit the owner setting below to your nick
10#  - choose if you want just kicks or bans too
11#  - load script
12#  - for channels you want to protect: .chanset #channel +guardchan
13
14# (default has invalid char in to make sure you set it)
15set guardchan_owner "YOUR_NICK_HERE%"
16
17# set to 1 to ban users rather than just kick them
18set guardchan_ban 0
19
20# Stop editing here unless you like TCL
21#
22#
23#
24#
25#
26#
27# No really, TCL is a world of pain ;)
28
29bind join - *!*@* guardchan_join
30
31setudef flag guardchan
32
33proc guardchan_join { nick host handle channel } {
34  global guardchan_owner guardchan_ban
35
36  if {![channel get $channel guardchan]} {
37    return 0
38  }
39
40  if {$handle == "*"} {
41    if [botisop $channel] {
42                        if {!$guardchan_ban} {
43                                putkick $channel $nick "You are not permitted to be in here"
44                                puthelp "PRIVMSG $guardchan_owner :Kicked $nick from $channel"
45                        } else {
46                                set ban [maskhost "$nick!$host"]
47                                newchanban $channel $ban "guardchan" "Banned for not being in userfile"
48                                puthelp "PRIVMSG $guardchan_owner :Banned $nick from $channel"
49                        }
50      return 0
51    } else {
52      puthelp "PRIVMSG $guardchan_owner :HELP! $nick has joined $channel and I can't do anything about it :("
53      return 0
54    }
55  }
56}
57
Note: See TracBrowser for help on using the repository browser.