;Begin the new quotes section
;Need to add permission levels to all of these commands.
;Format: !quoteread (numberofquote)
;Reads out the quote by number requested and then checks to see if it is existing.
;Currently works!
on *:text:!quoteread *:#: {
if ((%floodquote) || ($($+(%,floodquote.,$nick),2))) { return }
set -u30 %floodquoteOn
set -u60 %floodquote. $+ $nick On
if ($2 <= %quoteID) {
var %user = $readini(%newquoteFile, n, $2, user)
var %date = $readini(%newquoteFile, n, $2, date)
var %quote = $readini(%newquoteFile, n, $2, quote)
var %game = $readini(%newquotefile, n, $2, game)
msg $chan Quote $chr(91) $+ $chr(35) $+ $2 $+ $chr(92) $+ %quoteID $+ $chr(93) added by %user on %date while playing %game - $chr(34) $+ %quote $+ $chr(34)
}
else {
msg $chan Quote does not exist $nick
}
}
;Format: !qlines
;Reads the %quoteID to get the current quote count
;Currently works!
on *:TEXT:!qlines:#: {
if ((%floodquote) || ($($+(%,floodquote.,$nick),2))) { return }
set -u10 %floodquoteOn
set -u30 %floodquote. $+ $nick On
msg $chan Total number of quotes: %quoteID
}
;Format: !qlast
;Reads the last quote of the file and displays it.
;Currently works!
on *:TEXT:!qlast:#: {
if ((%floodquote) || ($($+(%,floodquote.,$nick),2))) { return }
set -u10 %floodquoteOn
set -u30 %floodquote. $+ $nick On
var %user = $readini(%newquoteFile, n, %quoteID, user)
var %date = $readini(%newquoteFile, n, %quoteID, date)
var %quote = $readini(%newquoteFile, n, %quoteID, quote)
var %game = $readini(%newquotefile, n, %quoteID, game)
msg $chan Quote $chr(91) $+ $chr(35) $+ %quoteID $+ $chr(92) $+ %quoteID $+ $chr(93) added by %user on %date while playing %game $+ $chr(34) $+ %quote $+ $chr(34)
}
; Format: !addQuote (quote text)
;This will add the quote with the date/username/game
;Currently works!
on @*:text:!addQuote*:#: {
var %user = $nick
var %date = $chr(91) $+ $adate $+ $chr(93)
var %quote = $2-
;This will be evaluated using json
jsonopen -ud game https://api.twitch.tv/kraken/channels/dreadfullydespized
var %game = $chr(91) $+ $json(game,game) $+ $chr(93)
jsonclose game
;create a portion that checks to see if the quote already exists (not done yet)
writeini -n %newquoteFile $calc(%quoteID + 1) user %user
writeini -n %newquoteFile $calc(%quoteID + 1) date %date
writeini -n %newquoteFile $calc(%quoteID + 1) quote %quote
writeini -n %newquoteFile $calc(%quoteID + 1) game %game
msg $chan /me Quote $calc(%quoteID + 1) is from %user while playing %game during %date saying %quote
inc %quoteID
}