cyan.model.guild module

class cyan.model.guild.Guild(bot: cyan.bot.Bot, props: Dict[str, Any])[源代码]

基类:cyan.model.Model, cyan.model.renovatable.AsyncRenovatable[Guild]

频道。

async add_administrator(member: Member) None[源代码]

异步添加管理员到当前频道。

参数:
  • member: 将要作为频道管理员的成员

async announce(message: ChannelMessage) cyan.model.announcement.Announcement[源代码]

异步在当前频道公告指定消息。

参数:
  • message: 将要在当前频道公告的消息

返回:

Announcement 类型表示的公告。

property bot: cyan.bot.Bot

Model 所属机器人。

property capacity: int

频道最大成员数。

async create_role(name: Optional[str] = None, color: Optional[cyan.color.ARGB] = None, shown: Optional[bool] = None) Role[源代码]

异步在当前频道创建身份组。

参数:
  • name: 身份组名称

  • color: 身份组颜色

  • shown: 身份组是否在成员列表中单独展示

返回:

Role 类型表示的身份组。

property description: str

频道描述。

async get_administrators() List[Member][源代码]

异步获取当前频道的所有管理员。

返回:

Member 类型表示管理员的 list 集合。

async get_channel_groups() List[ChannelGroup][源代码]

异步获取当前频道的所有子频道组。

返回:

ChannelGroup 类型表示子频道组的 list 集合。

async get_channels() List[Channel][源代码]

异步获取当前频道的所有子频道。

返回:

Channel 类型表示子频道的 list 集合。

async get_icon() bytes[源代码]

异步获取频道头像。

返回:

bytes 类型表示的图像文件内容。

async get_member(identifier: str) Member[源代码]

异步获取当前频道的指定 ID 成员。

参数:
  • identifier: 成员 ID

返回:

Member 类型表示的成员。

async get_members() List[Member][源代码]

异步获取当前频道的所有成员。

返回:

Member 类型表示成员的 list 集合。

async get_owner() Optional[Member][源代码]

异步获取频道所有者。

返回:

当存在频道所有者时,返回以 Member 类型表示的当前频道所有者; 若不存在,则返回 None

async get_role(identifier: str) Role[源代码]

异步获取当前频道的指定 ID 身份组。

参数:
  • identifier: 身份组 ID

返回:

Role 类型表示的身份组。

async get_roles() List[Role][源代码]

异步获取当前频道的所有身份组。

返回:

Role 类型表示身份组的 list 集合。

property identifier: str

Model ID。

async mute(duration: datetime.timedelta) None[源代码]

异步禁言当前频道指定时长。

参数:
  • duration: 禁言时长

async mute_until(time: datetime.datetime) None[源代码]

异步禁言当前频道至指定时间。

参数:
  • time: 禁言终止时间

property name: str

频道名。

async recall_announcement() None[源代码]

异步撤销当前频道的公告。

async remove(member: Member) None[源代码]

异步从当前频道移除指定成员。

参数:
  • member: 将要从当前频道移除的成员

async remove_administrator(member: Member) None[源代码]

异步从当前频道移除指定管理员。

参数:
  • member: 将要从当前频道移除的管理员

async remove_role(role: Role) None[源代码]

异步从当前频道移除指定身份组。

参数:
  • role: 将要从当前频道移除的身份组

async renovate() cyan.model.guild.Guild[源代码]

获取更新的实例。

async unmute() None[源代码]

异步解除当前频道的禁言。