ircjokes.tcl

ircjokes.tcl

TCL script with jokes on irc - this script will add/delete from the database and send to the channel. Commands: !ircaddic, !addijoke (joke), !delijoke (joke)

Postat de Copyright Categorie Review user Vizualizari Data
btc MASE_ games Cod netestat 372 2023-12-25 09:35:41

# Stupid IRC Jokes v1.0
# you might be an irc addic if..... by MASE_ (mase_caps@hotmail.com
#
# HISTORY 101 ##
# i was fucking around on the www one day and came across a site that
# had a bunch of answers to that mysterious question..  so i though i would
# make a dumb script to share my new found knoladge.
# this script will add/delete from the database and send to the channel
#
# Commands, can be done via MSG or in the channel
# !ircaddic        - sends a joke to the channel or private msg to the user
# !addijoke (joke) - adds a joke to the database
# !delijoke (joke) - deletes a joke from the database
#
# INSTALLATION
# put the script in your eggdrop.conf file ie: source scripts/ircjokes-1.0.tcl
# and put irc.addic in your bot directory
# if you feel the need to add more manually follow the pattern or the exiting enteries 

set ver "1.0"

# allow commands via channel? (!ircaddic, !addijoke, !delijoke)
# i put this in for ppl who dont want their channels flooded with the answers
set ircaddicpub 1

# allow !chan commands via msg? (!ircaddic, !addijoke, !delijoke)
# if you wanna keep it in the chan
set jokemsg 1


proc pub_joke {nick host hand chan arg} {
 if {[file exists irc.addic]} {
  if {$arg != ""} { set arg [expr [lindex $arg 0] - 1] }
  set ircjokes [exec cat irc.addic]
  if {$arg != ""} {
   set joke [lindex $ircjokes $arg]
  } {
   set joke [lindex $ircjokes [rand [llength $ircjokes]]]
  }
  putlog "!${nick}@${chan}! joke"
  if {$joke != ""} { putserv "PRIVMSG $chan :\002$joke\002" }
 } {
  putlog "!${nick}@${chan}! ircjokes (no ircjokes)"
 }
 return 0
}

proc pub_addijoke {nick host hand chan arg}  {
 if {$arg != ""} {
  putlog "!${nick}@${chan}! addijoke"
  set addijoke [exec echo "\"You might be an ircaddic IF.....${arg}\"" >>irc.addic]
  putserv "PRIVMSG $nick :\002Added joke.\002"
 }
 return 0
}

proc pub_delijoke {nick host hand chan arg} {
 if {$arg != ""} {
  set delijoke [exec grep -v "^\"${arg}\"$" irc.addic > irc.addic.tmp]
  set delijoke [exec mv -f irc.addic.tmp irc.addic]
  putserv "PRIVMSG $nick :\002Attempted to delete joke.\002"
 }
 return 0
}

if {$ircaddicpub} {
 bind pub - !ircaddic pub_joke
 bind pub o !addijoke pub_addijoke
 bind pub m !delijoke pub_delijoke
}


proc msg_joke {nick uhost hand arg} {
 if {[file exists irc.addic]} {
  if {$arg != ""} { set arg [expr [lindex $arg 0] - 1] }
  set ircjokes [exec cat irc.addic]
  if {$arg != ""} {
   set joke [lindex $ircjokes $arg]
  } {
   set joke [lindex $ircjokes [rand [llength $ircjokes]]]
  }
  putlog "!${nick}! joke"
  if {$joke != ""} { putserv "PRIVMSG $nick :\002${joke}\002" }
 } {
  putlog "!${nick}! ircjokes (no ircjokes)"
 }
 return 0
}

proc msg_addijoke {nick uhost hand arg}  {
 if {$arg != ""} {
  putlog "!${nick}! addijoke"
  set addijoke [exec echo "\"You might be an ircaddic IF.....${arg}\"" >>irc.addic]
  putserv "PRIVMSG $nick :\002Added joke.\002"
 }
 return 0
}

proc msg_delijoke {nick uhost hand arg} {
 if {$arg != ""} {
  set delijoke [exec grep -v "^\"${arg}\"$" irc.addic > irc.addic.tmp]
  set delijoke [exec mv -f irc.addic.tmp irc.addic]
  putserv "PRIVMSG $nick :\002Attempted to delete joke.\002"
 }
 return 0
}

if {$jokemsg} {
 bind msg - !ircaddic msg_joke
 bind msg o !addijoke msg_addijoke
 bind msg m !delijoke msg_delijoke
}

putlog "stupid ircjokes $ver by caps (mase_caps@hotmail.com) loaded"