pub struct Bot {
pub information: BotInformation,
/* private fields */
}
Expand description
bot结构体
Fields§
§information: BotInformation
Implementations§
Source§impl Bot
impl Bot
Sourcepub fn build<C>(conf: C) -> Bot
pub fn build<C>(conf: C) -> Bot
构建一个bot实例
§Examples
let conf = KoviConf::new(
123456,
None,
Server {
host: "127.0.0.1".parse(),
port: 8081,
access_token: "",
},
false,
None,
);
let bot = Bot::build(conf);
bot.run()
Sourcepub fn mount_main<T>(
&mut self,
name: T,
version: T,
main: Arc<dyn Fn() -> Pin<Box<dyn Future<Output = ()> + Send>> + Send + Sync>,
)
pub fn mount_main<T>( &mut self, name: T, version: T, main: Arc<dyn Fn() -> Pin<Box<dyn Future<Output = ()> + Send>> + Send + Sync>, )
挂载插件的启动函数。
Sourcepub fn load_local_conf() -> Result<KoviConf, BotBuildError>
pub fn load_local_conf() -> Result<KoviConf, BotBuildError>
读取本地Kovi.conf.toml文件
Source§impl Bot
impl Bot
Sourcepub fn set_plugin_startup_use_file(self) -> Self
pub fn set_plugin_startup_use_file(self) -> Self
使用KoviConf设置插件在Bot启动时的状态
如果配置文件中没有对应的插件,将会被忽略,保留插件默认状态
如果配置文件读取失败或者解析toml失败,将会保留插件默认状态
Sourcepub fn set_plugin_startup_use_file_ref(&mut self)
pub fn set_plugin_startup_use_file_ref(&mut self)
使用KoviConf设置插件在Bot启动时的状态
如果配置文件中没有对应的插件,将会被忽略,保留插件默认状态
如果配置文件读取失败或者解析toml失败,将会保留插件默认状态
Sourcepub fn set_all_plugin_startup(self, enabled: bool) -> Self
pub fn set_all_plugin_startup(self, enabled: bool) -> Self
设置全部插件在Bot启动时的状态
Sourcepub fn set_all_plugin_startup_ref(&mut self, enabled: bool)
pub fn set_all_plugin_startup_ref(&mut self, enabled: bool)
设置全部插件在Bot启动时的状态
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Bot
impl !RefUnwindSafe for Bot
impl Send for Bot
impl Sync for Bot
impl Unpin for Bot
impl !UnwindSafe for Bot
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