ICQ/VK Teams Bot API interface
Project description
Async ICQ/VK Teams bot API wrapper
Pure Async Python interface for Bot API.
Table of contents
Introduction
This library provides complete ICQ/Myteam Bot API 1.0 interface and requires Python 3.5+
Quick start
- Create your own bot by sending the /newbot command to Metabot and follow the instructions.
Note: a bot can only reply after the user has added it to his contact list, or if the user was the first to start a dialogue.
- You can configure the domain that hosts your ICQ server. When instantiating the Bot class, add the address of your domain.
Example: Bot(token=TOKEN, url="https://api.icq.net"), by default we use the domain: https://api.icq.net/bot/v1 (ICQ) or http://myteam.mail.ru (VK Teams)
Installing
Install using pip:
pip install -U async-icq
Install from sources:
git clone https://github.com/dasshit/async-icq.git
cd async-icq
python setup.py install
Examples
Basic example of using this library will look like this
from async_icq.bot import AsyncBot
from async_icq.events import Event
# Creating bot
example = AsyncBot(
token='TOKEN',
url='https://api.icq.net',
)
# Adding some basic event handler by decorators (handler must accept 2 arguments: bot and event)
# Diffent decorators will set it up for diffent types of events
@example.message_handler()
async def hello(bot: AsyncBot, event: Event):
await bot.send_text(
chatId=event.chat.chatId,
text=f'Hi, {event.from_.userId}'
)
await bot.logger.debug(
f'Answered to {event.chat.chatId} to {event.from_.userId}')
# Starting to poll new events and sending them to middleware and handlers
example.start_poll()
Example of how to use this library could be found in async-icq/examples
API description
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
async_icq-1.1.5.tar.gz
(15.7 kB
view hashes)
Built Distribution
async_icq-1.1.5-py3-none-any.whl
(14.4 kB
view hashes)
Close
Hashes for async_icq-1.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fffa24d72462ab0e7ce86a7209a0acba22d6db1e1b7f998017410a37e9e20abf |
|
MD5 | 7bb15f30083fd2f77ec69cfdb31200bc |
|
BLAKE2b-256 | a6daf8cbda61a1ac45761dae6e6257415be6b7f678999ce7b56b09ffd2378caf |