Class MiraiGroupMessagePreSendEvent
java.lang.Object
org.spongepowered.api.event.impl.AbstractEvent
me.dreamvoid.miraimc.sponge.event.message.presend.MiraiGroupMessagePreSendEvent
- All Implemented Interfaces:
org.spongepowered.api.event.Cancellable,org.spongepowered.api.event.Event
public class MiraiGroupMessagePreSendEvent
extends org.spongepowered.api.event.impl.AbstractEvent
(Sponge) 消息 - 主动发送消息前 - 群消息
-
Field Summary
Fields inherited from class org.spongepowered.api.event.impl.AbstractEvent
currentOrder -
Constructor Summary
ConstructorsConstructorDescriptionMiraiGroupMessagePreSendEvent(net.mamoe.mirai.event.events.GroupMessagePreSendEvent event, org.spongepowered.api.event.Cause cause) -
Method Summary
Modifier and TypeMethodDescription@NotNull org.spongepowered.api.event.Causecause()longgetBotID()返回发送这条信息的机器人IDint返回机器人解除禁言的剩余时间(如果已被禁言)
此方法会同时判断目标群是否开启全员禁言,如果开启,则返回 -1int获取机器人在目标群的管理权限getGroup()获取群实例long返回目标群的群号Deprecated.返回目标群的群名称返回接收到的消息内容转换到字符串的结果
此方法使用 contentToString()
QQ 对话框中以纯文本方式会显示的消息内容,这适用于MC与QQ的消息互通等不方便展示原始内容的场景。Deprecated.返回接收到的消息内容
此方法使用 toString()
Java 对象的 toString(),会尽可能包含多的信息用于调试作用,行为可能不确定
如需处理常规消息内容,请使用getMessageContent()long返回接收者IDboolean判断目标群是否允许普通成员邀请新成员boolean判断目标群是否允许匿名聊天boolean判断目标群是否启用自动加群审批boolean消息是否已被取消发送boolean判断目标群是否全员禁言voidsetCancelled(boolean cancel) 取消消息的发送
请注意,无论 cancel 参数设为什么,只要被取消过,就不能撤销。voidsetMessage(String message) 设置将要发送的消息内容 支持 Mirai CodetoString()获取原始事件内容
[!]Methods inherited from class org.spongepowered.api.event.impl.AbstractEvent
initMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.spongepowered.api.event.Event
context, source
-
Constructor Details
-
MiraiGroupMessagePreSendEvent
public MiraiGroupMessagePreSendEvent(net.mamoe.mirai.event.events.GroupMessagePreSendEvent event, org.spongepowered.api.event.Cause cause)
-
-
Method Details
-
getGroupID
public long getGroupID()返回目标群的群号- Returns:
- 群号
-
getGroupName
返回目标群的群名称- Returns:
- 群名称
-
getBotMuteRemainTime
public int getBotMuteRemainTime()返回机器人解除禁言的剩余时间(如果已被禁言)
此方法会同时判断目标群是否开启全员禁言,如果开启,则返回 -1- Returns:
- 禁言时间(秒) - 全员禁言返回 -1
-
getGroupMemberList
Deprecated.获取目标群的群成员列表 此方法只返回QQ号- Returns:
- 群成员列表
- See Also:
-
getBotPermission
public int getBotPermission()获取机器人在目标群的管理权限- Returns:
- 0 - 普通成员 | 1 - 管理员 | 2 - 群主
-
isAllowMemberInvite
public boolean isAllowMemberInvite()判断目标群是否允许普通成员邀请新成员- Returns:
- 允许返回true,不允许返回false
-
isAnonymousChatEnabled
public boolean isAnonymousChatEnabled()判断目标群是否允许匿名聊天- Returns:
- 允许返回true,不允许返回false
-
isMuteAll
public boolean isMuteAll()判断目标群是否全员禁言- Returns:
- 全员禁言返回true,否则返回false
-
isAutoApproveEnabled
public boolean isAutoApproveEnabled()判断目标群是否启用自动加群审批- Returns:
- 启用返回true,禁用返回false
-
getGroup
获取群实例- Returns:
- MiraiGroup 实例
-
getBotID
public long getBotID()返回发送这条信息的机器人ID- Returns:
- 机器人ID
-
getTargetID
public long getTargetID()返回接收者ID- Returns:
- 可以是QQ号或群号
-
getMessage
返回接收到的消息内容转换到字符串的结果
此方法使用 contentToString()
QQ 对话框中以纯文本方式会显示的消息内容,这适用于MC与QQ的消息互通等不方便展示原始内容的场景。
无法用纯文字表示的消息会丢失信息,如任何图片都是 [图片]- Returns:
- 转换字符串后的消息内容
-
getMessageContent
Deprecated.返回接收到的消息内容转换到字符串的结果
此方法使用 contentToString()
QQ 对话框中以纯文本方式会显示的消息内容,这适用于MC与QQ的消息互通等不方便展示原始内容的场景。
无法用纯文字表示的消息会丢失信息,如任何图片都是 [图片]- Returns:
- 转换字符串后的消息内容
- See Also:
-
getMessageToString
返回接收到的消息内容
此方法使用 toString()
Java 对象的 toString(),会尽可能包含多的信息用于调试作用,行为可能不确定
如需处理常规消息内容,请使用getMessageContent()- Returns:
- 原始消息内容
-
setMessage
设置将要发送的消息内容 支持 Mirai Code- Parameters:
message- 带 Mirai Code 的消息
-
isCancelled
public boolean isCancelled()消息是否已被取消发送- Specified by:
isCancelledin interfaceorg.spongepowered.api.event.Cancellable- Returns:
- 如果消息被取消发送,返回true
-
setCancelled
public void setCancelled(boolean cancel) 取消消息的发送
请注意,无论 cancel 参数设为什么,只要被取消过,就不能撤销。
也就是说,已取消的事件永远不会继续发送消息。- Specified by:
setCancelledin interfaceorg.spongepowered.api.event.Cancellable- Parameters:
cancel- 调用此方法将忽略本参数,无论设为什么
-
toString
获取原始事件内容
[!] 不推荐使用 -
cause
@NotNull public @NotNull org.spongepowered.api.event.Cause cause()- Specified by:
causein interfaceorg.spongepowered.api.event.Event
-