User Control Panel
Advertisements

HELP US, HELP YOU!

VB BOT TUTORIAL
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Bot Depot Forum Index -> Visual Basic
View unanswered posts
Author Message
Riot
Newbie
Newbie


Joined: 09 Apr 2004
Posts: 39
Location: UK
Reputation: 26.1Reputation: 26.1Reputation: 26.1

PostPosted: Fri Apr 09, 2004 1:17 pm    Post subject: Reply with quote

Ok lets check that you have all these installed on your computer before we continue:

Visual Basic 6
Windows Messenger (Not MSN messenger)


Now lets start open up a new project in visual basic and then click

Project > Refrences

A checklist will appear with all the Active X programs scroll down and tick these boxes:

OLE automation
Messenger type library
Messenger API type library
Messenger AddIns type library
Messenger Private type library

And click OK

You have now made the MSN Active X files linked to your project, We have to use windows messenger instead of MSN because the new MSN doesnt have Active X control files.

now it is time for the source code of the bot click the form on the right and go to the source code screen and add this:

Code:
<br />Option Explicit<br />Public WithEvents msn As MsgrObject<br />Private Sub Form_Load()<br />Set msn = New MsgrObject<br />End Sub<br />


This will load the Msn program with your project not much to edit with this so i sugest keeping it this way.

Another small let down for Visual Basic MSN Bots is that it doesnt have many commands for responding to users:

Code:
<br />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)<br />


This section of code should be placed under the last section of code, this is setting the data sent from the user to your msn screen to the program, again not much to edit here so i sugest leaving it alone.

Code:
<br />If bstrMsgText = "hi" Then<br />     User.SendText bstrMsgHeader, "hello", MMSGTYPE_ALL_RESULTS<br />End If<br />


This is where you can start doing your own thing, this section of code lets you chose what messages you want the bot to reply to.

Code:
<br />If bstrMsgText = "hi" Then<br />


This is code checks to see if the user has sent "hi" as a message. if the user has it moves to this part of the code:

Code:
<br />     User.SendText bstrMsgHeader, "hello", MMSGTYPE_ALL_RESULTS<br />End If<br />


This makes the bot reply with "hello". You can then add more copies of this code into the form to make it respond to more words :

Code:
<br />If bstrMsgText = "??" Then<br />     User.SendText bstrMsgHeader, "why the ?", MMSGTYPE_ALL_RESULTS<br />End If<br />If bstrMsgText = "hello bot" Then<br />     User.SendText bstrMsgHeader, "Hi there", MMSGTYPE_ALL_RESULTS<br />End If<br />If bstrMsgText = "hello there" Then<br />     User.SendText bstrMsgHeader, "Welcome", MMSGTYPE_ALL_RESULTS<br />End If<br />


Now hopefully you have understood this code, lets make the the bot read a command and set its status to away:

Code:
<br />If bstrMsgText = "SetAway"Then<br />msn.LocalState = MSTATE_AWAY<br />End If<br />


The new bit of source code:

Code:
<br />msn.LocalState = MSTATE_AWAY<br />


Makes the bot change status to away,not much really to explain about it.
other status commands include:

BUSY :
Code:
<br />msn.LocalState = MSTATE_BUSY<br />


OFFLINE:
Code:
<br />msn.LocalState = MSTATE_INVISIBLE<br />


ONLINE:
Code:
<br />msn.LocalState = MSTATE_ONLINE<br />


ON THE PHONE:
Code:
<br />msn.LocalState = MISTATUS_ON_THE_PHONE<br />


OUT TO LUNCH:
Code:
<br />msn.LocalState = MISTATUS_OUT_TO_LUNCH<br />


BRB:
Code:
<br />msn.LocalState = MISTATUS_BE_RIGHT_BACK<br />


There are many more commands for msn with visual basic but need to run on a form and not commanded in a chat, if you want these commands anyway then just say so here Smile


