Simple InfoBot v2.0.1

By sk68
Platform:  mIRC
Published  Sep 18, 2009
Updated  Nov 12, 2010
Its not winning any awards but it will (at a very basic level) store factoids sort of like an infobot, key word in the title being 'simple' ;)

to allow a user to use the del,lock, and unlock commands type /auser -a admin <nick/mask> in the bot's mIRC

Commands:
All users -
<botnick> <name> is <reply>

<&CodeNinja> sk68Bot, google is http://www.google.com
<&sk68Bot> Ok, CodeNinja

<botnick> what is <name>?

<&CodeNinja> sk68Bot, what is google?
<&sk68Bot> google is http://www.google.com

Admins -
<botname> lock <name>
<&CodeNinja> sk68Bot, lock google
<&sk68Bot> 'google' has been locked

<botname> unlock <name>
<&CodeNinja> sk68Bot, unlock google
<&sk68Bot> 'google' has been unlocked

<botname> del <name>
<&CodeNinja> sk68Bot, del google
<&sk68Bot> google deleted


UPDATES

    v2.0
    Total rewrite from scratch
  • Fixed bugs with admin commands not working
  • Changed commands to regex
  • Various housekeeping
    v2.0.1
  • A little housekeeping

on *:START:{ hmake infobot 100
if ($isfile(infobot.hsh)) { hload infobot infobot.hsh }
}
on *:EXIT:{ hsave infobot infobot.hsh
}
on *:TEXT:*:#:{ if ($regex($1-,$+(/^,$me,([:,])?) what is (.+)\?$/Si)) { var %info $left($4-,-1)
if ($info(%info).exists) { msg # $iif(%info == $nick,You are,%info is) $info(%info)
}
else { msg # %info doesn't exist!
}
}
elseif ($regex(infoadd,$1-,$+(/^,$me) $+ ([:,])? (.+) is (.+)/Si)) {
if ($info($regml(2)).exists) { msg # $regml(2) already exists! }
else { info add $regml(infoadd,2) $regml(infoadd,3)
msg # Ok, $nick
}
}
elseif ($regex($1-,$+(/^,$me) $+ ([:,])? (del(ete)?|forget|remove)/Si) && $isadmin($nick)) {
if (!$info($3-).exists) { msg # $3- doesn't exist! }
elseif ($info($3-).locked) { msg # $3- is locked! }
else {
info del $3-
msg # $3- was deleted
}
}
elseif ($regex($1-,$+(/^,$me) $+ ([:,])? lock/Si) && $isadmin($nick)) { if (!$info($3-).exists) { msg # $3- doesn't exist! }
elseif ($gettok($info($3-),-1,32) === LOCK) { msg # $3- is already locked! }
else { info lock $3-
msg # $3- has been locked
}
}
elseif ($regex($1-,$+(/^,$me) $+ ([:,])? unlock/Si) && $isadmin($nick)) { if (!$info($3-).exists)) { msg # $3- doesn't exist! }
elseif ($gettok($info($3-),-1,32) !=== LOCK) { msg # $3- isn't locked! }
}
}
alias -l info { if ($isid) { noop $regsub($1,/\s/g,[sp],%arg)
if ($prop == exists) {
return $iif($hget(infobot,%arg) != $null,1,0)
}
elseif ($prop == locked) { return $iif($hget(infobot,$+(%info,.lock)),1,0) }
elseif (!$prop) { return $hget(infobot,%info) }
}
else { if ($infobotdebug) { echo -s string $1 ; $2 ; $3 ; $4- }
noop $regsub($2,/\s/g,[sp],%info)
if ($1 == add) { hadd $iif($infobotdebug,-sm,-m) infobot %info $3- }
elseif ($1 == del) { hdel $iif($infobotdebug,-s) infobot %info }
elseif ($1 == edit) { hadd $iif($infobotdebug,-sm,-m) infobot %info $3- }
elseif ($1 == lock) { hadd $iif($infobotdebug,-sm,-m) infobot $+(%info,.lock) 1 }
elseif ($1 == unlock) { hdel $iif($infobotdebug,-s) infobot $+(%,info,.lock),2) }
}
}
alias -l isadmin { echo -s $level($address($1,5))
return $iif($level($address($1,5)) == admin,1,0)
}
alias -l infobotdebug return 0

Comments

Sign in to comment.
sk68   -  Nov 12, 2010
Updated
 Respond  
SkyBytes   -  Oct 09, 2010
Yay :D
 Respond  
sk68   -  Oct 09, 2010
UPDATE! This is my first time using regex at this level, so pointers would be appriciated
 Respond  
sk68   -  Oct 05, 2010
OKI! This bad boy is gonna get a complete overhaul, everything is being redesigned and rewritten, hopefully that will fix all the bugs people have been having, stick around for updates :D
 Respond  
sk68   -  Feb 21, 2010
do any errors come up in the status window? or does it not react at all?
 Respond  
`Dean   -  Feb 12, 2010
Nice script, but when I type this: [01:46] <@`Dean_> [eH], del www.google.com

nothing happens. =p
 Respond  
sk68   -  Feb 11, 2010
technically your mIRC found the bug >_>
 Respond  
Shiny   -  Feb 11, 2010
I found the Bug :)
 Respond  
sk68   -  Feb 11, 2010
minor bug fix
 Respond  
DarkCoder   -  Dec 21, 2009
hairy monkey nuts :) its good.
 Respond  
Vesperia   -  Oct 04, 2009
Nice. I liked it a lot.
 Respond  
sk68   -  Sep 20, 2009
didnt think about that :S

done :D
 Respond  
Xpl0reR   -  Sep 20, 2009
maybe you could put the commands in the subject, or add a command to the bot that will put the commands in the channel or via /notice.
 Respond  
sk68   -  Sep 19, 2009
is there a rule Im not aware of that says no one is allowed to comment on my scripts? at least tell me it sucks O_O
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.