All pastes #793193 Raw Edit

quote system by Ryan|

public text v1 · immutable
·published 2007-11-22 01:09 UTC
rendered paste body
on *:TEXT:qowner:?: {
  if ($readini(quotes.ini,owner,owner) == $null) {
    query $nick You are now the owner of the quotes system. Type !qhelp for comands.
    enable #quotes
    writeini quotes.ini owner owner $nick
  }  
  else {
    query $nick A quote owner is already selected!!
  }
}
#quotes off
on *:TEXT:*:#: {
  if ($1 == !quote) {
    if ($nick !isin $readini(quotes.ini,bans,bans)) {
      if ($2) {
        if ($2 > $lines(quotes.txt)) {
          msg $chan Sorry, but there are only $lines(quotes.txt) quotes in database! Add one by typing !addquote <quote> <comment>
        }
        else {
          msg $chan $chr(91) Quote $2 $chr(93) $read(quotes.txt,$2)
        }
      }
      else {
        var %quotes = $read(quotes.txt)
        msg $chan $chr(91) Quote $readn $chr(93) %quotes
      }
    }
    else {
      msg $chan You are banned from quotes. Please see a quote moderator to resolve this problem.
    }
  }
  if ($1 == !addquote) {
    if ($nick isin $readini(quotes.ini,bans,bans)) {
      msg $chan You are banned from quotes. Please see a quote moderator to resolve this problem.
    }
    elseif ($2-) {
      write quotes.txt   $+ $strip($2-) $+  $chr(124) Quoted by $nick $chr(124) Added on $fulldate $chr(124) There are $ $+ readini(quotes.ini,stats, $+ $nick $+ ) quotes submitted by $nick $chr(124) $ $+ calc($ $+ readini(quotes.ini,stats, $+ $nick $+ ) / $ $+ readini(quotes.ini,stats,all) * 100 ) percent of all quotes.
      msg $chan Added as quote $lines(quotes.txt)
      writeini quotes.ini stats $nick $calc($readini(quotes.ini,stats,$nick) + 1 )
      writeini quotes.ini stats all $calc($readini(quotes.ini,stats,all) + 1 )
    }
  }
  if ($1 == !qban) {
    if ($nick isin $readini(quotes.ini,mods,mods)) || ($nick == $readini(quotes.ini,owner,owner)) {
      if ($2 == add) {
        if ($3 isin $readini(quotes.ini,bans,bans)) {
          msg $chan $3 is already banned from quotes!
        }
        else {
          writeini quotes.ini bans bans $addtok($readini(quotes.ini,bans,bans),$3,32)
          msg $chan Quote ban added!
          if ($chr(42) isin $readini(quotes.ini,bans,bans)) {
            writeini quotes.ini bans bans $remtok($readini(quotes.ini,bans,bans),$chr(42),1,32)
          }
        }
      }
      if ($2 == del) {
        if ($3 !isin $readini(quotes.ini,bans,bans)) {
          msg $chan $3 isn't banned from quotes. How can I unban him?
        }
        else {
          var %t = $remtok($readini(quotes.ini,bans,bans),$3,1,32) | /writeini quotes.ini bans bans $iif(%t == $null,$chr(42),%t)
          msg $chan $3 $+ 's Quote ban deleted!!
        }
      }
      if ($2 == list) {
        msg $chan Quote Bans
        msg $chan $readini(quotes.ini,bans,bans)
      }
    }
    else {
      msg $chan Access Denied!!
    }
  }
  if ($1 == !qmod) {
    if ($nick == $readini(quotes.ini,owner,owner)) {
      if ($2 == add) {
        if ($3 isin $readini(quotes.ini,mods,mods)) {
          msg $chan $3 is already a quote mod.
        }
        else {
          writeini quotes.ini mods mods $addtok($readini(quotes.ini,mods,mods),$3,32)
          msg $chan $3 added as a quote mod!!
          if ($chr(42) isin $readini(quotes.ini,mods,mods)) {
            writeini quotes.ini mods mods $remtok($readini(quotes.ini,mods,mods),$chr(42),1,32)
          }
        }
      }
      if ($2 == del) {
        if ($3 !isin $readini(quotes.ini,mods,mods)) {
          msg $chan $3 isn't a quote mod. How can I remove him?
        }
        else {
          var %r = $remtok($readini(quotes.ini,mods,mods),$3,1,32) | /writeini quotes.ini mods mods $iif(%r == $null,$chr(42),%r)
          msg $chan $3 deleted from quote mod list!!
        }
      }
      if ($2 == list) {
        msg $chan Quote Mods
        msg $chan $readini(quotes.ini,mods,mods)
      }
    }
    else {
      msg $chan Access Denied
    }
  }
  if ($1 == !qdel) {
    if ($nick isin $readini(quotes.ini,mods,mods)) || ($nick == $readini(quotes.ini,owner,owner)) {
      if ($2 > $lines(quotes.txt)) {
        msg $chan There are only $lines(quotes.txt) quotes in the database!
      }
      else {
        write -dl $+ $2 quotes.txt
        msg $chan Quote $2 deleted from database.
      }
    }
    else {
      msg $chan Access Denied!!
    }
  }
  if ($1 == !qnum) {
    if ($nick !isin $readini(quotes.ini,bans,bans)) {
      msg $chan There are $lines(quotes.txt) quotes in the database.
    } 
    else {
      msg $chan You are banned from quotes. Please see a quote moderator to resolve this problem.
    }
  }
  if ($1 == !qhelp) {
    if ($nick !isin $readini(quotes.ini,bans,bans)) {
      notice $nick Normal Commands
      notice $nick !quote <number> - Displays quote <number> from quote database. If there is no <number>, it displays a 
      notice $nick random quote.
      notice $nick !addquote <quote> - Adds <quote> to database.
      notice $nick !qnum - Displays the number of quotes in the database.
      notice $nick Moderation Commands
      notice $nick !qban [add-del] <nick> - Adds or deletes <nick> to the banlist.
      notice $nick !qban [list] - Lists the names on the ban list.
      notice $nick !qdel <number> - Deletes quote <number> from the database.
      notice $nick And all the commands listed above.
      notice $nick Owner Commands
      notice $nick !qmod [add-del] <nick> - Adds or deletes <nick> to the mod list.
      notice $nick !qmod [list] - Lists the names on the quote mod list.
      notice $nick And all the commands listed above. 
    }
    else {
      msg $chan You are banned from quotes. Please see a quote moderator to resolve this problem.
    }
  }
}