Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- on *:TEXT:qowner:?: {
- if ($readini(quotes.ini,owner,owner) == $null) {
- query $nick You are now the owner of the quotes system. Type .qhelp (in a channel) for commands.
- enable #quotes
- writeini quotes.ini owner owner $nick
- }
- else {
- msg $nick A quote owner is already selected $+([,$readini(quotes.ini,owner,owner),])
- }
- }
- #quotes off
- on *:text:*:#: {
- tokenize 32 $strip($1-)
- if ($nick isin $readini(quotes.ini,bans,bans)) {
- if ($($+(%,quoteabuse,$nick),2) == true) {
- halt
- }
- else {
- set -u5 $+(%,quoteabuse,$nick) true
- msg $chan $qstyleb(You are banned from quotes. Please see a quote moderator/owner to resolve this problem.)
- halt
- }
- }
- if (($1 == .quote) || ($1 == .qread) || ($1 == .quoteread) || ($1 == .readquote) || ($1 == .qrand)) {
- if (($2 == $null) || ($2 == random) || ($1 == .qrand)) {
- if (!$readini(quotes.ini,stats,all)) {
- msg $chan $qstyleb(There are no quotes (yet). Add one with .qadd <quote>)
- }
- else {
- :RandomTop
- var %quoterandom $rand(1,$lines(quotes.txt))
- if (*-* iswm $read(Quotes.txt,%QuoteRandom)) {
- msg $chan $qstyleb(Quote $+($chr(35),$readn) added by $gettok($read(quotes.txt,$readn),2,45) $timedifference($gettok($read(quotes.txt,$readn),1,45)) ago.)
- msg $chan $qstyle($gettok($read(quotes.txt,n,$readn),3-,45))
- }
- elseif (*-* !iswm $read(Quotes.txt,%QuoteRandom)) {
- goto RandomTop
- }
- }
- }
- elseif (($2 !isnum) || ($2 == 0)) {
- msg $chan $qstyle(To read a quote type .qread <quoteNumber> -- If you meant to add a quote type .qadd <quote> -- For help type .qhelp)
- }
- elseif ($2 !isnum 1- $+ $lines(quotes.txt)) {
- msg $chan $qstyle(Sorry, but there are only $lines(quotes.txt) quotes in database! Add one by typing .qadd <quote>)
- }
- else {
- if ($read(quotes.txt,$2) == $null) {
- msg $chan $qstyleb(Quote $+($chr(35),$2) no longer exists (it has been deleted).)
- }
- else {
- msg $chan $qstyleb(Quote $+($chr(35),$2) added by $gettok($read(quotes.txt,$2),2,45) $timedifference($gettok($read(quotes.txt,$2),1,45)) ago.)
- msg $chan $qstyle($gettok($read(quotes.txt,n,$2),3-,45))
- }
- }
- }
- if (($1 == .qsearch) || ($1 == .searchquote) || ($1 == .quotesearch)) {
- if ($2 == $null) {
- msg $chan $qstyle(Type .qsearch <search term / author> to search the quote database.)
- }
- else {
- if (!$3) {
- var %asearch
- var %x 1
- while (%x <= $lines(quotes.txt)) {
- if ($2 == $gettok($read(Quotes.txt,n,%x),2,45)) {
- var %asearch $addtok(%asearch,%x,44)
- }
- inc %x
- }
- if (%asearch != $null) {
- if (*,* !iswm %asearch) {
- msg $chan $qstyleb(Quote $+($chr(35),%asearch) added by4 $gettok($read(quotes.txt,%asearch),2,45) 10 $+ $timedifference($gettok($read(quotes.txt,%asearch),1,45)) ago.)
- msg $chan $qstyle($gettok($read(quotes.txt,n,%asearch),3-,45))
- var %sreply true
- }
- else {
- msg $chan $qstyle(Quotes found authored by $qt($2-) $+ : $replace(%asearch,$chr(44),$chr(44) $+ $chr(32)))
- var %sreply true
- }
- }
- }
- var %search
- var %i 1
- while (%i <= $lines(quotes.txt)) {
- if ($+(*,$2-,*) iswm $gettok($read(Quotes.txt,n,%i),3-,45)) {
- var %search $addtok(%search,%i,44)
- }
- inc %i
- }
- if (%search != $null) {
- if ((*,* !iswm %search) && (%search != %asearch)) {
- msg $chan $qstyleb(Quote $+($chr(35),%search) added by $gettok($read(quotes.txt,%search),2,45) $timedifference($gettok($read(quotes.txt,%search),1,45)) ago matches search $qt($2-) $+ .)
- msg $chan $qstyle($gettok($read(quotes.txt,n,%search),3-,45))
- var %sreply true
- }
- elseif (*,* iswm %search) {
- msg $chan $qstyle(Quotes found matching search $qt($2-) $+ : $replace(%search,$chr(44),$chr(44) $+ $chr(32)))
- var %sreply true
- }
- }
- elseif ((%sreply == $null) && (%search == $null)) {
- msg $chan $qstyle(No quotes were found that matched your search of $qt($2-) $iif($3,$+ .,or were authored by $qt($2) $+ .))
- }
- }
- }
- if (($1 == .qadd) || ($1 == .quoteadd) || ($1 == .qadd)) {
- if ($2 == $null) {
- msg $chan $qstyle(If you want to add a quote type .qadd <quote> -- For help type .qhelp)
- }
- elseif ($2-) {
- write quotes.txt $+($asctime,-,$nick,-,$2-)
- msg $chan $qstyleb(Added $qt($+($2-12,$iif($13 != $null,...,$null))) as quote number $+($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 isin $readini(quotes.ini,owner,owner))) {
- if (!$2) {
- msg $chan $qstyle(Type .qban add/del/list for more help type .qhelp)
- }
- if ($2 == add) {
- if (!$3) {
- msg $chan $qstyle(Type .qban add <nick> for more help type .qhelp)
- }
- elseif ($3 isin $readini(quotes.ini,bans,bans)) {
- msg $chan $qstyle($3 is already banned from quotes!)
- }
- elseif ($3 isin $readini(quotes.ini,owner,owner)) {
- msg $chan $qstyle(Sorry you may not ban $3 from quotes, as he is a quotes owner.)
- }
- else {
- writeini quotes.ini bans bans $addtok($readini(quotes.ini,bans,bans),$3,32)
- msg $chan $qstyle($3 added to quote bans list.)
- if ($chr(42) isin $readini(quotes.ini,bans,bans)) {
- writeini quotes.ini bans bans $remtok($readini(quotes.ini,bans,bans),$chr(42),1,32)
- }
- }
- }
- elseif ($2 == del) {
- if (!$3) {
- msg $chan $qstyle(Type .qban del <nick> for more help type .qhelp)
- }
- elseif ($3 !isin $readini(quotes.ini,bans,bans)) {
- msg $chan $qstyle($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 $qstyle($3 has been removed from the quotes ban list.)
- }
- }
- elseif ($2 == list) {
- msg $chan $qstyleb(Quote Bans)
- msg $chan $qstyle($iif($readini(quotes.ini,bans,bans) == $null,Nobody is banned from using quotes (yet).,$v1))
- }
- else {
- msg $chan $qstyle(Type .qban add/del/list for more help type .qhelp)
- }
- }
- else {
- msg $chan $qstyle(Sorry, you need to be a quote mod/owner to modify the ban list. See .qhelp or an op for assistance.)
- }
- }
- if ($1 == .qmod) {
- if ($nick isin $readini(quotes.ini,owner,owner)) {
- if (!$2) {
- msg $chan $qstyle(Type .qmod add/del/list for more help type .qhelp)
- }
- elseif ($2 == add) {
- if ($3 == $null) {
- msg $chan $qstyle(Type .qmod add <nick> for more help type .qhelp)
- }
- elseif ($3 isin $readini(quotes.ini,mods,mods)) {
- msg $chan $qstyle($3 is already a quote mod.)
- }
- else {
- writeini quotes.ini mods mods $addtok($readini(quotes.ini,mods,mods),$3,32)
- msg $chan $qstyle($3 is now a quotes 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)
- }
- }
- }
- elseif ($2 == del) {
- if ($3 == $null) {
- msg $chan $qstyle(Type .qmod del <nick> for more help type .qhelp)
- }
- elseif ($3 !isin $readini(quotes.ini,mods,mods)) {
- msg $chan $qstyle($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 $qstyle($3 has been removed from the quote mods list!)
- }
- }
- elseif ($2 == list) {
- msg $chan $qstyleb(Quote Mods)
- msg $chan $qstyle($iif($readini(quotes.ini,mods,mods) == $null,Nobody is a quote moderator (yet).,$v1))
- }
- else {
- msg $chan $qstyle(Type .qmod add/del/list for more help type .qhelp)
- }
- }
- else {
- if (($2 == list) && ($nick isin $readini(quotes.ini,mods,mods))) {
- msg $chan $qstyleb(Quote Mods)
- msg $chan $qstyle($iif($readini(quotes.ini,mods,mods) == $null,Nobody is a quote moderator (yet).,$v1))
- halt
- }
- msg $chan $qstyle(Sorry, you need to be the quote owner to modify the mod list. See .qhelp or an op for assistance.)
- }
- }
- if ($1 == .qowner) {
- if ($nick isin $readini(quotes.ini,owner,owner)) {
- if (!$2) {
- msg $chan $qstyle(Type .qowner add/list for more help type .qhelp)
- }
- elseif ($2 == add) {
- if ($3 == $null) {
- msg $chan $qstyle(Type .qowner add <nick> for more help type .qhelp)
- }
- elseif ($3 isin $readini(quotes.ini,owner,owner)) {
- msg $chan $qstyle($3 is already a quote owner.)
- }
- else {
- writeini quotes.ini owner owner $addtok($readini(quotes.ini,owner,owner),$3,32)
- msg $chan $qstyle($3 is now a quotes owner.)
- if ($chr(42) isin $readini(quotes.ini,owner,owner)) {
- writeini quotes.ini owner owner $remtok($readini(quotes.ini,owner,owner),$chr(42),1,32)
- }
- }
- }
- elseif ($2 == list) {
- msg $chan $qstyleb(Quote Owners)
- msg $chan $qstyle($iif($readini(quotes.ini,owner,owner) == $null,Nobody is a quote owner (yet). Type "/msg $me qowner" to be the first.,$v1))
- }
- else {
- msg $chan $qstyle(Type .qowner add/list for more help type .qhelp)
- }
- }
- else {
- msg $chan $qstyle(Sorry, you need to be the quote owner to modify/read the owner list. See .qhelp or an op for assistance.)
- }
- }
- if (($1 == .qdel) || ($1 == .quotedel) || ($1 == .delquote)) {
- if ($2 == $null) {
- msg $chan $qstyle(If you want to add a quote type .qadd <quote> -- For help type .qhelp)
- halt
- }
- elseif ($nick isin $readini(quotes.ini,mods,mods)) || ($nick isin $readini(quotes.ini,owner,owner)) || ($nick == $gettok($read(quotes.txt,$2),2,45)) {
- if (($2 !isnum) || ($2 == 0)) {
- msg $chan $qstyle(To delete a quote type .qdel <quoteNumber> -- If you meant to add a quote type .qadd <quote> -- For help type .qhelp)
- }
- elseif ($2 !isnum 1- $+ $lines(quotes.txt)) {
- msg $chan $qstyle(Sorry, but there are only $lines(quotes.txt) quotes in database! Add one by typing .qadd <quote>)
- }
- else {
- if ($read(quotes.txt,$2) == $null) {
- msg $chan $qstyleb(Quote $+($chr(35),$2) has previously been deleted.)
- halt
- }
- writeini quotes.ini stats $gettok($read(quotes.txt),2,45) $calc($readini(quotes.ini,stats,$nick) - 1 )
- writeini quotes.ini stats all $calc($readini(quotes.ini,stats,all) - 1 )
- write -l $+ $2 quotes.txt
- msg $chan $qstyleb(Quote $+($chr(35),$2) has been deleted.)
- }
- }
- else {
- msg $chan $qstyle(Sorry, you may only delete quotes that you didn't add if you are a quote mod/owner. For more help see .qhelp or an operator.)
- }
- }
- if (($1 == .qnum) || ($1 == .qtotal)) {
- var %total $readini(quotes.ini,stats,all)
- var %nick $readini(quotes.ini,stats,$nick)
- msg $chan $qstyle(There are %total quotes in the database. You have written %nick $+([,$calc($calc(%nick / %total) * 100),%,]) of them.)
- }
- if ($1 == .qhelp) {
- if ($($+(%,quotehelp,$nick),2) == true) {
- msg $chan $qstyle(You were just sent the quote help info. Check your notices.)
- }
- else {
- set -u5 $+(%,quotehelp,$nick) true
- notice $nick $qstyleb(Normal Quote Commands)
- notice $nick $qstyle(.qread <number> - Displays quote <number> from quote database. If there is no <number>, it displays a random quote.)
- notice $nick $qstyle(.qadd <quote> - Adds <quote> to database.)
- .timer -m 1 10 notice $nick $qstyle(.qsearch <search term / author> to search the quote database.)
- .timer -m 1 25 notice $nick $qstyle(.qnum - Displays the number of quotes in the database.)
- .timer -m 1 50 notice $nick $qstyle(.qdel <number> - Deletes quote <number> from the database. $+($chr(40),Requires authorship or mod/owner,$chr(41)))
- if ($nick isin $readini(quotes.ini,mods,mods)) || ($nick isin $readini(quotes.ini,owner,owner)) {
- .timer -m 1 100 notice $nick $qstyleb(Moderator Quote Commands)
- .timer -m 1 150 notice $nick $qstyle(.qban [add-del] <nick> - Adds or deletes <nick> to the banlist.)
- .timer -m 1 200 notice $nick $qstyle(.qban [list] - Lists the names on the ban list.)
- .timer -m 1 250 notice $nick $qstyle(.qmod [list] - Lists the names on the mod list.)
- }
- if ($nick isin $readini(quotes.ini,owner,owner)) {
- .timer -m 1 300 notice $nick $qstyleb(Owner Quote Commands)
- .timer -m 1 350 notice $nick $qstyle(.qmod [add-del] <nick> - Adds or deletes <nick> to the mod list.)
- .timer -m 1 400 notice $nick $qstyle(.qowner [add] <nick> - Adds or deletes <nick> to the owner list. NOTE: You may not delete other quote owners.)
- .timer -m 1 450 notice $nick $qstyle(.qowner [list] - Lists the names on the owner list.)
- }
- }
- }
- }
- alias qstyleb {
- return 14(4x14)10 $+ $1- $+ 14(4x14)
- }
- alias qstyle {
- return 14(4x14) $+ $1- $+ 14(4x14)
- }
- alias timeDifference {
- ;Input a date in $asctime format and this will return time from current date.
- return $duration($calc($ctime - $ctime($1-)))
- }
- #Quotes end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement