Skip to content

Commit

Permalink
Fix .botoff error and priority error
Browse files Browse the repository at this point in the history
  • Loading branch information
eiriksgata committed Oct 14, 2022
1 parent 4518338 commit 878d957
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,42 +20,46 @@ public class BotServiceControl {
public final static BotControlService botControl = new BotControlServiceImpl();

public boolean groupBotOff(GroupMessageEvent event) {
if (event.getSender().getPermission().getLevel() == MemberPermission.ADMINISTRATOR.getLevel() ||
event.getSender().getPermission().getLevel() == MemberPermission.OWNER.getLevel() ||
event.getSender().getId() == Long.parseLong(GlobalData.configData.getString("master.QQ.number"))
) {
long id = Bot.getInstances().get(0).getId();
String regex = ".*\\[mirai:at:" + id + "].*\\.botoff";
String messageSource = event.getMessage().toString().replaceAll(" ", "");
String messageContent = event.getMessage().contentToString().replaceAll(" ", "");
if (messageSource.matches(regex) || messageContent.equals(".botoff")) {

long id = Bot.getInstances().get(0).getId();
String regex = ".*\\[mirai:at:" + id + "].*\\.botoff";
String messageSource = event.getMessage().toString().replaceAll(" ", "");
String messageContent = event.getMessage().contentToString().replaceAll(" ", "");
if (messageSource.matches(regex) || messageContent.equals(".botoff")) {
if (event.getSender().getPermission().getLevel() == MemberPermission.ADMINISTRATOR.getLevel() ||
event.getSender().getPermission().getLevel() == MemberPermission.OWNER.getLevel() ||
event.getSender().getId() == Long.parseLong(GlobalData.configData.getString("master.QQ.number"))
) {
botControl.groupDisable(event.getGroup().getId());
event.getGroup().sendMessage(CustomText.getText("dice.bot.off"));
return true;
} else {
event.getGroup().sendMessage("需要群主或者管理员或者骰主才能关闭服务。");

}
} else {
event.getGroup().sendMessage("需要群主或者管理员或者骰主才能关闭服务。");
}
return false;
}

public boolean groupBotOn(GroupMessageEvent event) {
if (event.getSender().getPermission().getLevel() == MemberPermission.ADMINISTRATOR.getLevel() ||
event.getSender().getPermission().getLevel() == MemberPermission.OWNER.getLevel() ||
event.getSender().getId() == Long.parseLong(GlobalData.configData.getString("master.QQ.number"))
) {
long id = Bot.getInstances().get(0).getId();
String regex = ".*\\[mirai:at:" + id + "].*\\.boton";
String messageSource = event.getMessage().toString().replaceAll(" ", "");
String messageContent = event.getMessage().contentToString().replaceAll(" ", "");
if (messageSource.matches(regex) || messageContent.equals(".boton")) {

long id = Bot.getInstances().get(0).getId();
String regex = ".*\\[mirai:at:" + id + "].*\\.boton";
String messageSource = event.getMessage().toString().replaceAll(" ", "");
String messageContent = event.getMessage().contentToString().replaceAll(" ", "");
if (messageSource.matches(regex) || messageContent.equals(".boton")) {
if (event.getSender().getPermission().getLevel() == MemberPermission.ADMINISTRATOR.getLevel() ||
event.getSender().getPermission().getLevel() == MemberPermission.OWNER.getLevel() ||
event.getSender().getId() == Long.parseLong(GlobalData.configData.getString("master.QQ.number"))
) {
botControl.groupEnable(event.getGroup().getId());
event.getGroup().sendMessage(CustomText.getText("dice.bot.on"));
return true;
} else {
event.getGroup().sendMessage("需要群主或者管理员或者骰主才能打开服务。");
}
} else {
event.getGroup().sendMessage("需要群主或者管理员或者骰主才能打开服务。");
}

return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void group(GroupMessageEvent event) {
return null;
}

@InstructReflex(value = {".quitGroup"}, priority = 3)
@InstructReflex(value = {".quitGroup",".quitgroup"}, priority = 4)
public String quitGroupByMaster(MessageData<?> data) {
String number = GlobalData.configData.getString("master.QQ.number");
if (!number.equals("" + data.getQqID())) {
Expand Down

0 comments on commit 878d957

Please sign in to comment.