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::{
55    AudioMessageInfo, DocInfo, DownloadedFile, LongPollServer, PhotoSizeInfo, SavedDocument,
56    SavedPhoto, UploadResponse, UploadServer, VkApi, VkApiBuilder, VkApiConfig,
57};
58pub use bot::{VkBot, VkBotBuilder, VkBotConfig};
59pub use error::{VkError, VkResult};
60pub use handler::{DefaultMessageHandler, MessageHandler};
61
62/// Logging macro for VK Bot API
63#[macro_export]
64macro_rules! vk_log {
65    ($($arg:tt)*) => {
66        #[cfg(feature = "logging")]
67        log::info!($($arg)*);
68    };
69}
70
71/// Error logging macro for VK Bot API
72#[macro_export]
73macro_rules! vk_error {
74    ($($arg:tt)*) => {
75        #[cfg(feature = "logging")]
76        log::error!($($arg)*);
77    };
78}
79
80/// Warning logging macro for VK Bot API
81#[macro_export]
82macro_rules! vk_warn {
83    ($($arg:tt)*) => {
84        #[cfg(feature = "logging")]
85        log::warn!($($arg)*);
86    };
87}