safe-vk
Simple library with simple API for creating your own VK bot for conversations in Rust 🦀
Current State
This library is new and is not maintained every day with 1000 commits, so there is only few functions right now:
- Has
replyfor sending messages to the chat, see more in examples - Also there is
commandandwatchmethods, the first one is for listening your custom command, andwatchis listening all updates from VK. - Only Long Poll is supported right now
- Provides a
get_usersfunction for fetching detailed information about users, and aget_membersfunction for retrieving a list of conversation participants - But these functions are enough to create a simple bot
Future planning
- Improving asynchronous code
- Adding more functions
- Simplifying and cleaning up the code, as it's somewhat disorganized at the moment
Prerequisites
Ensure you have Rust stable version 1.75.0 or nightly version 1.77.0 installed. This library is tested and compatible with these versions
Overview
- Works with API version 5.199
- Utilizes threads for faster responses
- has serde_json, tokio and reqwest under the hood
Installation
Greeting
use ;
use env;
async
async
More Examples
For more, see examples. To run an examples, use the following commands in your terminal:
$ GROUP_ID=YOUR_GROUP_ID TOKEN=YOUR_TOKEN cargo run --example reply
$ GROUP_ID=YOUR_GROUP_ID TOKEN=YOUR_TOKEN cargo run --example keyboard
$ GROUP_ID=YOUR_GROUP_ID TOKEN=YOUR_TOKEN cargo run --example members
But don't forget to include your token and group ID
Motivation
My primary goal with this project is to learn how to work with asynchronous code. This project is heavily inspired by the axum crate, and I am also eager to delve deeper into Rust's strong, safe type system. While I'm not actively seeking broad contributions at this time, I warmly welcome bug fixes and creative ideas to enhance the project. Updates will be made as I have motivation and free time.
License
safe-vk is available under the MIT license. See the MIT License file for more details