I hope this has helped, The last bot i made in Visual Basic was almost 1 1/2 years ago so i dont know if there is any more easier ways to make vb bots or more commands or active X controls.


Thanks for reading :rolleyes: Smile
Back to top
night
Not Yet a God
Not Yet a God


Joined: 06 Jan 2004
Posts: 498

Reputation: 38.4Reputation: 38.4Reputation: 38.4Reputation: 38.4

PostPosted: Fri Apr 09, 2004 1:45 pm    Post subject: Reply with quote

looks like a pritty goodo tutorial Smile thankyou for posting Smile
Back to top
Keenie
Almost An Agent
Almost An Agent


Joined: 31 Oct 2003
Posts: 1071

Reputation: 52.4

PostPosted: Fri Apr 09, 2004 1:49 pm    Post subject: Reply with quote

To have more control, it would be better to just use the protocol instead of the apis, and msn 6s api is pretty useless but this stuff works for windows messenger 4.7

and instead of this
Quote:
If bstrMsgText = "??" Then
    User.SendText bstrMsgHeader, "why the ?", MMSGTYPE_ALL_RESULTS
End If
If bstrMsgText = "hello bot" Then
    User.SendText bstrMsgHeader, "Hi there", MMSGTYPE_ALL_RESULTS
End If
If bstrMsgText = "hello there" Then
    User.SendText bstrMsgHeader, "Welcome", MMSGTYPE_ALL_RESULTS
End If


you could use a select case which would be nicer

Code:
Select Case bstrMsgText<br />   Case "hello"<br />      'do something<br />   Case "bye"<br />      'do something else<br />End Select


mind you its been a long time since I've used vb, but i think that should work

theres some stuff on how to do different things here, like using the protocol ect,

http://msnfanatic.com/index.php?module=pag...MN_position=7:7
Back to top
Riot
Newbie
Newbie


Joined: 09 Apr 2004
Posts: 39
Location: UK
Reputation: 26.1Reputation: 26.1Reputation: 26.1

PostPosted: Fri Apr 09, 2004 2:33 pm    Post subject: Reply with quote

cheers, i also forgot to mention that you need to have a windows messenger open and a loged in user Smile cheers for your comments and add-ons to this tutorial its much appriciated Smile
Back to top
mat007
Almost An Agent
Almost An Agent


Joined: 12 Jan 2004
Posts: 1375

Reputation: 15.8Reputation: 15.8
votes: 2

PostPosted: Fri Apr 09, 2004 2:38 pm    Post subject: Reply with quote

I think the protocall is alot better my 1st bot used the winddows messanger api and vb is'nt as powerful thats why i learnt perl Smile
Back to top
Riot
Newbie
Newbie


Joined: 09 Apr 2004
Posts: 39
Location: UK
Reputation: 26.1Reputation: 26.1Reputation: 26.1

PostPosted: Fri Apr 09, 2004 5:05 pm    Post subject: Reply with quote

ya i agree, visual basic is rubbish when it comes to bots but i reckon it is the best programming tool for quick and simple applications. also msn flooders,pop up bombs + file transfers etc are easier than ever with it Smile
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Fri Apr 09, 2004 5:52 pm    Post subject: Reply with quote

They're easy in Perl too. B)
_________________
Current Site (2008) http://www.cuvou.com/
Back to top
Riot
Newbie
Newbie


Joined: 09 Apr 2004
Posts: 39
Location: UK
Reputation: 26.1Reputation: 26.1Reputation: 26.1

PostPosted: Fri Apr 09, 2004 5:56 pm    Post subject: Reply with quote

ya and that lol Razz
Back to top
mikeo
Newbie
Newbie


Joined: 07 May 2005
Posts: 38
Location: Amsterdam, The Netherlands
Reputation: 12.9

PostPosted: Sat May 07, 2005 4:20 pm    Post subject: Reply with quote

