Administrators chain Posted July 18, 2022 Administrators Report Share Posted July 18, 2022 ;; ___________________________________________________________________________________________________________________________________________________________________________________ ;;/ \ ;;| _____ _____ _____ _____ _____ _____ _____ | ;;| /\ \ /\ \ /\ \ /\ \ /\ \ /\ \ /\ \ | ;;| /::\ \ /::\____\ /::\ \ /::\ \ /::\ \ /::\ \ /::\ \ | ;;| /::::\ \ /::::| | /::::\ \ /::::\ \ /::::\ \ /::::\ \ /::::\ \ | ;;| /::::::\ \ /:::::| | /::::::\ \ /::::::\ \ /::::::\ \ /::::::\ \ /::::::\ \ | ;;| /:::/\:::\ \ /::::::| | /:::/\:::\ \ /:::/\:::\ \ /:::/\:::\ uck\ /:::/\:::\ \ /:::/\:::\ \ | ;;| /:::/__\:::\ \ /:::/|::| | /:::/__\:::\ \ /:::/__\:::\ \ /:::/__\:::\ \ /:::/ \:::\ \ /:::/__\:::\ \ | ;;| /::::\ \:::\ \ /:::/ |::| | /::::\ \:::\ \ /::::\ \:::\ \ /::::\ \:::\ \ /:::/ \:::\ \ /::::\ \:::\ \ | ;;| /::::::\ \:::\ \ /:::/ |::| | _____ /::::::\ \:::\ \ /::::::\ \:::\ \ /::::::\ \:::\ \ /:::/ / \:::\ \ /::::::\ \:::\ \ | ;;| /:::/\:::\ \:::\ \ /:::/ |::| |/\ \ /:::/\:::\ \:::\ \ /:::/\:::\ \:::\ \ /:::/\:::\ \:::\____\ /:::/ / \:::\ ___\ /:::/\:::\ \:::\ \ | ;;| /:::/__\:::\ \:::\____\/:: / |::| /::\____\/:::/__\:::\ \:::\____\/:::/__\:::\ \:::\____\/:::/ \:::\ \:::| |/:::/____/ ___\:::| |/:::/__\:::\ \:::\____\ | ;;| \:::\ \:::\ \::/ /\::/ /|::| /:::/ /\:::\ \:::\ \::/ /\:::\ \:::\ \::/ /\::/ |::::\ /:::|____|\:::\ \ /\ /:::|____|\:::\ \:::\ \::/ / | ;;| \:::\ \:::\ \/____/ \/____/ |::| /:::/ / \:::\ \:::\ \/____/ \:::\ \:::\ \/____/ \/____|:::::\/:::/ / \:::\ /::\ \::/ / \:::\ \:::\ \/____/ | ;;| \:::\ \:::\ \ |::|/:::/ / \:::\ \:::\ \ \:::\ \:::\ \ |:::::::::/ / \:::\ \:::\ \/____/ \:::\ \:::\ \ | ;;| \:::\ \:::\____\ |::::::/ / \:::\ \:::\____\ \:::\ \:::\____\ |::|\::::/ / \:::\ \:::\____\ \:::\ \:::\____\ | ;;| \:::\ \::/ / |:::::/ / \:::\ \::/ / \:::\ \::/ / |::| \::/____/ \:::\ /:::/ / \:::\ \::/ / | ;;| \:::\ \/____/ |::::/ / \:::\ \/____/ \:::\ \/____/ |::| ~| \:::\/:::/ / \:::\ \/____/ | ;;| \:::\ \ /:::/ / \:::\ \ \:::\ \ |::| | \::::::/ / \:::\ \ | ;;| \:::\____\ /:::/ / \:::\____\ \:::\____\ \::| | \::::/ / \:::\____\ | ;;| \::/ / \::/ / \::/ / \::/ / \:| | \::/____/ \::/ / | ;;| \/____/ \/____/ \/____/ \/____/ \|___| \/____/ | ;;\___________________________________________________________________________________________________________________________________________________________________________________/ ;; |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Eneerge's Quote Script v1.2 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ;; |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Without all bells and whistles |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ;; |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| :) |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ;; ____________________________________________________________________________________________________ ;; _________________________________________ POPUPS GUI _______________________________________________ ;; ____________________________________________________________________________________________________ alias nrg_popupStatus { set %nrg_popup true var %status $nrg_checkStatus($1,$2) unset %nrg_popup if ((%status == quote_isOp) || (%status == quote_isVoice) || (%status == quote_isOp) || (%status == quote_isAllowed)) { return allowed } if (%status == quote_isBanned) { return banned } return false } alias nrg_popupStatusExact { set %nrg_popup true var %status $nrg_checkStatus($1,$2) unset %nrg_popup if (%status == quote_isAllowed) { return (Allow List) } else if (%status == quote_isOp) { return (ChanOP) } else if (%status == quote_isVoice) { return (ChanVoice) } return $null } menu nicklist { - NRG-Quote .Print quote from $1:{ var %return_value = $nrg_quote($1) if (%return_value == quote_noneExist) { nrg_stdo quote_noneExist $me $1 } else { nrg_stdo quote_outputQuote $chan $1 %return_value } } .- .View $1 $+ 's quote DB:{ var %return_value = $nrg_quote($1) if (%return_value == quote_noneExist) { nrg_stdo quote_noneExist $me $1 } else { /run $mircdirquotesdb $+ \ $+ $1 $+ .txt } } .Delete $1 $+ 's quote DB:{ var %return_value = $nrg_quote($1) if (%return_value == quote_noneExist) { nrg_stdo quote_noneExist $me $1 } else { if ($$?="Are you sure you would like to completely purge $1 $+ 's quotedb (y/n)" == y) { /remove $mircdirquotesdb $+ \ $+ $1 $+ .txt } } } .- .Add a quote to $1 $+ 's DB:{ var %nrg_qquote = $$?="What quote would you like to add to $1 $+ 's DB?" var %return_value = $nrg_addquote($1,%nrg_qquote) if (%return_value == quote_Exists) { nrg_stdo quote_Exists $me $1 } else if (%return_value == quote_Added) { nrg_stdo quote_Added $me $1 %nrg_qquote } } .- .$iif($nrg_popupStatus($1,$chan) == banned,$style(1)) Banned:{ ;; COMMENT: User is banned, so toggling would unban them if ($nrg_popupStatus($1,$chan) == banned) { .ruser $1 1 .nrg_stdo quote_remBan $me $1 } ;; COMMENT: User is un-banned, so toggling would ban them else { .nrg_ban $1 .nrg_stdo quote_addBan $me $1 } } .$iif($nrg_popupStatus($1,$chan) == allowed,$style(1)) Allowed $nrg_popupStatusExact($1,$chan):{ if ($nrg_popupStatus($1,$chan) == false) { .nrg_allow $1 .nrg_stdo quote_addAllow $me $1 } else if ($nrg_popupStatus($1,$chan) == banned) { .ruser $1 1 .nrg_stdo quote_remBan $me $1 if ($nrg_popupStatus($1,$chan) == false) { .nrg_allow $1 .nrg_stdo quote_addAllow $me $1 } } else if ($nrg_popupStatus($1,$chan) == allowed) { set %nrg_popup true var %status $nrg_checkStatus($1,$chan) unset %nrg_popup if (%status == quote_isAllowed) { .ruser $1 1 .nrg_stdo quote_remAllow $me $1 } else { .nrg_allow $1 .nrg_stdo quote_addAllow $me $1 } } } .- .Open DB Folder:/run $mircdirquotesdb } ;; ____________________________________________________________________________________________________ ;; _________________________________________ LOADING COMMANDS _________________________________________ ;; ____________________________________________________________________________________________________ on *:LOAD:{ if (!$exists($mircdirquotesdb)) { mkdir $mircdirquotesdb } set %nrg_active 0 echo -a 4Successfully loaded Eneerge's quoting system. echo -a 4Quotes will be saved to:3 $mircdirquotesdb } ;; ____________________________________________________________________________________________________ ;; _________________________________________ ALIAS COMMANDS ___________________________________________ ;; ____________________________________________________________________________________________________ ;; ############# nrg_floodcheck - this command checks to see if the script is being flooded. If so, it will return true and halt for 30 seconds. ;; A flood is defined as receiving more than 5 requests within 60 seconds. alias nrg_floodcheck { if (%nrg_popup == true) { return false } inc %nrg_active if (%nrg_lastcmd != $null) { if ($calc(%nrg_lastcmd + 30) >= $ctime) { if (%nrg_active > 7) { set %nrg_flood $ctime return true } } else { unset %nrg_flood | set %nrg_active 0 } } if (%nrg_flood == $null) { set %nrg_lastcmd $ctime return false } } ;; ############# nrg_clearFlood - This command allows you to clear the flood status alias nrg_clearflood { unset %nrg_flood unset %nrg_lastcmd set %nrg_active 0 } ;; ############# nrg_checkStatus - This returns the status of a user and/or the script. A true value allows the script to execute. ;; The script will return true only if all of the following conditions are met: ;; 1) Script is NOT disabled ;; 2) A flood has NOT been detected ;; 3) User is NOT banned ;; and if ONE (not exclusively) of the following conditions are met: ;; 1) User is a channel voice/operator OR ;; 2) User is on the allow list alias nrg_checkStatus { if ((%nrg_disabled != true) && ($nrg_floodcheck != true)) { if ($level($address($1,1)) == nrg_banned) { return quote_isBanned } else { if ($level($address($1,1)) == nrg_allowed) { return quote_isAllowed } else if ($1 isop $2) { return quote_isOp } else if ($1 isvoice $2) { return quote_isVoice } } } return false } ;; ############# nrg_ban - Bans a user from using the system by adding their user@host to the list of banned users. ;; NOTE: This command will overwrite nrg_allow so the user will no longer be able to use the script. alias nrg_ban { if ($1 !ison $chan) { nrg_stdo quote_nickNotFound_inChan $me $1 $chan } else { .guser nrg_banned $1 1 } } ;; ############# nrg_allow - Explicitly allows a user to use the quote script, even if they aren't an op or voice ;; NOTE: This command will overwrite nrg_ban so the user will regain access to use the script. alias nrg_allow { if ($1 !ison $chan) { nrg_stdo quote_nickNotFound_inChan $me $1 $chan } else { .guser nrg_allowed $1 1 } } ;; ############# Enable/Disable - These commands allow you to enable or disable the script alias nrg_disable { set %nrg_disabled true } alias nrg_enable { unset %nrg_disabled } ;; ____________________________________________________________________________________________________ ;; _________________________________________ CHANNEL COMMANDS _________________________________________ ;; ____________________________________________________________________________________________________ ;; ############# AddQuote Commands - Commands associated with adding quotes to a database alias nrg_addquote { if ($2 == $null) { nrg_stdo quote_invalidAddQuote $me $1 | halt } ;; COMMENT: Make sure if a new file is created that it does not start with a number. That would mess up everything! Halt if this is the case. if (!$exists($mircdirquotesdb\ $+ $1 $+ .txt)) { if ($2 isnum) { halt } else { write $mircdirquotesdb\ $+ $1 $+ .txt $2- | return quote_Added | halt } } ;; COMMENT: Make sure current quote does not already exist $read($mircdirquotesdb\ $+ $1 $+ .txt,s,$2-) if ($readn == 0) { write $mircdirquotesdb\ $+ $1 $+ .txt $2- return quote_Added } else { return quote_Exists } } on *:TEXT:!addquote*:#:{ if ($len($2) > 15) { halt } var %status [ $+ [ $nick ] ] $nrg_checkStatus($nick,$chan) if ((%status [ $+ [ $nick ] ] != false) && ($2 != $NULL) && (%status [ $+ [ $nick ] ] != quote_isBanned)) { var %return_value = $nrg_addquote($2,$3-) if (%return_value == quote_Exists) { nrg_stdo quote_Exists $nick $2 } else if (%return_value == quote_Added) { nrg_stdo quote_Added $nick $2 $3- } } } ;; ############### Quote - Commands associated with retrieving a quote from a local database (text file) ;; $1 = nick alias nrg_quote { if ($1 == $null) { nrg_stdo quote_invalidQuote $me $1 } if (!$exists($mircdirquotesdb\ $+ $1 $+ .txt)) { return quote_noneExist } else { if (%nrg_quoteline_ [ $+ [ $1 ] ] >= $lines($mircdirquotesdb\ $+ $1 $+ .txt)) { unset %nrg_quoteline_ [ $+ [ $1 ] ] } inc %nrg_quoteline_ [ $+ [ $1 ] ] var %nrg_currentQuote [ $+ [ $1 ] ] $read($mircdirquotesdb\ $+ $1 $+ .txt, %nrg_quoteline_ [ $+ [ $1 ] ] ) return $readn %nrg_currentQuote [ $+ [ $1 ] ] $chr(40) $+ $rand(1,100) $+ $chr(41) } } on *:TEXT:!quote*:#:{ var %status [ $+ [ $nick ] ] $nrg_checkStatus($nick,$chan) if ((%status [ $+ [ $nick ] ] != false) && ($2 != $NULL) && (%status [ $+ [ $nick ] ] != quote_isBanned)) { var %return_value = $nrg_quote($2) if (%return_value == quote_noneExist) { .nrg_stdo quote_noneExist $nick $2 | halt } else { nrg_stdo quote_outputQuote $chan $2 %return_value } } } on *:INPUT:#:{ if ($1 == !quote) { var %return_value = $nrg_quote($2) if (%return_value == quote_noneExist) { .nrg_stdo quote_noneExist $me $2 | halt } else { nrg_stdo quote_outputQuote $chan $2 %return_value halt } halt } } ;; ############# nrg_stdo - This command consolidates all standard messages so that they can be easily modified from one spot. ;; $1 $2 $3 $4 ;; syntax: nrg_stdo <error_id> <recipient nick> <requested nick> (optional)<extra text> alias nrg_stdo { var %error_id = $1 var %recipient_nick = $2 var %requested_nick = $3 if (%recipient_nick == $me) { .alias /nrg_output .echo -a $chr(36) $+ 1- } else if (%recipient_nick ischan) { .alias /nrg_output /msg %recipient_nick $chr(36) $+ 1- } else { .alias /nrg_output .notice %recipient_nick $chr(36) $+ 1- } if ($1 == quote_addAllow) { nrg_output Added %requested_nick to the allowed list } else if ($1 == quote_addBan) { nrg_output Added %requested_nick to ban list! } else if ($1 == quote_Added) { nrg_output Successfully added quote: < $+ %requested_nick $+ > $4- } else if ($1 == quote_deleted) { nrg_output Deleted Quote $chr(35) $+ $4 for %requested_nick $+ : $5- } else if ($1 == quote_Exists) { nrg_output That quote already exists for %requested_nick $+ ! } else if ($1 == quote_invalidAddQuote) { nrg_output 4An invalid call was made to addquote. The correct syntax is /nrg_addquote <nick> <quote> } else if ($1 == quote_invalidQuote) { nrg_output 4An invalid call was made to quote. The correct syntax is /nrg_quote <nick> } else if ($1 == quote_invalidRemQuote) { nrg_output 4An invalid call was made to remquote. The correct syntax is /remquote <nick> <quoteid> } else if ($1 == quote_nickNotFound_inChan) { nrg_output Unable to find %requested_nick in $4 } else if ($1 == quote_noneExist) { nrg_output Database for %requested_nick does not currently exist! } else if ($1 == quote_notFound) { nrg_output Quote ID $4 not found for %requested_nick $+ ! } else if ($1 == quote_outputQuote) { nrg_output Famous quotes from %requested_nick $+ : ( $+ $chr(35) $+ $4 $+ ) $5- } else if ($1 == quote_remAllow) { nrg_output Removed %requested_nick from the allowed list } else if ($1 == quote_remBan) { nrg_output Removed %requested_nick from ban list! } .alias /nrg_output } ;; ############### RemQuote - Commands associated with removing quotes ;; $1 = nick ; $2 = quoteid alias nrg_remquote { if ($2 == $null) { nrg_stdo quote_invalidRemQuote $me $1 | halt } else { if (!$exists($mircdirquotesdb\ $+ $1 $+ .txt)) { return quote_noneExist } if ($lines($mircdirquotesdb\ $+ $1 $+ .txt) < $2) { return quote_notFound } else { var %quote $read($mircdirquotesdb\ $+ $1 $+ .txt,$2) .write -dl $+ $2 $mircdirquotesdb\ $+ $1 $+ .txt if ($lines($mircdirquotesdb\ $+ $1 $+ .txt) == 0) { .remove $mircdirquotesdb\ $+ $1 $+ .txt } ;; COMMENT: Remove database if nothing exists in the file return quote_Deleted %quote } } } on *:TEXT:!remquote*:#:{ var %status [ $+ [ $nick ] ] $nrg_checkStatus($nick,$chan) if ((%status [ $+ [ $nick ] ] != false) && ($3 != $NULL) && (%status [ $+ [ $nick ] ] != quote_isBanned)) { var %return_value $nrg_remquote($2,$3) if (%return_value == quote_noneExist) { .nrg_stdo quote_noneExist $nick $2 } else if (%return_value == quote_notFound) { .nrg_stdo quote_notFound $nick $2 $3 } else if (quote_deleted isin %return_value) { .nrg_stdo quote_deleted $nick $2 $3 $right(%return_value,-13) } } } Quote Link to comment Share on other sites More sharing options...