Skip to main content

Module for creating VK bots...

Project description

Quanario_VK - Module for the development of chatbots in the social network VKontakte

Logo

Table of contents

Introduction

    In 2019, I wanted to make a chatbot for learning foreign languages, I do not know exactly why, but I really wanted to. But I liked the idea that you can make some kind of resource that is accessed through a messenger. In general, in my opinion, resources should be divided into two types: exclusively informational and design. For example, I would refer Wikipedia or the library's website to the informational ones, and an online store, a website apple.com to the design. This approach organizes resources according to their purpose.
    To create my own bot, I began to study the Internet for what and how to do. Of course, the first thing I came across was instructions for creating bots in telegram. But only in my opinion telegram is already overloaded with all kinds of bots and, unfortunately, does not have the resources to popularize the group with the exception of paid advertising in other groups.
    Later, I came across the vk_api library from python273. I liked it for its simplicity and convenience. Having added my own features to the project code, I implemented the project LinguisticBot.
    But as the project developed and scaled, I realized that the current capabilities of the library are not enough and it needs quite serious refinement. Therefore, in the format of a pet project, I decided to bring it to mind! Now, this project is a serious rethinking of the principles of the original library, as well as the appearance of new features:

  • clear typing,
  • castomisation,
  • asynchrony,
  • adequate operation of the keyboard,
  • the appearance of the carousel object,
  • the ability to receive and process attachments from the user (including geo-location)
  • and much more!

Project structure

|->quanario - root folder of the project.
     в€џ bot.py - the main class of the module. Learn more.
     в€џ send.py - class for sending messages and attachments to the user. Learn more.
     в€џ upload.py - class for uploading attachments to the VKontakte server. Learn more.
     |-> message_extensions
         в€џ carousel.py - class that implements the functionality of the carousel element. Learn more.
         в€џ keyboard.py - class that implements the functionality of the keyboard element. Learn more.
     |-> input_message
         в€џ message.py - main class for processing messages from the user, including attachments. Learn more.
         в€џ voice.py - class for working with attachments of the voice message type. Learn more.
         в€џ audio.py - class for working with attachments of the audio or music types. Learn more.
         в€џ photo.py - class for working with attachments of the photo type. Learn more.
         в€џ video.py - class for working with attachments of the video type. Learn more.
         в€џ file.py - class for working with attachments of the file or document types. Learn more.
         в€џ geoposition.py - class for working with attachments of the geo type. Learn more.
     |-> user
         в€џ user.py - main class for processing user information. Learn more.
         в€џ career.py - class with information about fields from the Career section. Learn more.
         в€џ contacts.py - class with information about fields from the Contacts section. Learn more.
         в€џ counters.py - class with information about the number of different objects the user has. Learn more.
         в€џ interests.py - class with information about fields from the Interests section. Learn more.
         в€џ last_seen.py - a class with information about the user's last visit. Learn more.
         в€џ lifeposition.py - class with information about fields from the Life position section. Learn more.
         в€џ military.py - class with information about fields from the Military section. Learn more.
         в€џ occupation.py - class with information about the user's current occupation. Learn more.
         в€џ params.py - class with information about fields from the Params section. Learn more.
         |-> education
             в€џ education.py - main class for processing user information about his education. Learn more.
             в€џ schools.py - class with information about which schools the user attended. Learn more.
             в€џ universities.py - class with information about which universities the user attended. Learn more.


Installation

Will be soon... But for now, you can just add the quanario folder to the root of your project and use it as a regular library.

Usage

To start development, you need to install the module (see the installation section) and import it into your project. An example of the simplest echo bot:

See an example

from quanario.bot import *


def send_keyboard(bot: Bot, message: Message, args: tuple = None):
    pass

TOKEN = "*YOUR TOKEN*"
APP_ID = 000000000

bot = Bot(token=TOKEN, app_id=APP_ID)
bot.run(init_method=send_keyboard)

You also have the opportunity to get acquainted with other, more complex examples, to do this, follow one of the links below.
|-> Echo
     в€џ To view the text example, click here.
     в€џ To view the audio example, click here.
     в€џ To view the photo example, click here.
     в€џ To view the video example, click here.
     в€џ To view the file example, click here.
|-> Keyboard
     в€џ To view the keyboard example, click here.
|-> Carousel
     в€џ To view the carousel example, click here.
|-> Geoposition
     в€џ To view the geoposition example, click here.

Demo

LinguisticBotLogo

As an example, I can demonstrate the community on VKontakte - LinguisticBot. This is my community for learning foreign languages for everyone. It implements all the modules of this educational school website. The bot provides 6 types of interactive tasks to increase the user's vocabulary, as well as an audition task. In addition, as an example, a store has been implemented in which you can buy tips and sections with listening. This project has been running nonstop for 2 years. During this period, a huge number of bugs and bugs in the library have been fixed Quanario_VK

FAQ

I'm just launching this project, but if you have any questions, you can always ask in issues or in our telegram chat or VKontakte group.

License

СЃСЃ-nc-by-license

CC-BY-NC and commercial usage available after agreement with Quanario_VK authors.

Commerical inquiries

Further reading

Will be soon...

Alternatives

Of course, I'am not the first to decide to make a library for ourselves, so I give alternatives, perhaps you will find them more convenient for yourself:

I believe that using my development will be pleasant for you!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quanario-1.0.3.tar.gz (14.8 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page