Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #fcheck on
- alias -l fcheck {
- if ($regex($1,/(quote|qotd|qsearch)$/Si)) {
- if ($prop = add) set -z $+(%,$regml(1),$site,$network) %fMins
- else return $+(%,$regml(1),$site,$network)
- }
- }
- #fcheck end
- ;local alias to convert variable 1 and 2 to uppercase
- alias -l up return $+($upper($left($1,1)),$mid($1,2))
- on *:text:*:#landail: {
- var %file quote.txt, %x $lines(%file), %y $read(%file, n, $2), %rx $r(1,$lines(%file)), %ry $read(%file, n, %rx)
- ; %x = total lines in quote file
- ; %rx = random number between 1 and max lines in quote file
- if (!%x && $regex($1,/^!q(del|uote|otd|search|lines|open)$/Si)) { msg # There does not appear to be any quotes added yet. | halt }
- ;--------------------------------------------------------------------------------------------;
- ; !ADDING, DELETING, Quotes. !qadd requires ulevel access 5+ !qdel requires ulevel 9+ ;
- ;--------------------------------------------------------------------------------------------;
- if ($1 = !qadd || $1 = !addquote || $1 = !quoteadd || $1 = !addq) {
- if ($ulevel < 5) {
- msg # Sorry $nick you need to be a regular to add a quote.
- }
- if (!$2) {
- msg # Syntax: $1 QuoteHere
- echo -s $nick ran the $1 command incorrectly
- }
- tokenize 59 $2- | write %file $+($up($1),) $asctime(mmmm $+(dd,$chr(44)) yyyy) | var %x $lines(%file) | msg # Thank You for the quote! Your quote is number %x $+ . !quote %x to access it.
- set %LandailQuoteTotal $lines(%file)
- echo -s $nick added the quote $1-
- }
- if ($1 = !qdel) {
- if ($ulevel < 10) { msg # $v1 Only an admin may delete quotes. | halt }
- if (!$2) { msg # Syntax: $1 [1 - %x $+ ] | halt }
- var %i $numtok($2-, 32)
- while (%i) { var %list $sorttok($addtok(%list,$gettok($sorttok($2-, 32, n),%i,32),32),32,n) | dec %i }
- var %j $numtok(%list, 32)
- while (%j) {
- if (!$read(%file, n, $gettok(%list,%j,32))) {
- msg # Quote # $+ $gettok(%list,%j,32) Does not exist. Quotes 1 to %x exist.
- }
- else {
- msg # Quote $gettok(%list,%j,32) has been removed.
- write -dl $gettok(%list,%j,32) %file
- }
- dec %j
- }
- }
- ;------------------------------------------------------------------;
- ;MAIN !QUOTE function calls random quote and also specific quotes ;
- ;------------------------------------------------------------------;
- ;-------------------------------------------;
- ;----- QUOTE SCRIPT IF CALLED BY !QUOTE-----;
- ;-------------------------------------------;
- if ($1 = !Quote) || ($1 = !Quotes) {
- ;OLD IF CHECK WITH JUST !QUOTE BEFORE !QUOTE OR !QUOTES ADDED ---> if ($1 = !quote) {
- ;check if command syntax ran correctly, if not then output correct format
- if ($2 && $2 !isnum) {
- msg # Syntax: $1 [1 - %x $+ ]
- echo -s quote sent to chat. | halt
- }
- ;check if quote number provided exists, if not then output total number of quotes
- if ($2 && !%y || $2 < 0) {
- msg # BibleThump $chr(160) Quote $chr(160) $+ $2 Does not exist. You can select 1 to %x $+ . | halt
- }
- ;antiflood protection. If user level under 4 then flood protection enabled
- if ($ulevel < 7) {
- if ($($fcheck($right($1, -1)),2)) { msg # $nick You must wait $duration($v1) before you can use !quote again.
- echo -s $nick triggered Anti-Flood protection for !quote | halt
- }
- }
- ;$fcheck($right($1, -1)).add
- if (!$2) {
- msg # Quote %rx $lower(-) %ry
- echo -s Should do msg # Quote $chr(160) $+ $2 - %y | halt
- }
- msg # Quote $chr(160) $+ $2 - %y
- echo -s sent quote to the chat
- }
- ;-----------------------------------------------------------------------------------------------;
- ; !QOTD QUOTE OF THE DAY! ;
- ; Checks & Updates to the current day everytime called. Keeps same quote until day is changed. ;
- ;-----------------------------------------------------------------------------------------------;
- if ($1 = !qotd) {
- if (%date != $date) var -g %date $v2, %qotd %rx
- if ($ulevel < 7) {
- if ($($fcheck($right($1, -1)),2)) {
- msg # You must wait $duration($v1) before you can use that again. | halt
- }
- }
- $fcheck($right($1, -1)).add | msg # $chr(160) $+ $read(%file, n, %qotd)
- echo -s !qotd in $chan was ran.
- }
- if ($ulevel = 10 && $1 = !newqotd) {
- echo -s Old qotd number was %qotd
- set %qotd $rand(0,%x)
- echo -s New qotd number chosen randomly from 0 to %x $+ . Set it to %qotd
- echo -s New qotd number is %qotd $+ . | halt
- }
- ;-------------------------------------------------------------------------------;
- ; !QUOTE COMMANDS ---- SEND LIST OF COMMANDS TO THE # Channel it detects from ;
- ; Sends MSG # to calling channel ;
- ;-------------------------------------------------------------------------------;
- if ($1 = !quotecommands || $1 = !quotehelp || $1 = !quoteshelp || $1 = !helpquote || $1 = !helpquotes || $1 = !qcommands ) {
- msg # !Quote or !Quote %ast #. $&
- !FindQuote or !FindLewd searches Quotes / LewdQuotes for a word or phrase. !qotd for DailyQuote. !AddQuote / !AddLewd to add a quote ^_^ | halt
- }
- ;-----------------------------------------------------------------------;
- ; !QSEARCH !FINDQUOTE !QUOTEFIND !QFIND SEARCH THE QUOTE FILE BY TERM ;
- ; This Is the Quote Search By Phrase Function and its various aliases ;
- ;-----------------------------------------------------------------------;
- if ($1 = !qsearch || $1 = !findquote || $1 = !quotefind || $1 = !qfind || $1 = !searchquote || $1 = !searchquotes) {
- if ($ulevel < 7) {
- if ($($fcheck($right($1, -1)),2)) { msg # You must wait $duration($v1) before you can use that again. | halt }
- }
- $fcheck($right($1, -1)).add
- if (!$2) { msg # Syntax: $+ $1 [term] | halt }
- var %i 1 | while ($read(%file,n,%i)) {
- if ($2 = -a) {
- if (!$3) { msg # Syntax: $+ $1-2 [author] | halt }
- var %author $gettok($read(%file,n,%i),1,2)
- if ($3- $+ : = $strip(%author,b)) var %qsearch $addtok(%qsearch,%i,32)
- }
- elseif ($2- isin $read(%file,n,%i)) var %qsearch $addtok(%qsearch,%i,32)
- inc %i
- }
- if (!%qsearch) msg # There aren't any quotes matching $+($iif($2 = -a,$3-,$2),.)
- else msg # The following Quote #'s contain $+($iif($2 = -a,$3-,$2-), : %qsearch)
- }
- if ($1 = !aquote && $regex($2,/^o(|n|ff)$/Si) && $nick isin %owner) {
- if (!%aMins) { msg # You have first to set the duration of aQuote. | msg # Syntax: !aTime [mins] | halt }
- if ($regml(1) = n) { msg # aQuote has been activated. | timerAQuote 0 %aMins msg # Auto Quote: $!read( %file , n) }
- elseif ($timer(AQuote)) { timerAQuote $2 | msg # $+ aQuote has been turned off. }
- }
- ;-------------------------------------------------------------------------------;
- ; !TOTALQUOTES - ANYONE CAN SEND A LIST OF TOTAL LINES IN THE QUOTE FILE ;
- ;-------------------------------------------------------------------------------;
- if ($1 = !TotalQuotes) msg # There are %x quotes of memorable moments collected so far. Used that !addquote to add to the collection.
- ;-----------------------------------------;
- ; SET THE COOL DOWN TIMER VIA CHAT ;
- ;-----------------------------------------;
- if ($regex($1,/^!(a|f)time$/Si) && $nick isin %owner) {
- if ($2 isnum && $2 >= 0) {
- set $+(%,$regml(1),Mins $calc($int($2) * 60 + $gettok($2,2,46)))
- msg # Set the cooldown timer to $iif($regml(1) = a,aQuote) $2 minutes.
- }
- }
- ;------------------------;
- ; FLOOD CHECK STUFF ;
- ;------------------------;
- if ($1 = !fcheck && $regex($2,/^o(|n|ff)$/Si) && $nick isin %owner) {
- if (!%fMins) { msg # You have first to set the duration of fTime. | msg # Syntax: !fTime [mins] | halt }
- $iif($regml(1) = n,en,dis) $+ able #fcheck
- msg # Floodcheck has been $iif($v1 = $v2,en,dis) $+ abled.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement