AbstractionExtensions 类
定义用于 HuajiTech.CoolQ.Abstractions 中的类型的扩展方法。
继承
继承成员
命名空间: HuajiTech.CoolQ.Messaging
程序集: HuajiTech.CoolQ.dll
语法
public static class AbstractionExtensions
方法
| 改善此文档 查看源代码At(IUser)
创建目标为指定用户的 At 类的新实例。
声明
[Obsolete("请改为使用 Mention。")]
public static At At(this IUser target)
参数
类型 | 名称 | 描述 |
---|---|---|
IUser | target | At (@) 的目标。 |
返回
类型 | 描述 |
---|---|
At | 目标为指定用户的 At 类的新实例。 |
GetContent(ContactShare)
使用 Current 获取 ContactShare 实例的内容。
声明
public static IChattable GetContent(this ContactShare share)
参数
类型 | 名称 | 描述 |
---|---|---|
ContactShare | share | 要操作的 ContactShare 实例。 |
返回
类型 | 描述 |
---|---|
IChattable |
GetContent(ContactShare, PluginContext)
获取 ContactShare 实例的内容。
声明
public static IChattable GetContent(this ContactShare share, PluginContext context)
参数
类型 | 名称 | 描述 |
---|---|---|
ContactShare | share | 要操作的 ContactShare 实例。 |
PluginContext | context | 要使用的 PluginContext。 |
返回
类型 | 描述 |
---|---|
IChattable |
GetFile(Image)
声明
public static FileInfo GetFile(this Image image)
参数
类型 | 名称 | 描述 |
---|---|---|
Image | image | 要操作的 Image 实例。 |
返回
类型 | 描述 |
---|---|
System.IO.FileInfo |
GetFile(Image, PluginContext)
获取指定 Image 实例表示的文件。
声明
public static FileInfo GetFile(this Image image, PluginContext context)
参数
类型 | 名称 | 描述 |
---|---|---|
Image | image | 要操作的 Image 实例。 |
PluginContext | context | 要使用的 PluginContext。 |
返回
类型 | 描述 |
---|---|
System.IO.FileInfo | 当前 Image 实例表示的文件。 |
GetFile(Record, String)
声明
public static FileInfo GetFile(this Record record, string format)
参数
类型 | 名称 | 描述 |
---|---|---|
Record | record | 要操作的 Record 实例。 |
System.String | format | 返回的文件的格式。 |
返回
类型 | 描述 |
---|---|
System.IO.FileInfo |
GetFile(Record, String, PluginContext)
获取指定 Record 实例表示的文件。
声明
public static FileInfo GetFile(this Record record, string format, PluginContext context)
参数
类型 | 名称 | 描述 |
---|---|---|
Record | record | 要操作的 Record 实例。 |
System.String | format | 返回的文件的格式。 |
PluginContext | context | 要使用的 PluginContext。 |
返回
类型 | 描述 |
---|---|
System.IO.FileInfo | 当前 Record 实例表示的文件。 |
GetTarget(Mention)
声明
public static IUser GetTarget(this Mention mention)
参数
类型 | 名称 | 描述 |
---|---|---|
Mention | mention | 要操作的 Mention 实例。 |
返回
类型 | 描述 |
---|---|
IUser |
GetTarget(Mention, PluginContext)
获取 Mention 实例的目标。
声明
public static IUser GetTarget(this Mention mention, PluginContext context)
参数
类型 | 名称 | 描述 |
---|---|---|
Mention | mention | 要操作的 Mention 实例。 |
PluginContext | context | 要使用的 PluginContext。 |
返回
类型 | 描述 |
---|---|
IUser |
Mention(IUser)
创建目标为指定用户的 Mention 类的新实例。
声明
public static Mention Mention(this IUser target)
参数
类型 | 名称 | 描述 |
---|---|---|
IUser | target | 提及 (@) 的目标。 |
返回
类型 | 描述 |
---|---|
Mention | 目标为指定用户的 Mention 类的新实例。 |
Parse(Message, Boolean)
将 Message 实例解析为 ComplexMessage 实例。
声明
public static ComplexMessage Parse(this Message message, bool useEmoji = false)
参数
类型 | 名称 | 描述 |
---|---|---|
Message | message | 一个 Message实例,该 Message 实例的 Content 属性为要解析的 ComplexMessage 实例的字符串表示形式。 |
System.Boolean | useEmoji | 如果要在返回的 ComplexMessage 实例中包含 Emoji 实例,则为 true;否则为 false。 |
返回
类型 | 描述 |
---|---|
ComplexMessage | 与 Content 等效的 ComplexMessage 实例。 |
Reply(MessageReceivedEventArgs, ISendable)
回复指定的消息接收事件。
声明
public static Message Reply(this MessageReceivedEventArgs e, ISendable message)
参数
类型 | 名称 | 描述 |
---|---|---|
MessageReceivedEventArgs | e | 事件数据。 |
ISendable | message | 要回复的 ISendable 实例。 |
返回
类型 | 描述 |
---|---|
Message | 发送的消息。 |
Reply(MessageReceivedEventArgs, String)
回复指定的消息接收事件。
声明
public static Message Reply(this MessageReceivedEventArgs e, string message)
参数
类型 | 名称 | 描述 |
---|---|---|
MessageReceivedEventArgs | e | 事件数据。 |
System.String | message | 要回复的字符串。 |
返回
类型 | 描述 |
---|---|
Message | 发送的消息。 |
Send(ISendee, ISendable)
向指定聊天发送一个 ISendable 实例。
声明
public static Message Send(this ISendee sendee, ISendable message)
参数
类型 | 名称 | 描述 |
---|---|---|
ISendee | sendee | 目标可被发送实例。 |
ISendable | message | 要发送的 ComplexMessage 实例。 |
返回
类型 | 描述 |
---|---|
Message | 一个 Message 实例,表示已发送的消息。 |
异常
类型 | 条件 |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
System.ArgumentException |
|
ApiException | 酷Q返回了指示操作失败的值。 |
SetContent(ContactShare, IChattable)
设置 ContactShare 实例的内容。
声明
public static ContactShare SetContent(this ContactShare share, IChattable content)
参数
类型 | 名称 | 描述 |
---|---|---|
ContactShare | share | 要操作的 ContactShare 实例。 |
IChattable | content | ContactShare 实例的内容。 |
返回
类型 | 描述 |
---|---|
ContactShare |
SetTarget(Mention, IUser)
设置 Mention 实例的目标。
声明
public static Mention SetTarget(this Mention mention, IUser target)
参数
类型 | 名称 | 描述 |
---|---|---|
Mention | mention | 要操作的 Mention 实例。 |
IUser | target | Mention 实例的目标。 |
返回
类型 | 描述 |
---|---|
Mention |