GhostBot+
Posted: Sun Dec 28, 2014 12:33 am
by aero
Now that GhostBot has been retired from the lack of spam, I'm going to share his script with everyone. Feel free to suggest changes, and use this script or parts of it for your own bot. Forgive some of the odd stuff, since I built GB around the spam attacks and used multiple sources to get some stuff done.
Spoiler: show
Code: Select all
;Connect to server
on *:START: {
server irc.stardustfields.net
}
;Join channels
on *:CONNECT: {
join #smbx
join #smbx-staff
join ##smbx-entrance-blocked
}
;Initialize guardmode
on *:LOAD: {
set %guardmode 0
}
;Prevents changing nick 3 or more times within 5 seconds
on *:NICK:{
inc -u5 %spam. [ $+ [ $nick ] ]
if (%spam. [ $+ [ $nick ] ] >= 3) && ($nick !isop $chan) && (%guardmode = 1) {
ban $chan $wildsite
kick $chan $nick Nick change spam.
notice GhostHawk $nick has been banned.
halt
}
}
;Prevent noticing the channel
on *:NOTICE:*:#smbx: {
if (%guardmode = 1) && ($nick !isop $chan) {
ban $chan $wildsite
kick $chan $nick Noticing $chan
notice GhostHawk $nick has been banned.
halt
}
}
;Determine if guardmode is on or off
on *:TEXT:*:#: {
if ($1 == ?guard) && ($nick isop $chan) && (%guardmode == 1) {
msg $chan Guard mode is on.
}
elseif ($1 == ?guard) && ($nick isop $chan) && (%guardmode == 0) {
msg $chan Guard mode is off.
}
;Set guardmode to be on or off
if ($1 = ?guardmode) && ($2 = on) && ($nick isop $chan) {
set %guardmode 1
msg $chan Guard mode is now on.
}
elseif ($1 = ?guardmode) && ($2 = off) && ($nick isop $chan) {
set %guardmode 0
msg $chan Guard mode is now off.
}
;Prevent saying 5 or more lines of text within 3 seconds
if (%guardmode = 1) {
inc -u3 %spam. [ $+ [ $nick ] ]
if (%spam. [ $+ [ $nick ] ] >= 5) && ($nick !isop $chan) && (%guardmode = 1) {
ban $chan $wildsite
kick $chan $nick Spam.
notice GhostHawk $nick has been banned.
halt
}
;Kick if starman or donger is said
if (*starman* iswm $1-) || (*donger* iswm $1-) {
kick $chan $nick
}
;Prevent wall of text from being sent as soon as user joins
if ($len($1-) >= 150) && (%lastj == $nick) {
ban $chan $wildsite
kick $chan $nick You appear to be a spambot.
notice GhostHawk $nick has been banned.
}
set %text $1-
set %s 1
set %totalwords 0
;Looks how many lines is in your text file
set %lines $lines(badwords.txt)
while ( %s <= %lines ) {
;Counts the number of badwords in your message, and bans if 6 or more badwords are said
if ($read(badwords.txt, %s ) isin %text ) {
inc %totalwords. [ $+ [ $nick ] ]
inc %s
}
else inc %s
}
if (%totalwords. [ $+ [ $nick ] ] >= 6) {
ban $chan $wildsite
kick $chan $nick Spam.
notice GhostHawk $nick has been banned.
unset %s
unset %totalwords. [ $+ [ $nick ] ]
halt
}
else {
unset %s
unset %totalwords. [ $+ [ $nick ] ]
halt
}
}
}
;Prevent revolving door spam
on *:PART:#:{
set -u60 %rd. [ $+ [ $chan ] $+ . $+ [ $nick ] ] $calc( %rd. [ $+ [ $chan ] $+ . $+ [ $nick ] ] + 1 )
if (%rd. [ $+ [ $chan ] $+ . $+ [ $nick ] ] >= 4) {
if (%guardmode = 1) {
ban $chan $wildsite
kick $chan $nick Part/Join spam.
notice GhostHawk $nick has been banned.
}
}
}
;Auto-rejoin
on *:KICK:#: {
join #
}
;Automatically turns on guardmode if someone quits with spambot in their quit message, used with Xanos
on *:QUIT: {
if (*spambot* iswm $1-) && (%guardmode = 0) {
set %guardmode 1
msg #smbx Guard mode is now on.
}
}
on *:JOIN:#:{
;Message user why they aren't able to join
if ($chan == ##smbx-entrance-blocked) && ($wildsite isban #smbx) {
notice $nick Hi $nick $+ . You are here because you are banned from #smbx. To appeal this ban, message an OP.
}
if ($chan == ##smbx-entrance-blocked) && (r isin $chan(#smbx).mode) && ($wildsite !isban #smbx) {
notice $nick Hi $nick $+ . You are here because you must be authenticated with NickServ before joining #smbx at this time. Use the following command for help to either register to $network or login: /msg NickServ HELP
}
if ($chan == ##smbx-entrance-blocked) && (i isin $chan(#smbx).mode) && ($wildsite !isban #smbx) {
notice $nick Hi $nick $+ . You are here because you must be invited into #smbx to join at this time. Contact an op and they will invite you shortly.
}
;Prevent duplicates of a host from joining.
if (%guardmode = 1) {
if ($ialchan($address,#,0) >= 3) {
ban $chan $wildsite
kick $chan $nick Clone.
notice GhostHawk $nick has been banned.
}
;Set the last joined user, to prevent wall of text when they join
set -u30 %lastj $nick
}