类 MiraiOtherClient
java.lang.Object
me.dreamvoid.miraimc.api.bot.MiraiOtherClient
MiraiMC 其他客户端
- 从以下版本开始:
- 1.7
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明获取其他客户端类型获取其他客户端名称long
getID()
获取其他客户端IDvoid
sendFlashImage
(File image) 发送闪照void
sendFlashImage
(String imageID) 发送闪照void
sendMessage
(String message) 向其他客户端发送消息void
sendMessageMirai
(String message) 向其他客户端发送消息
此方法将自动转换为Mirai Code,可用于发送图片等特殊消息void
sendShortVideo
(File thumbnailFile, File videoFile, String fileName) 上传并发送一个短视频uploadImage
(File imageFile) 上传一个图片,返回图片ID用于发送消息
-
构造器详细资料
-
MiraiOtherClient
public MiraiOtherClient(net.mamoe.mirai.contact.OtherClient otherClient) 获取指定的其他客户端实例- 参数:
otherClient
- 其他客户端
-
-
方法详细资料
-
sendMessage
向其他客户端发送消息- 参数:
message
- 消息文本
-
sendMessageMirai
向其他客户端发送消息
此方法将自动转换为Mirai Code,可用于发送图片等特殊消息- 参数:
message
- Mirai Code格式的消息文本
-
getID
public long getID()获取其他客户端ID- 返回:
- 客户端ID
-
getDeviceName
获取其他客户端名称- 返回:
- 客户端名称
-
getDeviceKind
获取其他客户端类型- 返回:
- 客户端类型
-
uploadImage
上传一个图片,返回图片ID用于发送消息- 参数:
imageFile
- 图片文件- 返回:
- 图片ID
-
sendFlashImage
发送闪照- 参数:
image
- 图片文件- 抛出:
IOException
- 上传文件发生异常时抛出
-
sendFlashImage
发送闪照- 参数:
imageID
- 图片ID
-
sendShortVideo
public void sendShortVideo(File thumbnailFile, File videoFile, @Nullable String fileName) throws IOException 上传并发送一个短视频- 参数:
thumbnailFile
- 短视频封面图videoFile
- 视频资源,目前仅支持上传 mp4 格式的视频fileName
- 文件名,若为 null 则根据 video 自动生成.- 抛出:
IOException
- 上传文件发生异常时抛出
-