Skip to main content

vk_bot_api/
lib.rs

1//! # VK Bot API for Rust
2//!
3//! A modern, asynchronous, fully-featured VK Bot API library for Rust.
4//!
5//! ## Features
6//!
7//! - Full VK Bot API coverage
8//! - Async/await support
9//! - Strongly typed models
10//! - Extensible handler system
11//! - Multiple update delivery methods (Long Poll, Webhooks)
12//! - Support for all attachment types
13//! - Inline keyboards and callbacks
14//! - Error handling and retries
15
16// #![warn(missing_docs)]
17#![allow(missing_docs)]
18#![warn(rust_2018_idioms)]
19
20// Все модули всегда доступны
21pub mod api;
22pub mod bot;
23pub mod error;
24pub mod handler;
25pub mod keyboard;
26pub mod models;
27pub mod utils;
28
29/// Prelude module for convenient imports
30pub mod prelude {
31    /// Re-export bot module types
32    pub use crate::bot::{VkBot, VkBotBuilder};
33
34    /// Re-export api module types
35    pub use crate::api::{VkApi, VkApiBuilder};
36
37    /// Re-export models
38    pub use crate::models::*;
39
40    /// Re-export keyboard
41    pub use crate::keyboard::*;
42
43    /// Re-export handler
44    pub use crate::handler::*;
45
46    /// Re-export error
47    pub use crate::error::*;
48
49    /// Re-export utils
50    pub use crate::utils::*;
51}
52
53// Re-exports
54pub use api::VkApi;
55pub use bot::VkBot;
56pub use error::{VkError, VkResult};
57pub use handler::{DefaultMessageHandler, MessageHandler};
58
59/// Logging macro for VK Bot API
60#[macro_export]
61macro_rules! vk_log {
62    ($($arg:tt)*) => {
63        #[cfg(feature = "logging")]
64        log::info!($($arg)*);
65    };
66}
67
68/// Error logging macro for VK Bot API
69#[macro_export]
70macro_rules! vk_error {
71    ($($arg:tt)*) => {
72        #[cfg(feature = "logging")]
73        log::error!($($arg)*);
74    };
75}
76
77/// Warning logging macro for VK Bot API
78#[macro_export]
79macro_rules! vk_warn {
80    ($($arg:tt)*) => {
81        #[cfg(feature = "logging")]
82        log::warn!($($arg)*);
83    };
84}