pub struct Client { /* private fields */ }
Expand description
Implementations§
source§impl Client
impl Client
sourcepub fn friend(&self, uin: i64) -> FriendSelector
pub fn friend(&self, uin: i64) -> FriendSelector
构造好友选择器。
参考 FriendSelector
。
Examples
await client.friend(12345678).poke()
Python
def friend(self, uin: int) -> FriendSelector: ...
sourcepub fn get_account_info<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny>
pub fn get_account_info<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny>
获取账号信息。
参考 AccountInfo
。
Examples
info = await client.get_account_info()
print("nickname:", info.nickname)
print("age:", info.age)
print("gender:", info.gender)
Python
async def get_account_info(self) -> AccountInfo: ...
sourcepub fn get_friend_list<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny>
pub fn get_friend_list<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny>
获取好友列表。
参考 FriendList
。
Examples
friend_list = await client.get_friend_list()
for friend in friend_list.friends():
print(friend.nickname)
Python
async def friend_list(self) -> FriendList: ...
sourcepub fn get_friends<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny>
pub fn get_friends<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny>
sourcepub fn get_friend<'py>(&self, py: Python<'py>, uin: i64) -> PyResult<&'py PyAny>
pub fn get_friend<'py>(&self, py: Python<'py>, uin: i64) -> PyResult<&'py PyAny>
sourcepub fn get_groups<'py>(
&self,
py: Python<'py>,
group_ids: Vec<i64>
) -> PyResult<&'py PyAny>
pub fn get_groups<'py>(
&self,
py: Python<'py>,
group_ids: Vec<i64>
) -> PyResult<&'py PyAny>
批量获取群,返回 { 群号: 群对象 }
的字典。
当给出的群号不存在,或者未加入这个群时,将不会在返回值中出现。这意味着返回值长度可能会小于参数长度。
参考 Group
。
Examples
groups = await client.get_groups([12345678, 87654321])
if 12345678 in groups:
print(groups[12345678].name)
else:
print("未加入群 12345678 或群不存在")
Python
async def get_groups(self, group_ids: Sequence[int]) -> dict[int, Group]: ...
sourcepub fn get_group_list<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny>
pub fn get_group_list<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny>
Trait Implementations§
source§impl PyClassImpl for Client
impl PyClassImpl for Client
source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
#[pyclass(subclass)]
source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
#[pyclass(extends=…)]
source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
#[pyclass(mapping)]
source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
#[pyclass(sequence)]
§type ThreadChecker = ThreadCheckerStub<Client>
type ThreadChecker = ThreadCheckerStub<Client>
This handles following two situations: Read more
§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Immutable or mutable
§type BaseNativeType = PyAny
type BaseNativeType = PyAny
The closest native ancestor. This is
PyAny
by default, and when you declare
#[pyclass(extends=PyDict)]
, it’s PyDict
.fn items_iter() -> PyClassItemsIter
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
source§impl PyMethods<Client> for PyClassImplCollector<Client>
impl PyMethods<Client> for PyClassImplCollector<Client>
fn py_methods(self) -> &'static PyClassItems
source§impl PyTypeInfo for Client
impl PyTypeInfo for Client
§type AsRefTarget = PyCell<Client>
type AsRefTarget = PyCell<Client>
Utility type to make Py::as_ref work.
source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Returns the PyTypeObject instance for this type.
§fn type_object(py: Python<'_>) -> &PyType
fn type_object(py: Python<'_>) -> &PyType
Returns the safe abstraction over the type object.
§fn is_type_of(object: &PyAny) -> bool
fn is_type_of(object: &PyAny) -> bool
Checks if
object
is an instance of this type or a subclass of this type.§fn is_exact_type_of(object: &PyAny) -> bool
fn is_exact_type_of(object: &PyAny) -> bool
Checks if
object
is an instance of this type.