I am using this script in my bot to add users birthdays and to congratulate them on join. It also calculates weeks and days till next birthday. The topic change is not working properly but the rest is pretty good. I would love if be able to display all birthdays for the current date and for specified month if someone can help with that, I have tried to no avail.
Maybe not the neatest code but I am trying. You can use it and if you improve it if you would give me an new copy
;Commands
; !bday nick
; !add nick month day
; !Remove nick
on *:text:\Birthday:#:{
.notice $nick 12...10::7|4 Birthday Corner 7|10::12...
.notice $nick 1Add------------: 4!add nick 1(like John 3 7 )
.notice $nick 1Birthday-------: 4!bday nick 1( nick's birthday)
.notice $nick 1Remove---------: 4!remove nick 1(Ops only)
}
if ($isbday($nick) == 1) /topic #channel 4(¯`·._(¯`·._(¯`·._( 5Channel wishes $+($nick) a happy birthday !!!!!4_.·´¯)_.·´¯)_.·´¯)
alias bday.usage {
if ($prop == add) { return !add nick month day }
if ($prop == bday) { return !bday nick }
return 12Tik4 !add nick month day 5(like !add John 12 25 for 25th December) to add. 12Type4 !bday John 5om to see when his birthday will be.
}
on *:start:{
.timerbday 0 9000 announcebdays #channel
}
on *:join:#: {
if ($isbday($nick) == 1) /topic # 4,0%0,4%4,4 5,4%4,5%5,5 1,5%5,1%1,1 0 channel whishes $+($nick) a happy birthday !!!! 5,1%1,5%5,5 4,5%5,4%4,4 0,4%4,0%
if ($isbday($nick) == 1) msg # 12Happy birthday $+($nick,!)12sings 13 •* happy birthday to you, you look like a monkey and you act like one toooo *• 5 out of tune
}
;-============================
on 1:text:!remove *:#:{
if ($nick isop $chan) {
if (!$readini(bday.ini,nicks,$2)) {
msg $chan 2Sorry no birthday recorded for $2
}
else {
remini bday.ini nicks $2
msg $chan $2 $+ 's 5Birthday for $nick was cancelled in $chan
}
}
else {
msg $nick 12Sorry only OPS van delete a birthday.
}
}
on *:text:!bday *:#:{
var %nick = $iif($2,$2,$nick)
if ($isbday(%nick) == 1) {
msg # 13Today is $+(%nick 's) birthday! 5Jayyy!!!
return
}
elseif ($v1 == 0) {
var %bday = $readini(bday.ini,nicks,%nick)
var %month = $gettok(%bday,1,45)
var %day = $gettok(%bday,2,45)
msg # 5 $+(%nick) 's birthday %day $asctime($calc($ctime + $todate(%month,%day)),mmmm) : 4Must wait $duration($todate(%month,%day))) from this minute!!!
return
}
if (%nick == me) msg # Wake up!!!
else {
msg # 4pffffft?2 %nick 1 is to ashamed to get birthday anounced!
}
}
on *:text:!add *:#:{
var %bdayerror 0
if ($3 < 1) var %bdayerror Month to low: ! (only 1-12 allowed)
if ($3 > 12) var %bdayerror Month to high: ! (only 1-12 allowed)
if ($4 < 1) var %bdayerror Day to low: ! (only 1-31 allowed)
if ($4 > 31) var %bdayerror Day to high: ! (only 1-31 allowed)
if (%bdayerror != 0) {
.msg # [bday] Problem: %bdayerror
halt
}
if ($addbday($2,$3,$4)) {
msg # 12 $2 's birthday recorded 4as month $3 day $4 .
}
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 mar apr 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 6 Happy birthday $+(%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
}