mirror of
https://github.com/jie65535/JChatGPT.git
synced 2025-06-02 17:39:10 +08:00
Add member activity level permission
This commit is contained in:
parent
98bcd3785b
commit
12df62d7fe
@ -88,7 +88,12 @@ object JChatGPT : KotlinPlugin(
|
|||||||
// 发送者是否有权限
|
// 发送者是否有权限
|
||||||
if (!toCommandSender().hasPermission(chatPermission)) {
|
if (!toCommandSender().hasPermission(chatPermission)) {
|
||||||
if (this is GroupMessageEvent) {
|
if (this is GroupMessageEvent) {
|
||||||
if (!sender.isOperator() || !PluginConfig.groupOpHasChatPermission) {
|
if (PluginConfig.groupOpHasChatPermission && sender.isOperator()) {
|
||||||
|
// 允许管理员使用
|
||||||
|
} else if (sender.active.temperature >= PluginConfig.temperaturePermission) {
|
||||||
|
// 允许活跃度达标成员使用
|
||||||
|
} else {
|
||||||
|
// 其它情况阻止使用
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -188,7 +193,9 @@ object JChatGPT : KotlinPlugin(
|
|||||||
// 消息内容太长则转为转发消息避免刷屏
|
// 消息内容太长则转为转发消息避免刷屏
|
||||||
buildForwardMessage {
|
buildForwardMessage {
|
||||||
for (item in history) {
|
for (item in history) {
|
||||||
val temp = toMessage(subject, item.content ?: "...")
|
if (item.content.isNullOrEmpty())
|
||||||
|
continue
|
||||||
|
val temp = toMessage(subject, item.content!!)
|
||||||
when (item.role) {
|
when (item.role) {
|
||||||
Role.User -> sender says temp
|
Role.User -> sender says temp
|
||||||
Role.Assistant -> bot says temp
|
Role.Assistant -> bot says temp
|
||||||
@ -318,7 +325,7 @@ object JChatGPT : KotlinPlugin(
|
|||||||
logger.info("Result=$result")
|
logger.info("Result=$result")
|
||||||
// 过会撤回加载消息
|
// 过会撤回加载消息
|
||||||
if (receipt != null) {
|
if (receipt != null) {
|
||||||
launch { delay(2.seconds); receipt.recall() }
|
launch { delay(3.seconds); receipt.recall() }
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,9 @@ object PluginConfig : AutoSavePluginConfig("Config") {
|
|||||||
@ValueDescription("好友是否自动拥有对话权限,默认是")
|
@ValueDescription("好友是否自动拥有对话权限,默认是")
|
||||||
val friendHasChatPermission: Boolean by value(true)
|
val friendHasChatPermission: Boolean by value(true)
|
||||||
|
|
||||||
|
@ValueDescription("群荣誉等级权限门槛,达到这个等级相当于自动拥有权限。")
|
||||||
|
val temperaturePermission: Int by value(60)
|
||||||
|
|
||||||
@ValueDescription("等待响应超时时间,单位毫秒,默认60秒")
|
@ValueDescription("等待响应超时时间,单位毫秒,默认60秒")
|
||||||
val timeout: Long by value(60000L)
|
val timeout: Long by value(60000L)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user