A rip of xar's perl quotebot, amee. Basically, it just takes down quotes, and then coughs them back up. Right now, it stores them in an array within the bot. What I'm planning to do is store them to a file, or perhaps even write a PHP backend, and make them accessable from a webpage too. Oh yeah, its for IRC.
If you want to check it out, one is running in irc.tehnetwork.org #beta right now. Commands are..
.quote <quote to add>
.rand
EDIT -
The way its set up, it will RTE on the 1025th quote (Subscript out of range), so take it easy.
amee owns your soul.
I'm using my PHP backend now.
http://www.javaop.com/~joe/ameevb/AmeeVB.php <-- Quotes file.
xar made me change the bots name on IRC. Its running as QuoteBotVB right now.
QuoteJoe: .quote Testing new quotes system.
QuoteBotVB: <Joe:#beta> Testing new quotes system.
Now uses the PHP backend, as I said, which shouldn't be getting clobbered with my testing crap anymore. Basically, its finished. Time to clean it up and release it.
EDIT -
QuoteQuoteBotVB: RTE 35764 (Still executing last request) in module modQuotes of prjAmeeVB.
RTE my Inet control please.
Use a socket. Socket > (Inet * infinity plus one)
omg. Please don't plant logic bombs. =p
You set a limit on your quote array? Bad boy.
No idea if it's possible since I havn't done VB in about a month but try this:
Loading a file and parsing the quotes THEN determining the size of the array you want to make
that way you eliminate the RTE and the nasty limit.
Anyways yea, bacon.
I only limited it because it was a tossed together piece of crap to show newby I could do it. Since then, I've cleaned it up.
modCommands
Option Explicit
Public Sub Command(S As String, Username As String, Channel As String)
Dim Splt() As String: Splt() = Split(S, " ")
Select Case Splt(0)
Case modConstants.Trigger & "quote"
Call modquotes.addQuote(Mid(S, 8), Username, Channel)
Case modConstants.Trigger & "random"
Call frmMain.sckIRC.SendData("PRIVMSG " & modConstants.Channel & " :" & modquotes.randQuote & vbCrLf)
Case modConstants.Trigger & "say"
Call frmMain.sckIRC.SendData("PRIVMSG " & modConstants.Channel & " :" & Username & ": " & Mid(S, 6) & vbCrLf)
End Select
End Sub
modQuotes
Option Explicit
Public Sub addQuote(S As String, sUsername As String, sChannel As String)
On Error GoTo addQuote_Error
'no url for you
Dim Quote As String: Quote = "<" & sUsername & ":" & sChannel & "> " & S
Call frmMain.inetPHP.OpenURL("no url for you" & Encode(Quote))
Call frmMain.sckIRC.SendData("PRIVMSG " & modConstants.Channel & " :" & sUsername & ": Quote added - " & Quote & vbCrLf)
Exit Sub
addQuote_Error:
Call frmMain.sckIRC.SendData("PRIVMSG " & modConstants.Channel & " :" _
& "RTE " & Err.Number & " (" & Err.Description & ") in module addQuotes of prjAmeeVB." & vbCrLf)
End Sub
Public Function randQuote() As String
On Error GoTo randQuote_Error
Randomize
Dim Splt() As String: Splt = Split(frmMain.inetPHP.OpenURL("http://www.javaop.com/~joe/ameevb/AmeeVB.php"), vbLf)
randQuote = Splt(Int(Rnd * (UBound(Splt))) + 1)
Exit Function
randQuote_Error:
Call frmMain.sckIRC.SendData("PRIVMSG " & modConstants.Channel & " :" _
& "RTE " & Err.Number & " (" & Err.Description & ") in module modQuotes of prjAmeeVB." & vbCrLf)
End Function