safe-vk
Simple library with simple API for creating your own VK bot for conversations in Rust 🦀
Current State
This library doesn't include all VK API methods. For now, it can handle simple tasks such as sending messages, getting users from a conversation, and sending photos.
Future planning
- Improving asynchronous code
- Support more VK API methods
- More tests
- Documenting code
- Simplifying code
Prerequisites
Ensure you have Rust stable version 1.78.0 or nightly version 1.80.0 installed. This library is tested and compatible with these versions.
Overview
- Works with newest API version 5.199
- Utilizes
routessame as in popular web frameworks - has serde_json, tokio and reqwest under the hood
Installation
Greeting
use ;
use env;
async
async
More Examples
For more, try to play with examples. To run an example, use the following command 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 comfyui
$ GROUP_ID=YOUR_GROUP_ID TOKEN=YOUR_TOKEN cargo run --example oobabooga
$ GROUP_ID=YOUR_GROUP_ID TOKEN=YOUR_TOKEN cargo run --example macros
$ GROUP_ID=YOUR_GROUP_ID TOKEN=YOUR_TOKEN cargo run --example keyboard
$ GROUP_ID=YOUR_GROUP_ID TOKEN=YOUR_TOKEN cargo run --example members
$ GROUP_ID=YOUR_GROUP_ID TOKEN=YOUR_TOKEN cargo run --example state
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 and understand Rust's strong, safe type system. This project is heavily inspired by the axum crate. Feel free to contribute and propose new ideas! 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