i am making a bot for a helpdesk. i'm having problems with the code i am trying to use. i want it to
- give a user an estimated waiting time when they join
- write to a text file an order of all the users in the helpdesk
- have a popup to voice the next person in the order
the code below is what i have and isnt working properly
alias helpbot { sockopen helpbot mxt-networkz.ircxpro.com 6667 }
on *:sockopen:helpbot:{
sockwrite -n helpbot IRCX
sockwrite -n helpbot NICK HelpMeBot
sockwrite -n helpbot USER HelpMe_Bot HelpMe_Bot HelpMe_Bot:HelpDesk HelpMe_Bot
}
on *:sockread:helpbot:{
sockread %helpbot
tokenize 32 %helpbot
set %nickname $remove($mid($1,2,$calc($pos($1,!,1) -1)),!)
if ($1 == PING) { sockwrite -n helpbot PONG }
if ($2 == 001) {
sockwrite -n helpbot OPER **** ****
sockwrite -n helpbot NICK 'HelpMe_Bot
sockwrite -n helpbot JOIN #HelpDesk
}
if ($2 == PRIVMSG) && ($3 == 'HelpMe_Bot) && ($remove($4,:) == !Help) {
sockwrite -n helpbot PRIVMSG %nickname :We have provided a list of help commands. Type the command for more information.
sockwrite -n helpbot PRIVMSG %nickname :!Apply_Sysop
sockwrite -n helpbot PRIVMSG %nickname :!Website
sockwrite -n helpbot PRIVMSG %nickname :!Que
sockwrite -n helpbot PRIVMSG %nickname :!Sysops
sockwrite -n helpbot PRIVMSG %nickname :Thank you for using me. If your question is not above, please wait for an operator to assist you.
}
if ($2 == PRIVMSG) && ($3 == 'HelpMe_Bot) && ($remove($4,:) == !Apply_Sysop) {
sockwrite -n helpbot PRIVMSG %nickname :Sysop Information Unavaliable.
}
if ($2 == PRIVMSG) && ($3 == 'HelpMe_Bot) && ($remove($4,:) == !Website) {
sockwrite -n helpbot PRIVMSG %nickname :Visit us at http://mxt-networkz.com.
}
if ($2 == PRIVMSG) && ($3 == 'HelpMe_Bot) && ($remove($4,:) == !Que) {
sockwrite -n helpbot PRIVMSG %nickname :Your estimated waiting time is $nick(#HelpDesk,0,+v) minutes.
}
if ($2 == PRIVMSG) && ($3 == 'HelpMe_Bot) && ($remove($4,:) == !Admins) {
}
if ($2 == JOIN) {
if (' isin %nickname) { halt }
sockwrite -n helpbot NOTICE %nickname :Hello and welcome to the HelpDesk. For a small list of faq's, whisper !Help to me.
sockwrite -n helpbot NOTICE %nickname :Your estimated waiting time is $calc(%nickname(#HelpDesk,0,-v) +1) minutes.
echo -a 4A new user has joined #HelpDesk. There nickname is %nickname $+ .
}
if (%nickname !isvo #HelpDesk) && (%nickname !isin $read(helpdesk.txt)) {
write -a helpdesk.txt %nickname
}
if (%nickname == 'HelpMe_Bot) {
var %a = 1
while (%nickname(#HelpDesk,0,r) >= %a) {
write -a helpdesk.txt %nickname(#HelpDesk,%a,r)
inc %a
}
}
}
on *:nick:{
if (%nickname isin $read(helpdesk.txt)) {
write -s $+ %nickname helpdesk.txt $newnick
}
}
on *:part:#HelpDesk:{
if (%nickname isin $read(helpdesk.txt)) { write -ds $+ %nickname helpdesk.txt }
}
on *:kick:#HelpDesk:{
if ($knick isin $read(helpdesk.txt)) { write -ds $+ %nickname helpdesk.txt }
}
on *:voice:#HelpDesk:{
if (%nickname isin $read(helpdesk.txt)) { write -ds $+ %nickname helpdesk.txt }
}
alias hdvoice {
:hop
if ($read(helpdesk.txt,1) !ison #HelpDesk) { write -d1 helpdesk.txt | goto hop }
sockwrite -n helpbot MODE #HelpDesk +v $read(helpdesk.txt,1)
write -d1 helpdesk.txt
}
alias hdwho {
window -ak0 @HDwho
.enable #hdwho
var %a = 1
while (%a <= 10) { echo @HDwho %a $+ : | who $read(helpdesk.txt,%a) | inc %a }
.disable #hdwho
}
#hdwho off
raw 302:*:{ echo @HDwho $1- }
raw 315:*:{ echo @HDwho $1- | echo @HDwho - }
#hdwho end
menu nicklist {
Helpdesk options
.Voice the next person:/hdvoice | msg #Hello $$1 $+ , welcome to the MXT Networkz HelpDesk. Please ask your question.
.List First 10:/hdwho
.Devoice:sockwrite -n helpbot MODE #HelpDesk -v $$1 | msg # Thank you $$1 for using the HelpDesk. Please feel free to return if you have any further questions.
}
can anyone fix it. thanks