chore: use user role instead of admin list
This commit is contained in:
5 files changed
+60
-64
No files matched your search
@@ -8,7 +8,6 @@
|
||||
package cn.rtast.fancybot.commands
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.configManager
|
||||
import cn.rtast.fancybot.enums.CommandAction
|
||||
import cn.rtast.fancybot.util.file.insertActionRecord
|
||||
import cn.rtast.rob.entity.GroupMessage
|
||||
@@ -20,12 +19,12 @@ class EchoCommand : BaseCommand() {
|
||||
override val commandNames = listOf("/echo")
|
||||
|
||||
override suspend fun executeGroup(listener: OneBotListener, message: GroupMessage, args: List<String>) {
|
||||
if (message.sender.userId !in configManager.admins) {
|
||||
if (message.sender.isAdmin || message.sender.isOwner) {
|
||||
listener.sendGroupMessage(message.groupId, args.joinToString(" "))
|
||||
insertActionRecord(CommandAction.Echo, message.sender.userId)
|
||||
} else {
|
||||
message.reply("你不许用echo")
|
||||
return
|
||||
}
|
||||
listener.sendGroupMessage(message.groupId, args.joinToString(" "))
|
||||
insertActionRecord(CommandAction.Echo, message.sender.userId)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,11 +33,11 @@ class ShuffleEchoCommand : BaseCommand() {
|
||||
override val commandNames = listOf("/secho", "/se")
|
||||
|
||||
override suspend fun executeGroup(listener: OneBotListener, message: GroupMessage, args: List<String>) {
|
||||
if (message.sender.userId !in configManager.admins) {
|
||||
if (message.sender.isAdmin || message.sender.isOwner) {
|
||||
message.reply(message.rawMessage.toList().shuffled().joinToString(""))
|
||||
insertActionRecord(CommandAction.Echo, message.sender.userId)
|
||||
} else{
|
||||
message.reply("你不许用echo")
|
||||
return
|
||||
}
|
||||
message.reply(message.rawMessage.toList().shuffled().joinToString(""))
|
||||
insertActionRecord(CommandAction.Echo, message.sender.userId)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user