MSN bot (Beta)

Discussion in 'Programming General' started by Waffles, Dec 1, 2007.

MSN bot (Beta)
  1. Unread #1 - Dec 1, 2007 at 11:45 AM
  2. Waffles
    Referrals:
    4

    Waffles Guest

    MSN bot (Beta)

    I made this a while ago, but edited in some things.

    So here is a basic messenger bot. It only has a couple of features but
    this is only a quick writeup but even so it is easily modded
    and with this demo you may be able to work out how to do other things.

    ADD:
    a textbox 4 timers 2 buttons and a listbox

    Code:
    Public WithEvents msn As MsgrObject
    
    Private Sub Form_Load()
    Set msn = New MsgrObject
    timer1.enabled = true
    timer1.interval = 3500 'that time should stop messenger poping up annoying you cant change name messages
    command1.caption = "start"
    command3.caption = "start"
    End Sub
    
    
    '''''''''''''''''''''''''''''''''' Auto Responder ''''''''''''''''''''''''''''''''''
    
    Private Sub msn_OnTextReceived(ByVal pIMSession As Messenger.IMsgrIMSession, ByVal pSourceUser As Messenger.IMsgrUser, ByVal bstrmsgheader As String, ByVal bstrMsgText As String, pfEnableDefault As Boolean)
    
    Select Case bstrMsgText
    
    Case "[CSD]" 'if sum1 sends us this message then the bot will reply automaticly with the message below
    pSourceUser.SendText bstrmsgheader, "<bot> the duck aproaches", MMSGTYPE_ALL_RESULTS
    
    Case "lol"
    pSourceUser.SendText bstrmsgheader, "<bot> yes thats pretty funny", MMSGTYPE_ALL_RESULTS
    
    Case "hello"
    pSourceUser.SendText bstrmsgheader, "<bot> hello there", MMSGTYPE_ALL_RESULTS
    
    Case "good bye"
    pSourceUser.SendText bstrmsgheader, "<bot> goodbye", MMSGTYPE_ALL_RESULTS
    
    End Select
    
    End Sub
    
    
    ''''''''''''''''''''''''''''''''' MISC ''''''''''''''''''''''''''''''''''''''''''''''''
    
    Private Sub Timer2_Timer()
    msn.Services.PrimaryService.FriendlyName = text1.text 'change your name to text1.text
    End Sub
    
    
    '''''''''''''''''''''''''''''''' Spam sign in messages '''''''''''''''''''''''''
    
    Private Sub Timer3_Timer()
    if msn.LocalState = MSTATE_INVISIBLE then
    msn.LocalState = MSTATE_ONLINE
    else
    msn.LocalState = MSTATE_INVISIBLE
    end if 
    End Sub
    
    Private Sub Command1_Click()
    if command1.caption = "Start" then
    timer3.interval = 1
    timer3.enabled = true
    command1.caption = "stop"
    else 
    timer3,enabled = false
    command1.caption = "Start"
    End Sub
    
    '''''''''''''''''''''''''''''''''''''''''' Name Changer ''''''''''''''''''''''''''''''''''''''''''
    
    'now in the directory of your exe or your visual basic project
    'folder make a textfile called textnames and in it make a 
    'wordlist like this 
    '1
    '2
    '3
    '4
    '5
    'ect
    
    Private Sub Command2_Click()
    Dim filelocation As String
    Dim data As String
    filelocation = App.Path & "/textnames.txt"
    Open filelocation For Input As #1
    Do Until EOF(1)
    Input #1, data
    List1.AddItem data
    EOF (1)
    Loop
    Close #1
    End Sub
    
    Private Sub Timer4_Timer()
    Text2.Text = Text2.Text + 1
    List2.ListIndex = Text2.Text
    msn.Services.PrimaryService.FriendlyName = List1.Text
    End If
    End Sub
    
    Private Sub Command3_Click()
    if command3.caption= "Start" then
    timer4.enabled = true
    timer4.interval = 7000
    command3.caption = "Stop"
    else 
    timer4.enabled = false
    command3.caption = "start"
    end if
    End Sub
    
    Private Sub Command3_Click()
    form2.show
    End Sub
    
    So you want to make away messages, well here is how to
    add another form to the project and add this;

    Code:
    Public WithEvents msn As MsgrObject
    
    Private Sub Form_Load()
    Set msn = New MsgrObject
    End Sub
    
    Private Sub msn_OnTextReceived(ByVal pIMSession As Messenger.IMsgrIMSession, ByVal User As Messenger.IMsgrUser, ByVal bstrmsgheader As String, ByVal bstrMsgText As String, pfEnableDefault As Boolean)
    On Error Resume Next
    Select Case bstrMsgText
    Case "F" ' this is for no reason.
    Case Else
    User.SendText bstrmsgheader, "<bot>" & Text3.Text, MMSGTYPE_ALL_RESULTS
    End Select
    End Sub
    
    Private Sub Timer1_Timer()
    Text2.Text = Text2.Text + 1
    Text3.Text = "I Am Currently Away I Have Been Away For : " & Text2.Text & " MilliSeconds Because " & Text1.Text
    End Sub
    
    Simple, but effective.
     
  3. Unread #2 - Dec 1, 2007 at 1:57 PM
  4. Covey
    Joined:
    Sep 9, 2005
    Posts:
    4,510
    Referrals:
    9
    Sythe Gold:
    9
    Discord Unique ID:
    807246764155338833
    Discord Username:
    Covey#1816

    Covey Creator of EliteSwitch
    Retired Sectional Moderator Visual Basic Programmers

    MSN bot (Beta)

    you may want to include some credits.
     
< Random Password Generator | Password Protection tutorial >

Users viewing this thread
1 guest


 
 
Adblock breaks this site