Botmail
Platform: mIRC
Published Jan 06, 2007
Updated Jul 25, 2010
Basic botmail uses commands like !send, !read, !del and !list
Some commands accept one or more parameters (ie: You can read multiple messages by specifying the message numbers)
Contact information is located at the beginning of the script
Script now tracks when a message is left.
Script works, but there is an occasional timing problem when reading the messages, where the message actually gets displayed before the information regarding who it's from and when it was left, rather than the other way around.
Additionally, if messages are deleted in an order other than last to first, there will be blank messages displayed, even though the count is correct. I'm not sure how to get around this at the moment, but I will keep working on it.
As always, suggestions and comments are more than welcome.
Changes made on July 11 2010: Network specific access. Use !add network to add the current network and !del network to delete the current network from the list.
Custom window log added July 25 2010.
;Contact information
;Author: RusselB
;Website reference: http://www.hawkee.com/snippet/2248/
;E-mail: r.k.bairstow@gmail.com
;NOTE: Please allow at least 3 days for a response on the website before using the e-mail, and even then only if it's due to an error in the script rather than a modification request.
.ctcp *:version:*: ctcpreply $nick VERSION return Botmail script by RusselB. July 25 2010
on *:start:{
if !$hget(Botmail) { .hmake Botmail 100 }
if $exists(Botmail.hsh) { .hload Botmail Botmail.hsh }
}
on *:exit:{
.hsave -o Botmail Botmail.hsh
}
on *:disconnect:{
.hsave -o Botmail Botmail.hsh
}
on *:notify:{
if $istok(%botmail.networks,$network,32) {
if $hget(Botmail,$nick) {
.msg $nick I have $bytes($hget(Botmail,$nick),b) messages for you
.msg $nick All commands are to be used via pm/query.
.msg $nick Available commands are: !list, !read <message number(s)>, !del <message number(s)>, and !delall
}
}
}
on *:text:*:?:{
tokenize 32 $strip($replace($1-,$chr(44),$chr(32)))
if !$window(@Botmail) { .window @Botmail }
.echo @Botmail $nick ( $+ $address $+ ) used the command $1- on $date at $time
if ($1- == !add network) {
set %botmail.networks $addtok(%botmail.networks,$network,32)
.msg $nick $network has been added to the list of networks.
.msg $nick Active networks: %botmail.networks
}
if $istok(%botmail.networks,$network,32) {
if ($1- == !del network) {
set %botmail.networks $remtok(%botmail.networks,$network,1,32)
.msg $nick $network has been removed from the list of networks.
.msg $nick Active networks: %botmail.networks
}
elseif ($1 == !help) {
.msg $nick All commands are to be used via pm/query.
.msg $nick Available commands are: !list, !read <message number(s)>, !del <message number(s)>, and !delall
}
elseif ($1 == !send) {
if !$2 || !$3 { .notice $nick Usage: !send <nick> <message> }
else {
.hinc -m Botmail $2
.hadd -m Botmail $+($2,.,$hget(Botmail,$2)) $address($nick,5) $ctime $3-
}
.notify $2
}
elseif $1 == !list { .msg $nick You have $hget(Botmail,$nick)) message $+ $iif($hget(Botmail,$nick) != 1,s) }
elseif $1 == !delall {
.hdel -w Botmail $+($nick,*)
if $notify($nick) { .notify -r $nick }
.msg $nick All of your messages have now been deleted
}
else {
if !$hget(Botmail,$nick) { .msg $nick You have no messages }
elseif !$2 { .msg $nick No message number(s) specified }
else {
var %msgs = $remove($replace($2-,$chr(44),$chr(32)),$chr(35)), %a = 1, %b = $numtok(%msgs,32)
while %a <= %b {
if $gettok(%msgs,%a,32) !isnum {
.msg $nick Only message numbers are allowed
.msg $nick Message $v1 will be ignored
}
else {
if $1 == !read {
var %msg.num = $gettok(%msgs,%a,32), %msg = $hget(Botmail,$+($nick,.,%msg.num)), %msg.nick = $gettok(%msg,1,32), $&
%msg.time = $gettok(%msg,2,32), %msg = $gettok(%msg,3-,32)
.timer 1 %a .msg $nick Message $chr(35) $+ %msg.num From: %msg.nick Sent At: $asctime(%msg.time)
.timer -m 1 $calc(%a * 1500) .msg $nick %msg
}
elseif $1 == !del {
.hdel Botmail $+($nick,.,$gettok(%msgs,%a,32))
.hdec Botmail $nick
.msg $nick Message $gettok(%msgs,%a,32) has been deleted.
if $hget(Botmail,$nick) == 0 {
.hdel -w Botmail $+($nick,*)
}
}
}
inc %a
}
}
}
}
}
on *:close:@Botmail:{
.savebuf -a @Botmail $qt($scriptdirBotmail.log)
}