📜 ⬆️ ⬇️

Simple bot for Skype on C ++ Qt (ActiveX)

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.

image

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:

')

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:

image

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.ru
Link to source code on github.com
SkypeBot link
The only detailed documentation for SkypeApi written for visual basic

Source: https://habr.com/ru/post/248101/


All Articles