Join message (on/off function)

By Bielie on Apr 28, 2010

I tried to make a on/off function for the on *:Join:#: { event.

If i did something wrong please post.

I havent tried it yet since i have limited rights on my job.

on *:join:#: {
if ( $+(%,joinmsg,$nick) == $false ) { return }

if ($(,$+(%,flood,$nick))) { return }
    set -eu3 $+(%,flood,$nick)

elseif { 
notice $nick Hey $nick! Welcome in # . Enjoy your stay! | .timer 1 2 notice $nick Dont want this message when you join a channel? Type: !joinmsg off | return 
 }
}

on $*:text:/^[.!@]joinmsg*\b/iS:#: {
if ( $2 == off ) {
  set $+(%,joinmsg,$nick) $false | notice $nick Your join message has been turned off. | .timer 1 2 Want to turn it back on? Type !joinmsg on | return }

elseif ( $2 == on ) {
if  ( $+(%,joinmsg,$nick) != $false ) { notice $nick Your join message is already on! | Return }

else {
 unset $+(%,joinmsg,$nick) $false 
 notice $nick Your join message is now turned on.
 halt
 }
}

Comments

Sign in to comment.
Jethro   -  Apr 30, 2010

@Bielie:

on *:exit:savehsh
on *:start:loadhsh
on me:*:quit:savehsh
on *:connect:loadhsh
on *:disconnect:savehsh
alias -l savehsh { hsave join $qt($scriptdirjoin.hsh) }
alias -l loadhsh {
  if (!$hget(join)) { hmake join 100 }
  if ($isfile($qt($scriptdirjoin.hsh))) { .hload join $qt($scriptdirjoin.hsh) }
}
on !*:join:#: {
  if !$hfind(flood,$nick) && !$hfind(join,$wildsite) {
    hinc -mu9 flood $nick | notice $nick Hey $nick! Welcome in # . Enjoy your stay!
    .timer 1 2 notice $nick Dont want this message when you join a channel? Type: !joinmsg off
  }
}
on $*:text:/^!joinmsg (\w+)/iS:#: {
  if $regml(1) == off {
    goto $iif(!$hfind(join,$wildsite),on,alreadyon)
    :on | hadd -m join $wildsite | notice $nick Your join message has been turned off!
    .timer 1 2 notice $nick Want to turn it back on? Type !joinmsg on | halt
  }
  if $regml(1) == on { 
    goto $iif($hfind(join,$wildsite),off,alreadyoff)
    :off | hdel join $wildsite | notice $nick Your join message has been turned on. | halt
  }
  :alreadyon | notice $nick your join message is already turned off! | halt
  :alreadyoff | notice $nick your join message is already turned on! | halt
}
 Respond  
Bielie   -  Apr 29, 2010

it returns that its on always so it doesnt work:

Nick:/join #
BOT: Welcome in #
BOT: Your joinmsg is currently on
BOT: Dont want this message? !type !joinmsg off

The second line of the bot should be gone.

Post a fix please

 Respond  
ssimar   -  Apr 28, 2010

Good

 Respond  
gooshie   -  Apr 28, 2010

[size=17]Please stop using all the halts and returns.[/size]

on *:join:#: {
if ($($+(%,joinmsg,$nick),2) != $false) && (!$($+(%,flood,$nick),2)) {
    set -eu9 $+(%,flood,$nick)
    notice $nick Hey $nick! Welcome in # . Enjoy your stay!
    .timer 1 2 notice $nick Dont want this message when you join a channel? Type: !joinmsg off
}

on $*:text:/^!joinmsg on|off$/iS:#: {
if $2 == off {
  set $+(%,joinmsg,$nick) $false
  notice $nick Your join message has been turned off.
  .timer 1 2 Want to turn it back on? Type !joinmsg on
}
else {
  if $($+(%,joinmsg,$nick),2) != $false { notice $nick Your join message is already on! }
  else {
    unset $+(%,joinmsg,$nick)
    notice $nick Your join message is now turned on.
  }
}
_____________________________________________________________________________________________________
 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.