Put this snippet into the remotes section. A simple use of aliases, or a dialog to auto(op,hop, or voice), auto-greet, and auto(kban, or ignore).
Directions:
1- Type: /addnick (voice,hop,op,greet,kick,kickban,ignore) (nick) (voice,hop,op,kickban,ignore,kick) or (greetmsg,kickmsg,kickbanmsg here) if you are adding a message.
2- You could also use the menu: menubar -> auto-functions table -> add/open
Updates:
Dialoged
Function to kickban and ignore
Menubar selection
alias addnick {
if ($1 = greet) {
if ($read(nicks.txt,$2)) {
write -dl $gettok($read(nicks.txt,$2),1-,32)
writeini -n auto.ini auto-greet $2 $3-
}
else {
writeini -n auto.ini auto-greet $2 $3-
write nicks.txt $2
}
}
if ($1 = voice) {
if ($read(nicks.txt,$2)) {
write -dl $gettok($read(nicks.txt,$2),1-,32)
writeini -n auto.ini auto-give $2 voice
}
else {
writeini -n auto.ini auto-give $2 voice
write nicks.txt $2
}
}
if ($1 = op) {
if ($read(nicks.txt,$2)) {
write -dl $gettok($read(nicks.txt,$2),1-,32)
writeini -n auto.ini auto-give $2 op
}
else {
writeini -n auto.ini auto-give $2 op
write nicks.txt $2
}
}
if ($1 = hop) {
if ($read(nicks.txt,$2)) {
write -dl $gettok($read(nicks.txt,$2),1-,32)
writeini -n auto.ini auto-give $2 hop
}
else {
writeini -n auto.ini auto-give $2 hop
write nicks.txt $2
}
}
if ($1 = ban) {
if ($read(nicks.txt,$2) {
write -dl $gettok($read(nicks.txt,$2),1-,32)
writeini -n auto.ini auto-act $2 kickban $chr(32) $4-
}
else {
writeini -n auto.ini auto-act $2 kickban $chr(32) $4-
write nicks.txt $2
}
}
if ($1 = ignore) {
if ($read(nicks.txt,$2) {
write -dl $gettok($read(nicks.txt,$2),1-,32)
writeini -n auto.ini auto-act $2 ignore
}
else {
writeini -n auto.ini auto-act $2 ignore
write nicks.txt $2
}
halt
}
}
on *:join:#:{
if ($readini(auto.ini,auto-greet,$nick)) {
msg $chan $gettok($readini(auto.ini, auto-greet, $nick),1-,32)
}
if ($me isop $chan) {
if ($gettok($readini(auto.ini, auto-give, $nick),1,32) = voice) {
mode # +v $nick
}
if ($gettok($readini(auto.ini, auto-give, $nick),1,32) = op) {
mode # +o $nick
}
if ($gettok($readini(auto.ini, auto-give, $nick),1,32) = hop) {
mode # +h $nick
}
if ($gettok($readini(auto.ini, auto-act, $nick),1,32) = kickban) {
ban -k # $$1 $gettok($readini(auto.ini, auto-act, $nick),2-,32)
}
if ($gettok($readini(auto.ini, auto-act, $nick),1,32) = ignore) {
if ($ignore($address(nick,2)) {
return
}
ignore $$1
}
}
}
alias viewnickfile {
//run auto.ini
}
alias viewnick {
dialog -m nicksview nicksview
}
dialog nicksview {
title "auto-add functions nicks view"
size -1 -1 128 74
option dbu
list 1, 0 1 128 55, size
button "+", 2, 0 57 31 8
button "-", 3, 0 65 31 8
button "delete all", 4, 35 60 37 10
button "view nickfile", 5, 72 60 37 10
}
on *:dialog:nicksview:*:*:{
if ($devent = init) {
loadbuf -ro nicksview 1 nicks.txt
}
if ($devent = sclick) {
if ($did = 2) {
addnick $?="Enter type of auto-function. (greet,op,hop,voice)" $?="Enter specified nick." $?="Tags are: op,hop,voice or (greet msg) if adding to a greet."
}
if ($did = 3) {
var %1 = $did(nicksview,1).sel
write -dl nicks.txt %1
if ($readini(auto.ini,auto-greet, %1)) {
remini auto.ini auto-greet %1
}
if ($readini(auto.ini,auto-give,%1)) {
remini auto.ini auto-give %1
}
if ($readini(auto.ini,auto-act,%1)) {
remini auto.ini auto-act %1
}
did -r nicksview %1
}
if ($did = 4) {
did -r nicksview 1
remove -b auto.ini
remove -b nicks.txt
}
if ($did = 5) {
viewnickfile
}
}
}
menu menubar {
auto-functions table:
.add:addnick $?="Enter type of auto-function. (greet,op,hop,voice)" $?="Enter specified nick." $?="Tags are: op,hop,voice or (greet msg) if adding to a greet."
.open dialog:viewnick
}
This snippet seems to be divided in three different sections. If you wanted to give a user a voice and a greet, you could. There is an auto-act section and an auto-greet section. So you could technically do what you are asking. This snippet isn\'t all to great. You might as well use hash tables for all the data. And why create a separate text file just for the use of dialog? I think $ini would work for that, I\'m not too sure, but it should. /help $ini. There are a few error checking bits you are missing. In your add nick alias, you forget to include an if ($1 && $2) to check if the user actually typed the strings. If I forgot to add the second, it would add it to the text & ini file. You also forget to check if the dialog name is in use when you type the command to open the dialog. Try adding an if ($dialog(nicksview)). And how about adding an edit option? It seems a bit of work to delete and then type the parameters. Nice concept, but not really good coding.
--Roy
Fixed. It now checks if you are an op in the channel, and the $readini checks if the nick isin the ini file. So if there is no nick, it will not trigger anything. And yes, I am aware that there is an auto-op and auto-voice function. I added an options to add a hop but I felt that I should include the others in the snippet to make it have a more complete feel.