How to make a Skype Auto reply bot 03-24-2013, 01:23 PM
#1
In this tutorial I will show you how to make a skype auto reply bot in vb.net. This is very easy to make if you just follow along.
For this you need the skype4com.dll and library.
Make sure to add them ^^ as a reference.
Here is the fully commented code that you should read and write to your project:
When you run it you should get this thing requesting permission on skype, accept it.
![[Image: 2n37M]](http://puu.sh/2n37M)
Here's it in action.
For this you need the skype4com.dll and library.
Make sure to add them ^^ as a reference.
Here is the fully commented code that you should read and write to your project:
Code:
Imports SKYPE4COMLib
Imports System.Windows.Forms
Public Class Form1
Private skype As Skype
Dim trigger As String = "msg=" 'use this as the command.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
skype = New Skype 'put's skype as a new skype
skype.Attach() 'attaches our program to skype.
AddHandler skype.MessageStatus, AddressOf skype_stat
End Sub
Public Sub skype_stat(ByVal msg As ChatMessage, ByVal status As TChatMessageStatus)
If msg.Body.Contains(trigger) Then 'if it has the trigger.
Dim sendme As String = msg.Body.Replace(trigger, "") 'removes the trigger from the message. for example if the message was "msg=sunlight", the it would be "sunlight"
skype.SendMessage(msg.Sender.Handle, cases(sendme)) 'sends message.
End If
End Sub
Public Function cases(ByVal sent As String)
Dim result As String
Select Case sent
Case Is = "hello" 'if the msg received is hello
result = "hey" ' then send hey.
Exit Select
Case Is = "help" 'if the msg received is help
result = "Sorry, no help available." ' then send this.
Exit Select
Case Is = "who" 'if the msg received is 'who'
result = "this is Your Name's auto reply bot" 'the message sent will be this.
Exit Select
'add as many cases as you can, the more cases, the better.
Case Else
result = "Not a valid command"
End Select
Return result
End Function
End Class
When you run it you should get this thing requesting permission on skype, accept it.
Here's it in action.