Hi,
I've looked at this tutorial and used it.. now i have this:

Code:
I REMOVED IT CUZ IT'S MINE :P


But if someone says Hey to me I don't awnser automatic.> Can anyone help me with that?

Hope so..

Allready thanks Smile

~mikeo
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Sat May 07, 2005 5:42 pm    Post subject: Reply with quote

This tutorial is for making a BOT, not an MSN plug-in. The bot should have its own name and password to sign on with, and you can't be signed onto that name at the same time the bot is.

It's not like an auto-responder for you. It's a bot. If you want it to be an auto-responder, you'll have to sign it on with your MSN name and password, but you won't be able to be on MSN while the bot is on, MSN will sign you out. So it's either you are on, or your bot is on, but not at the same time (so it's not an autoresponder Razz ).

If you want an autoresponder just look on http://mess.be/ or download Messenger Plus.

edit
this might actually be a plug-in. I dunno, I don't do VB, it's too Englishy. Razz So you can just disregard this post if I'm giving you the wrong info. Wink

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
mikeo
Newbie
Newbie


Joined: 07 May 2005
Posts: 38
Location: Amsterdam, The Netherlands
Reputation: 12.9

PostPosted: Sat May 07, 2005 7:00 pm    Post subject: Reply with quote

Yes I know, i'm making a bot.. but if this didn't want to work allready Razz

Now i'm busy making a layout for admin and games and lots more Smile

EDIT AGAIN: And it didn't work cuz you have to login on Windows Messenger to let the bot do it's work Razz
Back to top
alienz
Almost An Agent
Almost An Agent


Joined: 22 Mar 2004
Posts: 1436
Location: Mars
Reputation: 55.7

PostPosted: Tue May 10, 2005 7:43 pm    Post subject: Reply with quote

Taking a look at the current Client Type library for Messenger in .NET shows a ton of methods and events. You should be able to most of what you want, including login. You can also do add-in APIs. http://msdn.microsoft.com/library/default....enger_entry.asp

I'm currently writing a .NET based bot that uses AOL.

_________________
Check out Botworld! A dev resource for things bot.
Downloads, articles, news, fourm and more.
http://botworld.marzopolis.com
Back to top
mikeo
Newbie
Newbie


Joined: 07 May 2005
Posts: 38
Location: Amsterdam, The Netherlands
Reputation: 12.9

PostPosted: Wed May 11, 2005 10:11 am    Post subject: Reply with quote

Ok, i've been there before and i'll have a look ionce I get enough time =] Thanks =]
Back to top
trotter
Newbie
Newbie


Joined: 09 Oct 2005
Posts: 6

Reputation: 7.1Reputation: 7.1Reputation: 7.1Reputation: 7.1Reputation: 7.1Reputation: 7.1Reputation: 7.1

PostPosted: Sun Oct 09, 2005 1:29 pm    Post subject: Reply with quote

Do you know how to get the contact name ?
I think it was stored in "User" (User As Messenger.IMsgrUser ), but i got an error when i try to get it.

How can i know who is talking to my bot ?
Back to top
trotter
Newbie
Newbie


Joined: 09 Oct 2005
Posts: 6

Reputation: 7.1Reputation: 7.1Reputation: 7.1Reputation: 7.1Reputation: 7.1Reputation: 7.1Reputation: 7.1

PostPosted: Fri Oct 14, 2005 3:04 pm    Post subject: Reply with quote

I found it, here it is :

[code]
Private Sub msn_OnTextReceived(ByVal pIMSession As Messenger.IMsgrIMSession, _
ByVal User As Messenger.IMsgrUser, ByVal bstrMsgHeader As String, _
ByVal Usersay As String, pfEnableDefault As Boolean)

MsgBox User.FriendlyName & vbLf & User.EmailAddress & vbLf & User.LogonName

End Sub
[code]

Wink[/code]
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Visual Basic All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group