pub struct VkBot { /* private fields */ }Expand description
Main bot structure
Implementations§
Source§impl VkBot
impl VkBot
Sourcepub fn new<T: Into<String>>(token: T, group_id: i64) -> VkResult<Self>
pub fn new<T: Into<String>>(token: T, group_id: i64) -> VkResult<Self>
Create new bot with default config
Sourcepub fn builder() -> VkBotBuilder
pub fn builder() -> VkBotBuilder
Create new bot with builder
Sourcepub fn add_handler<H>(&mut self, handler: H)where
H: MessageHandler + 'static,
pub fn add_handler<H>(&mut self, handler: H)where
H: MessageHandler + 'static,
Add message handler
Sourcepub fn config(&self) -> &VkBotConfig
pub fn config(&self) -> &VkBotConfig
Get bot config
Sourcepub async fn broadcast(
&self,
message: &str,
user_ids: &[i64],
delay_ms: u64,
) -> VkResult<Vec<(i64, VkResult<i64>)>>
pub async fn broadcast( &self, message: &str, user_ids: &[i64], delay_ms: u64, ) -> VkResult<Vec<(i64, VkResult<i64>)>>
Send broadcast message to multiple users
Sourcepub async fn get_history(
&self,
peer_id: i64,
limit: i32,
) -> VkResult<Vec<Value>>
pub async fn get_history( &self, peer_id: i64, limit: i32, ) -> VkResult<Vec<Value>>
Get conversation history
Sourcepub async fn get_user_info(
&self,
user_id: i64,
fields: Option<&str>,
) -> VkResult<Value>
pub async fn get_user_info( &self, user_id: i64, fields: Option<&str>, ) -> VkResult<Value>
Get user information
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VkBot
impl !RefUnwindSafe for VkBot
impl Send for VkBot
impl Sync for VkBot
impl Unpin for VkBot
impl !UnwindSafe for VkBot
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more