Birthday Greeting Script.

By Ablekie on Aug 26, 2014

A very useful birthday script that I found some where else. Author unknown. If it is one of you, thanks is excellent script lacking only one routine. Hope some one can help with:
I have tried on my own but no can do. All I really need is a routine like where I can delete the nick information in the ini file.

Where I input: !delete jenny

example of items in bday.ini
[User]
Nikita=2-13
jenny=3-17
clueless=1-5

$2 should be jenny to be deleted and $nick should be person that deleted the entry: I have tried various code options below but not working)

alias bday.usage { 
if ($prop == add) { return !addbday name month day }
if ($prop == bday) { return !bday name }
return Type !addbday <name> <month> <day> (Ex. !addbday Jesus December 25) to set your birthday. Type !bday <name> to see how long it is until the birthday. 
}

on *:start:{
.timerbday 0 9000 announcebdays #chan
}

on *:join:#chan: {
if ($isbday($nick) == 1) msg # Happy birthday $+($nick,!)
;elseif ($v1 == -1) notice $nick $bday.usage
}

on *:text:!bday *:#chan:{
var %nick = $iif($2,$2,$nick)
if ($isbday(%nick) == 1) {
msg # Today is $+(%nick,'s) birthday!
}
elseif ($v1 == 0) {
var %bday = $readini(bday.ini,nicks,%nick)
var %month = $gettok(%bday,1,45)
var %day = $gettok(%bday,2,45)
msg # $duration($todate(%month,%day)) until $+(%nick,'s) birthday
}
else {
msg # %nick not found. Usage: $bday.usage().bday
}
}

on *:text:!addbday *:#chan:{
if ($addbday($2,$3,$4)) {
msg # Birthday for $2 added.
}
else {
msg # $bday.usage().add
}
}

alias addbday {
var %nick = $1
var %month = $2
var %day = $3

if ($0 < 3) || (%day !isnum) return $false

if (%month isalpha) {
var %months = jan feb apr mar may jun jul aug sep oct nov dec
%month = $findtok(%months,$left(%month,3),32)
}
else {
%month = $regsubex(%month,^0+,)
}

var %date = $+(%month,-,%day)

writeini bday.ini nicks %nick %date
writeini bday.ini %date %nick 1
return $true
}

alias announcebdays {
var %chan = $$1
var %date = $+($asctime(m),-,$asctime(d))
var %nick, %nicklist
var %i = 1
var %n = $ini(bday.ini,%date,0)
while (%i <= %n) {
%nick = $ini(bday.ini,%date,%i)
if (%nick ison %chan) %nicklist = %nicklist %nick
inc %i
}
dec %i
if (%i == 2) {
%nicklist = $replace(%nicklist,$chr(32),$+($chr(32),$chr(38),$chr(32)))
}
elseif (%i > 2) {
%nicklist = $replace(%nicklist,$chr(32),$+($chr(44),$chr(32)))
%nicklist = $regsubex(%nicklist,(\S+?$),and \1)
}

if (%nicklist) msg %chan Happy Birthday to $+(%nicklist,!)
}

alias isbday {
var %nick = $1
var %date = $readini(bday.ini,nicks,%nick)
var %month = $gettok(%date,1,45)
var %day = $gettok(%date,2,45)

if (!%date) return -1
if (%month == $asctime(m)) && (%day == $asctime(d)) return 1
return 0
}

alias todate {
var %month = $1
var %day = $$2
var %year = $asctime(yyyy)

var %todate = $calc($ctime($+(%day,-,%month,-,%year) 00:00:00) - $ctime)
if (%todate < 0) {
inc %year
%todate = $calc($ctime($+(%day,-,%month,-,%year) 00:00:00) - $ctime)
}
return %todate
}

like:

on 1:text:!delete *:#:{
var %nick = $2
if ($2 == $readini bday.ini $2 ) continue
else { /msg $chan Sorry no birthday was added for $2. | halt }
if ($nick isop $chan) { /remini bday.ini User $2 | /msg $chan $2 's birthday was deleted by $nick in $chan | halt }
else { /msg $nick Sorry only OPS can delete birthdays. | halt }
}

Comments

Sign in to comment.
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.