Hey everyone! TAD here and I'm introducing official development of Staff Bot 7. I'd really like to involve the community here so if you would like to see something new or specific on the newest version of Staff Bot, please let me know. Also, if you're interested in helping me out, feel free to comment or send me a message :D
alias sbperm {
If ($1 == version) { return 7.0.0.0.dev }
If ($1 == title) { return Staff_Bot }
If ($1 == author) { return The_Almighty_Duelist }
If ($1 == root) { return none }
If ($1 == path) { return none }
If ($1 == desc) { return Automated bot with support for running channels and staff on an IRC network. }
If ($1 == product_id) { return s001-7000 }
If ($1 == installation_id) { return $readini(agfile.ini,sbot,installation_id) }
}
alias sbstatus { return $readini(sbot/sbot.ini,status,$1) }
alias sbset { return $readini(sbot/sbot.ini,settings,$1) }
on *:LOAD: {
If ($readini(agfile.ini,sbot,installed) != yes) {
If ($readini(agfile.ini,sbot,registered) != yes) {
agfile register sbot $sbperm(version) $sbperm(title) $sbperm(author) no $sbperm(root) $sbperm(path) $sbperm(desc)
echo -a Please type /install sbot to install Staff Bot $sbperm(version) $+ .
}
Else {
echo -a Please type /install sbot to install Staff Bot $sbperm(version) $+ .
}
}
If ($readini(agfile.ini,sbot,version) != $sbperm(version)) {
agfile update sbot $sbperm(version) $sbperm(title) $sbperm(product_id) $sbperm(installation_id) $sbperm(author) no $sbperm(root) $sbperm(path) $sbperm(desc)
sbot update
}
}
on *:START: {
If ($readini(agfile.ini,sbot,installed) != yes) {
If ($readini(agfile.ini,sbot,registered) != yes) {
agfile register sbot $sbperm(version) $sbperm(title) $sbperm(author) no $sbperm(root) $sbperm(path) $sbperm(desc)
echo -a Please type /install sbot to install Staff Bot $sbperm(version) $+ .
}
Else {
echo -a Please type /install sbot to install Staff Bot $sbperm(version) $+ .
}
}
If ($readini(agfile.ini,sbot,version) != $sbperm(version)) {
agfile update sbot $sbperm(version) $sbperm(title) $sbperm(product_id) $sbperm(installation_id) $sbperm(author) no $sbperm(root) $sbperm(path) $sbperm(desc)
sbot update
}
}
alias sbot {
If (!$1) { start sbot }
Elseif ($1 == install) {
mkdir sbot
writeini sbot/sbot.ini status installed yes
writeini sbot/sbot.ini status installdate $ctime
writeini sbot/sbot.ini status defcon 5
writeini sbot/sbot.ini settings defcon off
writeini agfile.ini status installing no
agfile install sbot s001-7000d
echo -a StaffBot Installation completed!
}
Elseif ($sbstatus(installed) != yes) { halt }
Elseif ($1 == defcon) {
If (!$2) {
echo -a Please select from the following options:
echo -a To turn defcon on or off, please type /sbot defcon <on|off>
echo -a To change the level of defcon, please type /sbot defcon <level>
echo -a To learn more about the different levels of defcon, please type /sbot defcon help
}
Elseif ($2 == on) || ($2 == off) {
writeini sbot/sbot.ini settings defcon $2
defcon $2
echo -a Defcon has been sucessfully turned $2 $+ .
}
Elseif ($2 isnum 1-5) {
writeini sbot/sbot.ini status defcon $2
defcon $2
echo -a Defcon has been sucessfully changed to $2 $+ .
}
Elseif ($2 == help) {
echo -a Defcon 1 - Sets channel mode +m
echo -a Defcon 2 - Sets channel mode +im
echo -a Defcon 3 - Sets channel mode +sim and ignores all commands from non-staff
echo -a Defcon 4 - Sets channel mode +sim and ignores all commands from staff (except bot owner)
echo -a Defcon 5 - Sets channel mode +sim and ignores all commands from staff
}
Else {
echo -a Unknown defcon command. For more help with this, please type /sbot defcon
}
}
Elseif ($1 == rechan) {
var %temp.1 1
While (%temp.1 <= $lines(sbot/channels.txt)) {
join $read(sbot/channels.txt, %temp.1)
inc %temp.1
}
If ($sbsettings(defcon) == on) { defcon on }
}
}
alias defcon {
If ($sbstatus(installed) != yes) { return }
If ($1 == on) {
If ($sbstatus(defcon) == $chr(49)) {
var %temp.1 1
While (%temp.1 <= $lines(sbot/channels.txt)) {
mode $read(sbot/channels.txt, %temp.1) +m
inc %temp.1
}
}
If ($sbstatus(defcon) == 2) {
var %temp.1 1
While (%temp.1 <= $lines(sbot/channels.txt)) {
mode $read(sbot/channels.txt, %temp.1) +im
inc %temp.1
}
}
If ($sbstatus(defcon) >= 3) {
var %temp.1 1
While (%temp.1 <= $lines(sbot/channels.txt)) {
mode $read(sbot/channels.txt, %temp.1) +sim
inc %temp.1
}
}
}
If ($1 == off) {
var %temp.1 1
While (%temp.1 <= $lines(sbot/channels.txt)) {
mode $read(sbot/channels.txt, %temp.1) -sim
inc %temp.1
}
}
If ($1 == $chr(49)) {
If ($sbset(defcon) != on) { return }
var %temp.1 1
While (%temp.1 <= $lines(sbot/channels.txt)) {
mode $read(sbot/channels.txt, %temp.1) -si+m
inc %temp.1
}
}
If ($1 == 2) {
If ($sbset(defcon) != on) { return }
var %temp.1
While (%temp.1 <= $lines(sbot/channels.txt)) {
mode $read(sbot/channels.txt, %temp.1) -s+im
inc %temp.1
}
}
If ($1 >= 3) {
If ($sbset(defcon) != on) { return }
var %temp.1
While (%temp.1 <= $lines(sbot/channels.txt)) {
mode $read(sbot/channels.txt, %temp.1) +sim
inc %temp.1
}
}
}
dialog sbot {
title Staff Bot $sbperm(version)
option dbu
size -1 -1 300 100
;group1 - Top Menu
button "Settings", 101, 1 1 40 20
button "Channels", 102, 1 21 40 20
;group 2 - 2nd menu
button "Defcon", 201, 41 1 40 20, hide
button "Add a channel", 202, 41 1 60 20, hide
button "Remove a channel", 203, 41 21 60 20, hide disable
;group 3 - 3rd menu or 2nd menu items
list 301, 102 1 100 100, hide
button "Turn Defcon On", 302, 82 1 60 20, hide
button "Turn Defcon Off", 303, 82 21 60 20, hide
button "Set Defcon", 304, 82 42 60 20, hide
;group 4 - 4th menu or 3rd menu items
text "Current Defcon", 401, 143 1 60 20, hide
}
on *:DIALOG:sbot:*:*: {
If ($devent == init) {
var %temp.1 1
While (%temp.1 <= $lines(sbot/channels.txt)) {
did -a $dname 301 $read(sbot/channels.txt, %temp.1)
inc %temp.1
}
did -ra $dname 401 Current Defcon: $sbstatus(defcon)
}
If ($devent == sclick) {
If ($did == 101) {
did -h $dname 202-203,301-304,401
did -v $dname 201
}
If ($did == 102) {
did -h $dname 201,302-304,401
did -v $dname 202-203,301
}
If ($did == 201) {
did -v $dname 302-304,401
If ($sbset(defcon) == on) {
did -b $dname 302
}
Else {
did -b $dname 303
}
}
If ($did == 202) {
var %temp.1 $?="Please enter a channel name and include the number symbol. (ex #staffbot)"
write sbot/channels.txt %temp.1
sbot rechan
dialog -x $dname
sbot
}
If ($did == 203) {
If (!$did(301).seltext) { did -b $dname 203 | halt }
write -ds $+ $did(301).seltext sbot/channels.txt
dialog -x $dname
sbot
}
If ($did == 301) {
did -e $dname 203
}
If ($did == 302) {
sbot defcon on
did -b $dname 302
did -e $dname 303
}
If ($did == 303) {
sbot defcon off
did -b $dname 303
did -e $dname 302
}
If ($did == 304) {
var %temp.1 $?="Please enter the level of the Defcon you want Staff Bot to be set to."
sbot defcon %temp.1
did -ra $dname 401 Current Defcon: $sbstatus(defcon)
dialog -v sbot
}
}
}