Skip to content

Commit

Permalink
代码清理
Browse files Browse the repository at this point in the history
  • Loading branch information
ApliNi committed Feb 14, 2023
1 parent c16e26f commit c1a88a7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,4 +315,4 @@ permissions:

**其他**

- 统计: [bStats](https://bstats.org/plugin/bukkit/ApliNi-Chat2QQ/17587)
- 使用量统计: [bStats](https://bstats.org/plugin/bukkit/ApliNi-Chat2QQ/17587)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import io.github.aplini.chat2qq.Chat2QQ;
import io.github.aplini.chat2qq.utils.Commander;
import me.dreamvoid.miraimc.api.MiraiBot;
import me.dreamvoid.miraimc.bukkit.event.message.passive.MiraiGroupMessageEvent;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
Expand All @@ -14,6 +13,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import static io.github.aplini.chat2qq.utils.Util.sendToGroup;
import static org.bukkit.Bukkit.getLogger;

// 运行指令的功能
Expand Down Expand Up @@ -110,19 +110,16 @@ public void onGroupMessageReceive(MiraiGroupMessageEvent e) {
String finalText = String.valueOf(text).replaceAll("§[a-z0-9]", "");

// 指令返回消息
MiraiBot.getBot(plugin.getConfig().getLongList("bot.bot-accounts").get(0))
.getGroup(e.getGroupID())
.sendMessageMirai(finalText);
sendToGroup(plugin, e.getGroupID(), finalText);

} else {

Bukkit.dispatchCommand(Bukkit.getServer().getConsoleSender(), command);

// "运行无返回指令"
if(! plugin.getConfig().getString("aplini.run-command.mmessage-no-out", "").equals("")) {
MiraiBot.getBot(plugin.getConfig().getLongList("bot.bot-accounts").get(0))
.getGroup(e.getGroupID())
.sendMessageMirai(plugin.getConfig().getString("aplini.run-command.message-no-out", "message-no-out"));
sendToGroup(plugin, e.getGroupID(),
plugin.getConfig().getString("aplini.run-command.message-no-out", "message-no-out"));
}
}

Expand All @@ -137,9 +134,7 @@ public void onGroupMessageReceive(MiraiGroupMessageEvent e) {
// 指令没有运行成功 && 设置了未命中消息
if(!runOK && !plugin.getConfig().getString("aplini.run-command.message-miss", "").equals("")){
// 发送消息
MiraiBot.getBot(plugin.getConfig().getLongList("bot.bot-accounts").get(0))
.getGroup(e.getGroupID())
.sendMessageMirai(plugin.getConfig().getString("aplini.run-command.message-miss"));
sendToGroup(plugin, e.getGroupID(), plugin.getConfig().getString("aplini.run-command.message-miss"));
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ aplini:
to_replace: '[文件] '

# 解决 Emoji 显示为未知字符
- regular: '[\ud83c\udc00-\ud83c\udfff]|[\ud83d\udc00-\ud83d\udfff]|[\u2600-\u27ff]'
to_regular: '[Emoji]'
#- regular: '[\ud83c\udc00-\ud83c\udfff]|[\ud83d\udc00-\ud83d\udfff]|[\u2600-\u27ff]'
# to_regular: '[Emoji]'

# 取消发送包含此内容的消息
#- contain: '此内容'
Expand Down

0 comments on commit c1a88a7

Please sign in to comment.