Hello! Recently, out of boredom wrote a Skype bot. I decided to share, maybe the source code will be useful to anyone, and the bot itself.

In the post, I will not be bored with stories about the code, since in the source code everything can be clearly seen and understood what is happening by the names of variables, classes, methods and comments.
The program implemented some features:
- Connecting to the Skype COM server
- Disconnecting from the Skype COM server
- Start skype
- Skype closure
- Dictionary updates without rerunning the program “Dictionary-> Reread”
- The choice of chats in which the dialogue “Chats-> List of chats” will go
- Minimizes to system tray
')
For the program to work, you need a config.xml file which must be located in the same directory as the exe program.
Skype Bot Setup
To save the settings you need a config.xml file, which must be located in the same directory as SkypeBot.exe. This file contains both the dictionary for the bot and its settings:
The structure of config.xml is as follows:
<?xml version="1.0" encoding="UTF-8"?> <main> <t reg="(|)"> <reply></reply> <reply></reply> <reply></reply> </t> <t reg="( | )"> <reply>, ?</reply> <reply></reply> </t> <namechat>#cj1900/$e9e3e97f93c86546</namechat> </main>
The
t tag contains the key to which the bot will respond and the responses themselves.
The key is stored in the tag attribute
t and is called
reg . Inside the
reg tag are stored words enclosed in brackets and written through the symbol
| . When someone writes messages in a chat, the bot finds one of the words in the key and, if there are matches, answers it with a random phrase enclosed by the
reply tag.
Keys like answers can be any number.
Next is the
namechat tag. The name of the chat is stored there, the program itself edits it, it contains the name of the chats in which you want to have a dialogue with the bot.
Here is the chat selection window:

Unfortunately, for some reason, Skype does not always show all chats via ActiveX, I could not solve this problem.
File Links
Link to source on disk.yandex.ruLink to source code on github.comSkypeBot linkThe only detailed documentation for SkypeApi written for visual basic