mIRC Quotes Bot

By Xenolithic on Jul 25, 2010

This is my first publicly released code for a quotes bot.

I've set it up so it's only allowed to be used in one channel.

YOU NEED TO EDIT SOME THINGS:

  1. On line 2, please edit the "NETWORK_HERE" to the name of the network you will be using the quotes bot on. (The window it opens when it connects is for command logging.)

  2. On line 39, please edit the "MASK_TYPE_HERE" to one of the mask types. I used 10. (!ident@host)
    Also on line 39, please edit the "HOST_HERE" to the "owner" of the quotes bot. (Again,
    !ident@host - Example: *!xeno@localhost)

  3. On line 107, please edit "CHANNEL_HERE" to either $chan, or the actual channel you'll be using the quotes bot on. (Examples: $chan or #lounge)

COMMANDS:

!addquote [text] (Adds a quote.)

!fdelete [#] ("Owner" may force delete a quote even if they are not the author.)

!delquote [#] (The actual author of a quote may delete their own quotes.)

!quote [#] (A quote number is not required. If one is not specified, it will choose a random quote.)

!quotes (Tells a user how many total quotes there are. This will not be accurate if a user or the "owner" deletes a quote, as the .ini topics will not be renumbered.)

!random (Chooses a random quote.)

!quoteinfo [#] (Displays the date and time the quote was added, and the author of the quote.)

!findquote [text] (Checks if there is are quotes with the specified text. If there are, display the quote number.)


EXAMPLES:

<@Xenolithic> !addquote one, two, three

Added quote: one, two, three - <@Xenolithic> !fdelete 31 Quote 31 has been forcefully deleted by Xenolithic - <@Xenolithic> !delquote 32 Quote 32 has been deleted by Xenolithic - <@Xenolithic> !quote 5 Quote 5: (%NICK_NOT_DISPLAYED) Monty Python is funny as hell! - <@Xenolithic> !random Random quote: [19:44] * NICK_NOT_DISPLAYED is now known as Chocolate | [19:44] <+Chocolate> OMNOM ON ME | [19:44] <~NICK_NOT_DISPLAYED> chocolate omnom - <@Xenolithic> !quoteinfo 5 Quote 5 was stored in #lounge on 07/07/2010 at 06:43:37 by NICK_NOT_DISPLAYED - <@Xenolithic> !findquote an "an" was found in quote(s): | 1 | 3 | 6 | 9 | 11 | 13 | 14 | 15 | 18 | 19 | 20 | 25 | ------------------------------------------- I know I could've gone about the !findquote, !fdelete, and !delquote functions a bit better, but this is what I know how to do at the moment. I am open to suggestions to improve this, and I encourage them! Thanks for taking a look and I hope you enjoy. Regards, Xenolithic. :D ```mirc on *:connect: { if ($network == NETWORK_HERE) { window -k0 @commands } } on *:text:*:#: { ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; ; Quotes ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; if (!addquote == $1) { aline -p @commands ( $+ $day $+ @ $+ $time $+ ) $nick used $1 ( $+ $1- $+ ) if ($2 != $null) { if ($numtok($2-,32) < 3) { msg $chan $nick $+ : Your quote must be more than 3 words } else { var %topic = $ini(quotes.ini,0) + 1 writeini quotes.ini %topic quote $2- writeini quotes.ini %topic author $nick writeini quotes.ini %topic date $date writeini quotes.ini %topic time $time msg $chan Added quote: $2- } } else { msg $chan $nick $+ : It's not a quote if there's no text } } elseif (!fdelete == $1) { aline -p @commands ( $+ $day $+ @ $+ $time $+ ) 4 $+ $nick used $1 ( $+ $1- $+ ) if ($2 != $null) { if ($2 isnum) { if ($readini(quotes.ini, $2, author) != $null) { if ($address($nick,MASK_TYPE_HERE) == HOST_HERE) { writeini quotes.ini $2 quote Quote $2 has been forcefully deleted by $nick msg $chan Quote $2 has been forcefully deleted by $nick } else { msg $chan $nick $+ : You do not meet the required hostmask to use this command } } else { msg $chan $nick $+ : No such quote to delete } } else { msg $chan $nick $+ : Specify a number, silly } } } elseif (!delquote == $1) { aline -p @commands ( $+ $day $+ @ $+ $time $+ ) $nick used $1 ( $+ $1- $+ ) if ($2 != $null) { if ($2 isnum) { if ($readini(quotes.ini, $2, author) == $nick) { writeini quotes.ini $2 quote Quote $2 has been deleted by $nick msg $chan Quote $2 has been deleted by $nick } else { msg $chan $nick $+ : You're not the author of that quote - Type !quoteinfo $2 to see who is } } else { msg $chan $nick $+ : Incorrect syntax - Example: !delquote 4 } } } elseif (!quote == $1) { aline -p @commands ( $+ $day $+ @ $+ $time $+ ) $nick used $1 ( $+ $1- $+ ) if ($2 != $null) { if ($readini(quotes.ini, $2, author) == $null) { msg $chan There is no quote $2 } else { msg $chan Quote $2 $+ : $readini(quotes.ini, n, $2, quote) } } else { msg $chan Random quote: $readini(quotes.ini, n, $rand(1,$ini(quotes.ini,0)), quote) } } elseif (!quotes == $1) { aline -p @commands ( $+ $day $+ @ $+ $time $+ ) $nick used $1 if ($ini(quotes.ini,0) > 1) { msg $chan There are currently $ini(quotes.ini,0) quotes } else { msg $chan There is currently $ini(quotes.ini,0) quote } } elseif (!random == $1) { aline -p @commands $nick used $1 msg $chan Random quote: $readini(quotes.ini, n, $rand(1,$ini(quotes.ini,0)), quote) } elseif (!quoteinfo == $1) { aline -p @commands ( $+ $day $+ @ $+ $time $+ ) $nick used $1 ( $+ $1- $+ ) if ($2 != $null) { if ($readini(quotes.ini, $2, author) == $null) { msg $chan There is no quote $2 } else { msg $chan Quote $2 was stored in CHANNEL_HERE on $readini(quotes.ini, $2, date) at $readini(quotes.ini, $2, time) by $readini(quotes.ini, $2, author) } } else { msg $chan Please specify a quote number you'd like to look up the info for } } elseif (!findquote == $1) { aline -p @commands ( $+ $day $+ @ $+ $time $+ ) $nick used $1 ( $+ $1- $+ ) var %x = 0 while (%x <= $ini(quotes.ini,0)) { if ($2- isin $readini(quotes.ini, %x, quote)) { set %quotes %quotes + %x } inc %x } if ($replace($replace(%quotes, +, |), |, $null) == $null) { msg $chan " $+ $2- $+ " was not found in any quotes unset %quotes } else { msg $chan " $+ $2- $+ " was found in quote(s): $replace(%quotes, +, |) $chr($asc(|)) unset %quotes } } } ```

Comments

Sign in to comment.
Farcrada   -  Aug 02, 2013

It's not working on my end.
"* /aline: invalid window (line 8, script2.ini)

  • /aline: invalid window (line 66, script2.ini)
  • /aline: invalid window (line 66, script2.ini)
  • /aline: invalid window (line 27, script2.ini)"
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.