Clan x86

Technical (Development, Security, etc.) => General Programming => New Project Announcements => Topic started by: Joe on September 19, 2005, 11:52:34 PM

Title: AmeeVB
Post by: Joe on September 19, 2005, 11:52:34 PM
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.
Title: Re: AmeeVB
Post by: Newby on September 20, 2005, 01:13:57 AM
amee owns your soul.
Title: Re: AmeeVB
Post by: Joe on September 20, 2005, 06:52:02 PM
I'm using my PHP backend now.

http://www.javaop.com/~joe/ameevb/AmeeVB.php <-- Quotes file.
Title: Re: AmeeVB
Post by: Joe on September 20, 2005, 07:18:53 PM
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.
Title: Re: AmeeVB
Post by: rabbit on September 20, 2005, 09:29:37 PM
Use a socket.  Socket > (Inet * infinity plus one)
Title: Re: AmeeVB
Post by: Joe on September 20, 2005, 09:45:27 PM
omg. Please don't plant logic bombs. =p
Title: Re: AmeeVB
Post by: Warrior on September 21, 2005, 06:47:09 PM
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.
Title: Re: AmeeVB
Post by: Joe on September 22, 2005, 12:06:05 AM
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