Struct libawr::client::Client

source ·
pub struct Client {
    pub uin: i64,
    /* private fields */
}
Expand description

客户端。

Python

class Client:
    @property
    def uin(self) -> int:

Fields§

§uin: i64

当前账号的 QQ 号。

Implementations§

source§

impl Client

source

pub async fn set_friend_list_cache_time(&self, time: Duration)

设置好友列表缓存过期时间。

Python
async def set_friend_list_cache_time(self, time: datetime.timedelta) -> None: ...
source

pub async fn set_group_cache_time(&self, time: Duration)

设置群信息缓存过期时间。

Python
async def set_group_cache_time(self, time: datetime.timedelta) -> None: ...
source

pub async fn set_group_member_list_cache_time(&self, time: Duration)

设置群成员列表缓存过期时间。

Python
async def set_group_member_list_cache_time(self, time: datetime.timedelta) -> None: ...
source

pub fn is_online(&self) -> bool

当前账号是否在线。

Python
def is_online(self) -> bool: ...
source

pub fn account_info(self: &Arc<Self>) -> AccountInfoSelector

构造账号信息选择器。

Python
def account_info(self) -> AccountInfoSelector: ...
source

pub async fn get_account_info( self: &Arc<Self> ) -> Result<AccountInfo, ReadAccountInfoError>

获取账号信息。

Python
async def get_account_info(self) -> AccountInfo: ...
source

pub fn friend_list(self: &Arc<Self>) -> FriendListSelector

构造好友分组选择器。

Python
def friend_group(self, group_id: int) -> FriendGroupSelector: ...
source

pub async fn get_friend_list( self: &Arc<Self> ) -> Result<Arc<FriendList>, FetchFriendListError>

获取好友列表对象。

好友列表会被缓存,如果缓存未过期则直接返回缓存的值。 如果需要强制刷新好友列表缓存,请使用 flush_friend_list

Python
async def get_friend_list(self) -> FriendList: ...
source

pub async fn flush_friend_list( self: &Arc<Self> ) -> Result<(), FetchFriendListError>

刷新好友列表缓存。

Python
async def flush_friend_list(self) -> None: ...
source

pub fn friend(self: &Arc<Self>, uin: i64) -> FriendSelector

构造好友选择器。

Python
def friend(self, uin: int) -> FriendSelector:
source

pub async fn get_friend( self: &Arc<Self>, uin: i64 ) -> Result<Option<Arc<Friend>>, FetchFriendInfoError>

获取好友对象。

好友对象会缓存在好友列表缓存中,如果缓存未过期则直接返回缓存的值。 如果需要强制刷新好友对象缓存,请使用 FriendSelector::flushflush_friend_list

Python
async def get_friend(self, uin: int) -> Friend | None: ...
source

pub fn friend_group(self: &Arc<Self>, id: u8) -> FriendGroupSelector

构造好友分组选择器。

Python
def friend_group(self, group_id: int) -> FriendGroupSelector: ...
source

pub async fn get_friend_group( self: &Arc<Self>, id: u8 ) -> Result<Option<Arc<FriendGroup>>, FetchFriendGroupError>

获取好友分组对象。

好友分组对象会缓存在好友列表缓存中,如果缓存未过期则直接返回缓存的值。 如果需要强制刷新好友分组对象缓存,请使用 FriendGroupSelector::flushflush_friend_list

Python
async def get_friend_group(self, id: int) -> FriendGroup | None: ...
source

pub async fn create_friend_group( self: &Arc<Self>, name: String ) -> Result<(), RQError>

创建好友分组。

此方法会强制更新好友列表缓存。

Python
async def create_friend_group(self, name: str) -> None: ...
source

pub fn group(self: &Arc<Self>, code: i64) -> GroupSelector

构造群选择器。

Python
def group(self, code: int) -> GroupSelector: ...
source

pub async fn get_group( self: &Arc<Self>, code: i64 ) -> Result<Option<Arc<Group>>, FetchGroupInfoError>

获取群对象。

群对象会被缓存,如果缓存未过期则直接返回缓存的值。 如果需要强制刷新群对象缓存,请使用 GroupSelector::flush

Python
async def get_group(self, code: int) -> Group | None: ...
source

pub fn groups(self: &Arc<Self>, codes: Vec<i64>) -> MultiGroupSelector

构造多个群选择器。

Python
def groups(self, *codes: int) -> MultiGroupSelector: ...
source

pub async fn get_groups( self: &Arc<Self>, codes: Vec<i64> ) -> Result<HashMap<i64, Arc<Group>>, FetchGroupInfoError>

获取多个群对象。

群对象会被缓存,如果缓存未过期则直接返回缓存的值。 如果需要强制刷新群对象缓存,请使用 MultiGroupSelector::flush

Python
async def get_groups(self, *codes: int) -> dict[int, Group]: ...
source

pub fn all_groups(self: &Arc<Self>) -> AllGroupSelector

构造所有群选择器。

Python
def all_groups(self) -> AllGroupSelector: ...
source

pub async fn get_all_groups( self: &Arc<Self> ) -> Result<HashMap<i64, Arc<Group>>, FetchGroupInfoError>

获取所有群对象。

此方法会刷新所有群对象的缓存。

Python
async def get_all_groups(self) -> dict[int, Group]: ...
source

pub fn group_member( self: &Arc<Self>, group_code: i64, uin: i64 ) -> GroupMemberSelector

构造群成员选择器。

Python
def group_member(self, group_code: int, uin: int) -> GroupMemberSelector: ...
source

pub async fn get_group_member( self: &Arc<Self>, group_code: i64, uin: i64 ) -> Result<Option<Arc<GroupMember>>, FetchGroupMemberInfoError>

获取群成员对象。

群成员对象会被缓存,如果缓存未过期则直接返回缓存的值。 如果需要强制刷新群成员对象缓存,请使用 GroupMemberSelector::flush

Python
async def get_group_member(self, group_code: int, uin: int) -> GroupMember | None: ...
source

pub fn group_member_list( self: &Arc<Self>, group_code: i64 ) -> GroupMemberListSelector

构造群成员列表选择器。

Python
def group_member_list(self, group_code: int) -> GroupMemberListSelector: ...
source

pub async fn get_group_member_list( self: &Arc<Self>, group_code: i64 ) -> Result<Option<Arc<GroupMemberList>>, FetchGroupMemberListError>

获取群成员列表。

群成员列表会被缓存,如果缓存未过期则直接返回缓存的值。 如果需要强制刷新群成员列表缓存,请使用 GroupMemberListSelector::flush

Python
async def get_group_member_list(self, group_code: int) -> GroupMemberList | None: ...

Trait Implementations§

source§

impl Debug for Client

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, W> HasTypeWitness<W> for Twhere W: MakeTypeWitness<Arg = T>, T: ?Sized,

§

const WITNESS: W = W::MAKE

A constant of the type witness
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more