pub trait OnebotTrait: CanSendApi {
Show 40 methods
// Provided methods
fn send_group_msg_return<T>(
&self,
group_id: i64,
msg: T,
) -> impl Future<Output = Result<i32, ApiReturn>>
where KoviMessage: From<T>,
T: Serialize { ... }
fn send_private_msg_return<T>(
&self,
user_id: i64,
msg: T,
) -> impl Future<Output = Result<i32, ApiReturn>>
where KoviMessage: From<T>,
T: Serialize { ... }
fn can_send_image(&self) -> impl Future<Output = Result<bool, ApiReturn>> { ... }
fn can_send_record(&self) -> impl Future<Output = Result<bool, ApiReturn>> { ... }
fn send_group_msg<T>(&self, group_id: i64, msg: T)
where KoviMessage: From<T>,
T: Serialize { ... }
fn send_private_msg<T>(&self, user_id: i64, msg: T)
where KoviMessage: From<T>,
T: Serialize { ... }
fn delete_msg(&self, message_id: i32) { ... }
fn send_like(&self, user_id: i64, times: usize) { ... }
fn set_group_kick(
&self,
group_id: i64,
user_id: i64,
reject_add_request: bool,
) { ... }
fn set_group_ban(&self, group_id: i64, user_id: i64, duration: usize) { ... }
fn set_group_anonymous_ban_use_anonymous(
&self,
group_id: i64,
anonymous: Value,
duration: usize,
) { ... }
fn set_group_anonymous_ban_use_flag(
&self,
group_id: i64,
flag: &str,
duration: usize,
) { ... }
fn set_group_whole_ban(&self, group_id: i64, enable: bool) { ... }
fn set_group_admin(&self, group_id: i64, user_id: i64, enable: bool) { ... }
fn set_group_anonymous(&self, group_id: i64, enable: bool) { ... }
fn set_group_card(&self, group_id: i64, user_id: i64, card: &str) { ... }
fn set_group_name(&self, group_id: i64, group_name: &str) { ... }
fn set_group_leave(&self, group_id: i64, is_dismiss: bool) { ... }
fn set_group_special_title(
&self,
group_id: i64,
user_id: i64,
special_title: &str,
) { ... }
fn set_friend_add_request(&self, flag: &str, approve: bool, remark: &str) { ... }
fn set_group_add_request(
&self,
flag: &str,
type_: AddRequestType<'_>,
approve: bool,
reason: &str,
) { ... }
fn clean_cache(&self) { ... }
fn get_msg(
&self,
message_id: i32,
) -> impl Future<Output = Result<ApiReturn, ApiReturn>> { ... }
fn get_forward_msg(
&self,
id: &str,
) -> impl Future<Output = Result<ApiReturn, ApiReturn>> { ... }
fn get_login_info(
&self,
) -> impl Future<Output = Result<ApiReturn, ApiReturn>> { ... }
fn get_stranger_info(
&self,
user_id: i64,
no_cache: bool,
) -> impl Future<Output = Result<ApiReturn, ApiReturn>> { ... }
fn get_friend_list(
&self,
) -> impl Future<Output = Result<ApiReturn, ApiReturn>> { ... }
fn get_group_info(
&self,
group_id: i64,
no_cache: bool,
) -> impl Future<Output = Result<ApiReturn, ApiReturn>> { ... }
fn get_group_list(
&self,
) -> impl Future<Output = Result<ApiReturn, ApiReturn>> { ... }
fn get_group_member_info(
&self,
group_id: i64,
user_id: i64,
no_cache: bool,
) -> impl Future<Output = Result<ApiReturn, ApiReturn>> { ... }
fn get_group_member_list(
&self,
group_id: i64,
) -> impl Future<Output = Result<ApiReturn, ApiReturn>> { ... }
fn get_group_honor_info(
&self,
group_id: i64,
honor_type: HonorType,
) -> impl Future<Output = Result<ApiReturn, ApiReturn>> { ... }
fn get_credentials(
&self,
domain: &str,
) -> impl Future<Output = Result<ApiReturn, ApiReturn>> { ... }
fn get_status(&self) -> impl Future<Output = Result<ApiReturn, ApiReturn>> { ... }
fn get_version_info(
&self,
) -> impl Future<Output = Result<ApiReturn, ApiReturn>> { ... }
fn get_cookies(
&self,
domain: &str,
) -> impl Future<Output = Result<ApiReturn, ApiReturn>> { ... }
fn get_csrf_token(
&self,
) -> impl Future<Output = Result<ApiReturn, ApiReturn>> { ... }
fn get_record(
&self,
file: &str,
out_format: &str,
) -> impl Future<Output = Result<ApiReturn, ApiReturn>> { ... }
fn get_image(
&self,
file: &str,
) -> impl Future<Output = Result<ApiReturn, ApiReturn>> { ... }
fn send_like_return(
&self,
user_id: i64,
times: usize,
) -> impl Future<Output = Result<ApiReturn, ApiReturn>> { ... }
}Expand description
Kovi提供解析过的返回值的api
Provided Methods§
Sourcefn send_group_msg_return<T>(
&self,
group_id: i64,
msg: T,
) -> impl Future<Output = Result<i32, ApiReturn>>
fn send_group_msg_return<T>( &self, group_id: i64, msg: T, ) -> impl Future<Output = Result<i32, ApiReturn>>
发送群组消息, 并返回消息ID
Sourcefn send_private_msg_return<T>(
&self,
user_id: i64,
msg: T,
) -> impl Future<Output = Result<i32, ApiReturn>>
fn send_private_msg_return<T>( &self, user_id: i64, msg: T, ) -> impl Future<Output = Result<i32, ApiReturn>>
发送私聊消息, 并返回消息ID
Sourcefn send_group_msg<T>(&self, group_id: i64, msg: T)
fn send_group_msg<T>(&self, group_id: i64, msg: T)
发送群组消息,如果需要返回消息id,请使用send_group_msg_return()
Sourcefn send_private_msg<T>(&self, user_id: i64, msg: T)
fn send_private_msg<T>(&self, user_id: i64, msg: T)
发送私聊消息,如果需要返回消息id,请使用send_private_msg_return()
Sourcefn delete_msg(&self, message_id: i32)
fn delete_msg(&self, message_id: i32)
Sourcefn set_group_kick(&self, group_id: i64, user_id: i64, reject_add_request: bool)
fn set_group_kick(&self, group_id: i64, user_id: i64, reject_add_request: bool)
Sourcefn set_group_ban(&self, group_id: i64, user_id: i64, duration: usize)
fn set_group_ban(&self, group_id: i64, user_id: i64, duration: usize)
Sourcefn set_group_anonymous_ban_use_anonymous(
&self,
group_id: i64,
anonymous: Value,
duration: usize,
)
fn set_group_anonymous_ban_use_anonymous( &self, group_id: i64, anonymous: Value, duration: usize, )
Sourcefn set_group_anonymous_ban_use_flag(
&self,
group_id: i64,
flag: &str,
duration: usize,
)
fn set_group_anonymous_ban_use_flag( &self, group_id: i64, flag: &str, duration: usize, )
Sourcefn set_group_whole_ban(&self, group_id: i64, enable: bool)
fn set_group_whole_ban(&self, group_id: i64, enable: bool)
Sourcefn set_group_admin(&self, group_id: i64, user_id: i64, enable: bool)
fn set_group_admin(&self, group_id: i64, user_id: i64, enable: bool)
Sourcefn set_group_anonymous(&self, group_id: i64, enable: bool)
fn set_group_anonymous(&self, group_id: i64, enable: bool)
Sourcefn set_group_card(&self, group_id: i64, user_id: i64, card: &str)
fn set_group_card(&self, group_id: i64, user_id: i64, card: &str)
Sourcefn set_group_name(&self, group_id: i64, group_name: &str)
fn set_group_name(&self, group_id: i64, group_name: &str)
Sourcefn set_group_leave(&self, group_id: i64, is_dismiss: bool)
fn set_group_leave(&self, group_id: i64, is_dismiss: bool)
Sourcefn set_group_special_title(
&self,
group_id: i64,
user_id: i64,
special_title: &str,
)
fn set_group_special_title( &self, group_id: i64, user_id: i64, special_title: &str, )
Sourcefn set_friend_add_request(&self, flag: &str, approve: bool, remark: &str)
fn set_friend_add_request(&self, flag: &str, approve: bool, remark: &str)
Sourcefn set_group_add_request(
&self,
flag: &str,
type_: AddRequestType<'_>,
approve: bool,
reason: &str,
)
fn set_group_add_request( &self, flag: &str, type_: AddRequestType<'_>, approve: bool, reason: &str, )
处理加群请求/邀请
§Arguments
flag: 加群请求的 flag(需从上报的数据中获得)
type: add 或 invite,请求类型(需要和上报消息中的 sub_type 或 type 字段相符),由于不同服务端实现不一样,Kovi 提供一个枚举,使用需注意服务端要求是 sub_type 还是 type
approve: 是否同意请求/邀请
remark: 可为空, 拒绝理由(仅在拒绝时有效)
Sourcefn clean_cache(&self)
fn clean_cache(&self)
清理缓存
用于清理积攒了太多的OneBot服务端缓存文件。并非是对于本框架清除。
Sourcefn get_stranger_info(
&self,
user_id: i64,
no_cache: bool,
) -> impl Future<Output = Result<ApiReturn, ApiReturn>>
fn get_stranger_info( &self, user_id: i64, no_cache: bool, ) -> impl Future<Output = Result<ApiReturn, ApiReturn>>
Sourcefn get_group_info(
&self,
group_id: i64,
no_cache: bool,
) -> impl Future<Output = Result<ApiReturn, ApiReturn>>
fn get_group_info( &self, group_id: i64, no_cache: bool, ) -> impl Future<Output = Result<ApiReturn, ApiReturn>>
Sourcefn get_group_member_info(
&self,
group_id: i64,
user_id: i64,
no_cache: bool,
) -> impl Future<Output = Result<ApiReturn, ApiReturn>>
fn get_group_member_info( &self, group_id: i64, user_id: i64, no_cache: bool, ) -> impl Future<Output = Result<ApiReturn, ApiReturn>>
Sourcefn get_group_member_list(
&self,
group_id: i64,
) -> impl Future<Output = Result<ApiReturn, ApiReturn>>
fn get_group_member_list( &self, group_id: i64, ) -> impl Future<Output = Result<ApiReturn, ApiReturn>>
Sourcefn get_group_honor_info(
&self,
group_id: i64,
honor_type: HonorType,
) -> impl Future<Output = Result<ApiReturn, ApiReturn>>
fn get_group_honor_info( &self, group_id: i64, honor_type: HonorType, ) -> impl Future<Output = Result<ApiReturn, ApiReturn>>
获取群荣誉信息
§Arguments
group_id
honor_type: 要获取的群荣誉类型,可传入 talkative performer legend strong_newbie emotion 以分别获取单个类型的群荣誉数据,或传入 all 获取所有数据。本框架已包装好了HonorType枚举
Sourcefn get_credentials(
&self,
domain: &str,
) -> impl Future<Output = Result<ApiReturn, ApiReturn>>
fn get_credentials( &self, domain: &str, ) -> impl Future<Output = Result<ApiReturn, ApiReturn>>
Sourcefn get_record(
&self,
file: &str,
out_format: &str,
) -> impl Future<Output = Result<ApiReturn, ApiReturn>>
fn get_record( &self, file: &str, out_format: &str, ) -> impl Future<Output = Result<ApiReturn, ApiReturn>>
获取语音
§Arguments
file: 收到的语音文件名(消息段的 file 参数),如 0B38145AA44505000B38145AA4450500.silk
out_format: 要转换到的格式,目前支持 mp3、amr、wma、m4a、spx、ogg、wav、flac
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".