Class SocketRoom
表示一个基于网关的房间。
public class SocketRoom : SocketEntity<ulong>, IRoom, IEntity<ulong>, IUpdateable
- Inheritance
-
SocketRoom
- Implements
- Inherited Members
Properties
Banner
获取此房间横幅图像的 URL。
public string Banner { get; }
Property Value
CreatorId
获取此房间所有者的用户 ID。
public uint CreatorId { get; }
Property Value
CurrentUser
获取当前登录的用户。
public SocketRoomUser? CurrentUser { get; }
Property Value
DownloadedMemberCount
获取此房间内已缓存的成员数量。
public int DownloadedMemberCount { get; }
Property Value
Emotes
获取此房间的所有自定义表情。
public IReadOnlyCollection<RoomEmote> Emotes { get; }
Property Value
EveryoneRole
获取此房间中的 @全体成员
全体成员角色。
public SocketRole EveryoneRole { get; }
Property Value
Icon
获取此房间图标的 URL。
public string Icon { get; }
Property Value
IsHot
获取此房间是否热门。
public bool IsHot { get; }
Property Value
IsPublic
获取此房间是否为公开房间。
public bool IsPublic { get; }
Property Value
JoinedAt
获取加入到此房间的时间。
public DateTimeOffset JoinedAt { get; }
Property Value
Name
获取此房间的名称。
public string Name { get; }
Property Value
PublicId
获取此房间的公开 ID。
public uint? PublicId { get; }
Property Value
- uint?
Remarks
Roles
获取此房间的所有角色。
public IReadOnlyCollection<SocketRole> Roles { get; }
Property Value
Stickers
获取此房间的所有自定义大表情。
public IReadOnlyCollection<RoomSticker> Stickers { get; }
Property Value
Users
获取此房间内缓存的所有用户。
public IReadOnlyCollection<SocketRoomUser> Users { get; }
Property Value
Methods
CreateRoleAsync(Action<RoleProperties>, RequestOptions?)
在此房间内创建一个新角色。
public Task<SocketRole> CreateRoleAsync(Action<RoleProperties> func, RequestOptions? options = null)
Parameters
func
Action<RoleProperties>一个用于填充新角色属性的委托。
options
RequestOptions发送请求时要使用的选项。
Returns
- Task<SocketRole>
一个表示异步创建操作的任务。任务的结果包含新创建的角色。
Remarks
此方法使用指定的属性创建新角色。要查看可用的属性,请参考 RoleProperties。
DeleteEmoteAsync(RoomEmote, RequestOptions?)
删除此房间内的现有自定义小表情。
public Task DeleteEmoteAsync(RoomEmote emote, RequestOptions? options = null)
Parameters
emote
RoomEmote要删除的自定义小表情。
options
RequestOptions发送请求时要使用的选项。
Returns
- Task
一个表示异步删除操作的任务。
DeleteStickerAsync(RoomSticker, RequestOptions?)
删除此房间内的现有自定义大表情。
public Task DeleteStickerAsync(RoomSticker sticker, RequestOptions? options = null)
Parameters
sticker
RoomSticker要删除的自定义大表情。
options
RequestOptions发送请求时要使用的选项。
Returns
- Task
一个表示异步删除操作的任务。
GetChannel(ulong)
获取此房间内的频道。
public SocketRoomChannel GetChannel(ulong id)
Parameters
id
ulong要获取的频道的 ID。
Returns
- SocketRoomChannel
一个表示异步获取操作的任务。任务的结果包含与指定的
id
关联的频道;如果未找到,则返回null
。
GetEmoteAsync(ulong, RequestOptions?)
获取此房间的指定自定义小表情。
public Task<RoomEmote?> GetEmoteAsync(ulong id, RequestOptions? options = null)
Parameters
id
ulong要获取的自定义表情的 ID。
options
RequestOptions发送请求时要使用的选项。
Returns
GetEmotesAsync(RequestOptions?)
获取此房间的所有自定义小表情。
public Task<IReadOnlyCollection<RoomEmote>> GetEmotesAsync(RequestOptions? options = null)
Parameters
options
RequestOptions发送请求时要使用的选项。
Returns
- Task<IReadOnlyCollection<RoomEmote>>
一个表示异步获取操作的任务。任务的结果包含此房间的所有自定义小表情。
GetRole(ulong)
获取此房间内的角色。
public SocketRole? GetRole(ulong id)
Parameters
id
ulong要获取的角色的 ID。
Returns
- SocketRole
一个表示异步获取操作的任务。任务的结果包含与指定的
id
关联的角色;如果未找到,则返回null
。
GetStickerAsync(ulong, RequestOptions?)
获取此房间的指定自定义大表情。
public Task<RoomSticker?> GetStickerAsync(ulong id, RequestOptions? options = null)
Parameters
id
ulong要获取的自定义表情的 ID。
options
RequestOptions发送请求时要使用的选项。
Returns
- Task<RoomSticker>
一个表示异步获取操作的任务。任务的结果包含与指定的
id
关联的自定义大表情;如果未找到,则返回null
。
GetStickersAsync(RequestOptions?)
获取此房间的所有自定义大表情。
public Task<IReadOnlyCollection<RoomSticker>> GetStickersAsync(RequestOptions? options = null)
Parameters
options
RequestOptions发送请求时要使用的选项。
Returns
- Task<IReadOnlyCollection<RoomSticker>>
一个表示异步获取操作的任务。任务的结果包含此房间的所有自定义大表情。
GetTextChannel(ulong)
获取此房间内指定具有文字聊天能力的频道。
public SocketTextChannel GetTextChannel(ulong id)
Parameters
id
ulong要获取的频道的 ID。
Returns
- SocketTextChannel
一个表示异步获取操作的任务。任务的结果包含与指定的
id
关联的频道;如果未找到,则返回null
。
Remarks
语音频道也是一种文字频道,此方法本意用于获取具有文字聊天能力的频道。如果通过此方法传入的 ID 对应的频道是语音频道,那么也会返回对应的语音频道实体。 如需获取频道的实际类型,请参考 GetChannelType(IChannel)。
GetUser(ulong)
获取此房间内的用户。
public SocketRoomUser? GetUser(ulong id)
Parameters
id
ulong要获取的用户的 ID。
Returns
- SocketRoomUser
与指定的
id
关联的用户;如果未找到,则返回null
。
Remarks
此方法可能返回 null
,因为在大型房间中,用户列表的缓存可能不完整。
ModifyEmoteAsync(RoomEmote, Action<EmoteProperties>, RequestOptions?)
修改此房间内的现有自定义小表情。
public Task ModifyEmoteAsync(RoomEmote emote, Action<EmoteProperties> func, RequestOptions? options = null)
Parameters
emote
RoomEmote要修改的自定义小表情。
func
Action<EmoteProperties>一个用于设置自定义表情属性的委托。
options
RequestOptions发送请求时要使用的选项。
Returns
- Task
一个表示异步修改操作的任务。任务的结果包含修改后的自定义表情。
ModifyStickerAsync(RoomSticker, Action<EmoteProperties>, RequestOptions?)
修改此房间内的现有自定义大表情。
public Task ModifyStickerAsync(RoomSticker sticker, Action<EmoteProperties> func, RequestOptions? options = null)
Parameters
sticker
RoomSticker要修改的自定义大表情。
func
Action<EmoteProperties>一个用于设置自定义表情属性的委托。
options
RequestOptions发送请求时要使用的选项。
Returns
- Task
一个表示异步修改操作的任务。任务的结果包含修改后的自定义表情。
PurgeUserCache()
清除此房间的用户缓存。
public void PurgeUserCache()
PurgeUserCache(Predicate<SocketRoomUser>)
清除此房间的用户缓存。
public void PurgeUserCache(Predicate<SocketRoomUser> predicate)
Parameters
predicate
Predicate<SocketRoomUser>要清除的用户的筛选条件。
ToString()
获取此房间的名称。
public override string ToString()
Returns
UpdateAsync(RequestOptions?)
通过 REST API 获取此实体对象的最新状态,并替换当前对象的属性。
public Task UpdateAsync(RequestOptions? options = null)
Parameters
options
RequestOptions发送请求时要使用的选项。
Returns
- Task
一个表示异步更新操作的任务。
Remarks
warning
此方法将从黑盒语音 REST API 获取最新数据,并替换当前对象的属性,而非使用指定的属性修改黑盒语音服务端的数据。