From 73123a80151074af4d722012006231c8fc878ccb Mon Sep 17 00:00:00 2001 From: 2979302435 <2979302435@qq.com> Date: Thu, 16 Jun 2022 19:13:11 +0800 Subject: [PATCH 1/9] up --- Paimon_Chat/Learning_repeate/main.py | 153 ++++++++++++++++++++++++-- Paimon_Chat/Learning_repeate/model.py | 4 +- Paimon_Chat/__init__.py | 6 + utils/config.py | 4 +- 4 files changed, 158 insertions(+), 9 deletions(-) diff --git a/Paimon_Chat/Learning_repeate/main.py b/Paimon_Chat/Learning_repeate/main.py index 40c7d36..1a1e7a2 100644 --- a/Paimon_Chat/Learning_repeate/main.py +++ b/Paimon_Chat/Learning_repeate/main.py @@ -11,7 +11,7 @@ from nonebot.typing import T_State from nonebot.rule import keyword, to_me, Rule from nonebot.adapters import Bot from nonebot.adapters.onebot.v11 import GroupMessageEvent - +from nonebot.permission import SUPERUSER from nonebot.adapters.onebot.v11 import permission from .model import Chat @@ -20,6 +20,11 @@ from utils.config import config message_id_lock = threading.Lock() message_id_dict = {} +#检测是否开启该群的机器学习 +def checkGroup(event: GroupMessageEvent) -> bool: + if event.group_id in Chat.learningGroup: + return True + return False async def check_accounts(event: GroupMessageEvent) -> bool: # 不响应其他nonebot_plugin_gocqhttp机器人账号的信息 @@ -35,6 +40,8 @@ async def get_answer(event: GroupMessageEvent, state: T_State) -> bool: # 不响应被屏蔽的人的信息 if event.user_id in config.paimon_chat_ban: return False + elif not checkGroup(event): # 判断群组 + return False chat: Chat = Chat(event) to_learn = True # 多账号登陆,且在同一群中时;避免一条消息被处理多次 @@ -64,7 +71,7 @@ async def get_answer(event: GroupMessageEvent, state: T_State) -> bool: any_msg = on_message( priority=20, block=False, - rule=Rule(check_accounts, get_answer), + rule=Rule(check_accounts, get_answer, checkGroup), permission=permission.GROUP # | permission.PRIVATE_FRIEND ) @@ -108,10 +115,10 @@ async def is_reply(bot: Bot, event: GroupMessageEvent) -> bool: ban_msg = on_message( - rule=to_me() & keyword('不可以', '达咩', '不行', 'no') & Rule(is_reply), + rule=to_me() & keyword('不可以', '达咩', '不行', 'no') & Rule(is_reply, checkGroup), priority=5, block=True, - permission=permission.GROUP_OWNER | permission.GROUP_ADMIN + permission=permission.GROUP_OWNER | permission.GROUP_ADMIN | SUPERUSER ) @@ -142,10 +149,10 @@ async def message_is_ban(bot: Bot, event: GroupMessageEvent) -> bool: ban_msg_latest = on_message( - rule=to_me() & Rule(message_is_ban), + rule=to_me() & Rule(message_is_ban, checkGroup), priority=5, block=True, - permission=permission.GROUP_OWNER | permission.GROUP_ADMIN + permission=permission.GROUP_OWNER | permission.GROUP_ADMIN | SUPERUSER ) @@ -184,7 +191,7 @@ async def is_drink_msg(bot: Bot, event: GroupMessageEvent) -> bool: drink_msg = on_message( - rule=Rule(is_drink_msg), + rule=Rule(is_drink_msg, checkGroup), priority=5, block=True, permission=permission.GROUP_OWNER | permission.GROUP_ADMIN @@ -212,3 +219,135 @@ async def _(bot: Bot, event: GroupMessageEvent): def update_data(): Chat.clearup_context() Chat.completely_sober() + +#群组开启 +onLearningGroup = on_message( + rule = to_me() & keyword("派蒙学习开启","说怪话"), + priority = 4, + block = True, + permission=permission.GROUP_ADMIN | permission.GROUP_OWNER | SUPERUSER +) +onLearningGroup.__paimon_help__ = { + "usage": "@派蒙 <说怪话>", + "introduce": "开启派蒙在该群的机器学习能力", + "priority": 99 +} +@onLearningGroup.handle() +async def _(bot: Bot, event: GroupMessageEvent): + if checkGroup(event): + await onLearningGroup.finish("派蒙已经在学习群友的话了哦") + else: + Chat.learningGroup.append(event.group_id) + await onLearningGroup.finish("派蒙开始学习群友说怪话!") + +#群组关闭 +offLearningGroup = on_message( + rule = to_me() & keyword("派蒙学习关闭","不准说怪话"), + priority = 4, + block = True, + permission=permission.GROUP_ADMIN | permission.GROUP_OWNER | SUPERUSER +) +offLearningGroup.__paimon_help__ = { + "usage": "@派蒙 <不准说怪话>", + "introduce": "关闭派蒙在该群的机器学习能力", + "priority": 99 +} +@offLearningGroup.handle() +async def _(bot: Bot, event: GroupMessageEvent): + if not checkGroup(event): + await offLearningGroup.finish("派蒙没有在学群友说话!") + else: + Chat.learningGroup.remove(event.group_id) + await offLearningGroup.finish("派蒙不学就是了TAT") + +#发癫 +fun_msg = on_message( + rule=to_me() & keyword('发癫','派蒙发癫','喝酒') & Rule(checkGroup), + priority=6, + block=True, + permission=permission.GROUP_ADMIN | permission.GROUP_OWNER | SUPERUSER +) +fun_msg.__paimon_help__ = { + "usage": "@派蒙 <发癫>", + "introduce": "派蒙喝醉了在群里发癫", + "priority": 99 +} +@fun_msg.handle() +async def funmsg(bot: Bot, event: GroupMessageEvent): + logger.info(f'repeater:派蒙开始发癫') + Chat.answer_threshold = 1 + Chat.speak_threshold = 1 + Chat.speak_continuously_probability = 1 + Chat.speak_poke_probability = 1 + Chat.speak_continuously_max_len = 10 + Chat.cross_group_threshold = 1 + msg_send = ['呀,旅行者。你今天走起路来,怎么看着摇摇晃晃的?嘿嘿嘿~~~','……&%*&U(*……&%'] + await fun_msg.finish(random.choice(msg_send)) + +#停止发癫 +stop_fun_msg = on_message( + rule=to_me() & keyword('恢复','不准发癫','停止','stop'), + priority=5, + block=True, + permission=permission.GROUP_ADMIN | permission.GROUP_OWNER | SUPERUSER +) +stop_fun_msg.__paimon_help__ = { + "usage": "@派蒙 <不准发癫>", + "introduce": "让派蒙恢复正常", + "priority": 99 +} +@stop_fun_msg.handle() +async def stopfunmsg(bot: Bot, event: GroupMessageEvent): + logger.info(f'repeater:派蒙停止发癫') + Chat.answer_threshold = config.paimon_answer_threshold + Chat.speak_threshold = config.paimon_speak_threshold + Chat.speak_continuously_probability = config.paimon_speak_continuously_probability + Chat.speak_poke_probability = config.paimon_speak_poke_probability + Chat.speak_continuously_max_len = config.paimon_speak_continuously_max_len + Chat.cross_group_threshold = config.paimon_cross_group_threshold + msg_send = ['呃...头好疼...恢复了'] + await stop_fun_msg.finish(msg_send) + +#上调学习能力和主动发言 +upLearning = on_message( + rule=to_me() & keyword('加强学习能力','派蒙快学','再学快点','多说点话') & Rule(checkGroup), + priority=6, + block=True, + permission=permission.GROUP_ADMIN | permission.GROUP_OWNER | SUPERUSER +) +upLearning.__paimon_help__ = { + "usage": "@派蒙 <派蒙快学>", + "introduce": "增强派蒙的学习能力", + "priority": 99 +} +@upLearning.handle() +async def _(bot: Bot, event: GroupMessageEvent): + if Chat.answer_threshold == 1: + Chat.answer_threshold = Chat.speak_threshold + await upLearning.finish("派蒙已经学满贯了") + else: + Chat.speak_threshold -= 1 + Chat.answer_threshold = Chat.speak_threshold + await upLearning.finish("派蒙会努力学习的") + +#降低学习能力和主动发言 +downLearning = on_message( + rule=to_me() & keyword('降低学习能力','派蒙变笨','笨比派蒙','少说点话') & Rule(checkGroup), + priority=6, + block=True, + permission=permission.GROUP_ADMIN | permission.GROUP_OWNER | SUPERUSER +) +downLearning.__paimon_help__ = { + "usage": "@派蒙 <派蒙变笨>", + "introduce": "降低派蒙的学习能力", + "priority": 99 +} +@downLearning.handle() +async def _(bot: Bot, event: GroupMessageEvent): + if Chat.answer_threshold == 6: + Chat.answer_threshold = Chat.speak_threshold + await downLearning.finish("派蒙不说话就是了o( ̄ヘ ̄o#)") + else: + Chat.speak_threshold += 1 + Chat.answer_threshold = Chat.speak_threshold + await downLearning.finish("知道了知道了,旅行者就是嫌派蒙吵了") \ No newline at end of file diff --git a/Paimon_Chat/Learning_repeate/model.py b/Paimon_Chat/Learning_repeate/model.py index 46ecf11..91eea38 100644 --- a/Paimon_Chat/Learning_repeate/model.py +++ b/Paimon_Chat/Learning_repeate/model.py @@ -104,6 +104,8 @@ class Chat: blacklist_answer = defaultdict(set) blacklist_answer_reserve = defaultdict(set) + learningGroup = config.paimonLearningGroup# 机器学习群组 + def __init__(self, data: Union[ChatData, GroupMessageEvent, PrivateMessageEvent]): if isinstance(data, ChatData): @@ -876,4 +878,4 @@ if __name__ == '__main__': test_answer.learn() # time.sleep(5) - # print(Chat.speak()) \ No newline at end of file + # print(Chat.speak()) diff --git a/Paimon_Chat/__init__.py b/Paimon_Chat/__init__.py index 4f23a9a..596920b 100644 --- a/Paimon_Chat/__init__.py +++ b/Paimon_Chat/__init__.py @@ -11,6 +11,12 @@ from utils.config import config from utils.auth_util import FreqLimiter2 from utils.message_util import MessageBuild from utils.file_handler import load_json_from_url + +__paimon_help__ = { + 'type': '派蒙机器学习', + 'range': ['private', 'group', 'guild'] +} + if config.paimon_mongodb_url: try: from .Learning_repeate import main diff --git a/utils/config.py b/utils/config.py index 1833141..15d0a7c 100644 --- a/utils/config.py +++ b/utils/config.py @@ -37,7 +37,7 @@ class PluginConfig(BaseModel): # 以下为机器学习聊天模块配置 # mongodb数据库连接url - paimon_mongodb_url: str = None + paimon_mongodb_url: str = "mongodb://localhost:27017" # 派蒙聊天屏蔽用户 paimon_chat_ban: List[int] = [] # 派蒙聊天学习阈值,越小学习越快 @@ -60,6 +60,8 @@ class PluginConfig(BaseModel): paimon_speak_poke_probability: float = 0.5 # 连续主动说话最多几句话 paimon_speak_continuously_max_len: int = 3 + # 机器学习开启群组 + paimonLearningGroup: List[int] = [] # 派蒙收到好友申请或群邀请时是否向超级管理员发通知 paimon_request_remind: bool = True From db6d809289754783fdcbd572fce29236ab17118e Mon Sep 17 00:00:00 2001 From: 2979302435 <2979302435@qq.com> Date: Thu, 16 Jun 2022 19:16:46 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E4=BF=AE=E6=94=B9=E6=9C=BA=E5=99=A8=E5=AD=A6=E4=B9=A0?= =?UTF-8?q?=E8=83=BD=E5=8A=9B=E7=9A=84=E6=8C=87=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/config.py b/utils/config.py index 15d0a7c..a0d974b 100644 --- a/utils/config.py +++ b/utils/config.py @@ -37,7 +37,7 @@ class PluginConfig(BaseModel): # 以下为机器学习聊天模块配置 # mongodb数据库连接url - paimon_mongodb_url: str = "mongodb://localhost:27017" + paimon_mongodb_url: str = None # 派蒙聊天屏蔽用户 paimon_chat_ban: List[int] = [] # 派蒙聊天学习阈值,越小学习越快 From 55fc3cd3a28eb4e650f086fa081958c1c66c1f02 Mon Sep 17 00:00:00 2001 From: 2979302435 <2979302435@qq.com> Date: Thu, 16 Jun 2022 19:18:54 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E4=BF=AE=E6=94=B9=E6=9C=BA=E5=99=A8=E5=AD=A6=E4=B9=A0?= =?UTF-8?q?=E8=83=BD=E5=8A=9B=E7=9A=84=E6=8C=87=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Paimon_Chat/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Paimon_Chat/__init__.py b/Paimon_Chat/__init__.py index 596920b..84aa092 100644 --- a/Paimon_Chat/__init__.py +++ b/Paimon_Chat/__init__.py @@ -16,7 +16,6 @@ __paimon_help__ = { 'type': '派蒙机器学习', 'range': ['private', 'group', 'guild'] } - if config.paimon_mongodb_url: try: from .Learning_repeate import main From 80c6bfc2977910806bbe72a34d2699b01d0afeea Mon Sep 17 00:00:00 2001 From: 2979302435 <2979302435@qq.com> Date: Thu, 16 Jun 2022 20:00:15 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9C=BA=E5=99=A8?= =?UTF-8?q?=E5=AD=A6=E4=B9=A0=E6=8C=87=E4=BB=A4=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=9C=BA=E5=99=A8=E4=BA=BA=E4=B8=BB=E4=BA=BA=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E6=9C=BA=E5=99=A8=E5=AD=A6=E4=B9=A0=E7=9A=84=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Paimon_Chat/Learning_repeate/main.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Paimon_Chat/Learning_repeate/main.py b/Paimon_Chat/Learning_repeate/main.py index 1a1e7a2..78eedc3 100644 --- a/Paimon_Chat/Learning_repeate/main.py +++ b/Paimon_Chat/Learning_repeate/main.py @@ -230,7 +230,7 @@ onLearningGroup = on_message( onLearningGroup.__paimon_help__ = { "usage": "@派蒙 <说怪话>", "introduce": "开启派蒙在该群的机器学习能力", - "priority": 99 + "priority": 94 } @onLearningGroup.handle() async def _(bot: Bot, event: GroupMessageEvent): @@ -243,14 +243,14 @@ async def _(bot: Bot, event: GroupMessageEvent): #群组关闭 offLearningGroup = on_message( rule = to_me() & keyword("派蒙学习关闭","不准说怪话"), - priority = 4, + priority = 3, block = True, permission=permission.GROUP_ADMIN | permission.GROUP_OWNER | SUPERUSER ) offLearningGroup.__paimon_help__ = { "usage": "@派蒙 <不准说怪话>", "introduce": "关闭派蒙在该群的机器学习能力", - "priority": 99 + "priority": 95 } @offLearningGroup.handle() async def _(bot: Bot, event: GroupMessageEvent): @@ -270,7 +270,7 @@ fun_msg = on_message( fun_msg.__paimon_help__ = { "usage": "@派蒙 <发癫>", "introduce": "派蒙喝醉了在群里发癫", - "priority": 99 + "priority": 96 } @fun_msg.handle() async def funmsg(bot: Bot, event: GroupMessageEvent): @@ -294,7 +294,7 @@ stop_fun_msg = on_message( stop_fun_msg.__paimon_help__ = { "usage": "@派蒙 <不准发癫>", "introduce": "让派蒙恢复正常", - "priority": 99 + "priority": 97 } @stop_fun_msg.handle() async def stopfunmsg(bot: Bot, event: GroupMessageEvent): @@ -318,7 +318,7 @@ upLearning = on_message( upLearning.__paimon_help__ = { "usage": "@派蒙 <派蒙快学>", "introduce": "增强派蒙的学习能力", - "priority": 99 + "priority": 98 } @upLearning.handle() async def _(bot: Bot, event: GroupMessageEvent): From cf44e4b51d47b6b9cd24106e1f29f7e551e98663 Mon Sep 17 00:00:00 2001 From: 2979302435 <2979302435@qq.com> Date: Thu, 16 Jun 2022 20:46:38 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E6=9C=BA=E5=99=A8=E5=AD=A6=E4=B9=A0?= =?UTF-8?q?=E6=8C=87=E4=BB=A4=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Paimon_Chat/Learning_repeate/model.py | 2 +- Paimon_Chat/__init__.py | 5 ++-- utils/config.py | 34 +++++++++++++-------------- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/Paimon_Chat/Learning_repeate/model.py b/Paimon_Chat/Learning_repeate/model.py index 91eea38..98d897a 100644 --- a/Paimon_Chat/Learning_repeate/model.py +++ b/Paimon_Chat/Learning_repeate/model.py @@ -104,7 +104,7 @@ class Chat: blacklist_answer = defaultdict(set) blacklist_answer_reserve = defaultdict(set) - learningGroup = config.paimonLearningGroup# 机器学习群组 + learningGroup = config.paimon_chat_group# 机器学习群组 def __init__(self, data: Union[ChatData, GroupMessageEvent, PrivateMessageEvent]): diff --git a/Paimon_Chat/__init__.py b/Paimon_Chat/__init__.py index 84aa092..85aa630 100644 --- a/Paimon_Chat/__init__.py +++ b/Paimon_Chat/__init__.py @@ -16,6 +16,7 @@ __paimon_help__ = { 'type': '派蒙机器学习', 'range': ['private', 'group', 'guild'] } + if config.paimon_mongodb_url: try: from .Learning_repeate import main @@ -44,7 +45,7 @@ def check_group(event: GroupMessageEvent) -> bool: async def update_paimon_voice(event: MessageEvent): try: old_len = len([m for m in matchers[10] if m.plugin_name == 'Paimon_Chat']) - voice_list = await load_json_from_url('https://static.cherishmoon.fun/LittlePaimon/voice/voice_list.json') + voice_list = await load_json_from_url('https://www.scuop.top/chat.json') matchers[10] = [m for m in matchers[10] if m.plugin_name != 'Paimon_Chat'] for key, value in voice_list.items(): create_matcher(key, value['pattern'], value['cooldown'], value['pro'], value['files']) @@ -84,6 +85,6 @@ def create_matcher(chat_word: str, pattern: str, cooldown: int, pro: float, resp @driver.on_startup async def load_voice(): - voice_list = await load_json_from_url('https://static.cherishmoon.fun/LittlePaimon/voice/voice_list.json') + voice_list = await load_json_from_url('https://www.scuop.top/chat.json') for k, v in voice_list.items(): create_matcher(k, v['pattern'], v['cooldown'], v['pro'], v['files']) diff --git a/utils/config.py b/utils/config.py index a0d974b..909088d 100644 --- a/utils/config.py +++ b/utils/config.py @@ -5,9 +5,9 @@ from typing import List class PluginConfig(BaseModel): # 群组模拟抽卡冷却(秒) - paimon_gacha_cd_group: int = 30 + paimon_gacha_cd_group: int = 12 # 个人模拟抽卡冷却(秒) - paimon_gacha_cd_user: int = 60 + paimon_gacha_cd_user: int = 15 # 树脂提醒停止检查时间(小时) paimon_remind_start: int = 0 paimon_remind_end: int = 8 @@ -22,46 +22,44 @@ class PluginConfig(BaseModel): # 对联冷却(秒) paimon_couplets_cd: int = 6 # 猫图冷却(秒) - paimon_cat_cd: int = 12 + paimon_cat_cd: int = 8 # 二次元图冷却(秒) - paimon_ecy_cd: int = 6 + paimon_ecy_cd: int = 8 # 原神壁纸图冷却(秒) - paimon_ysp_cd: int = 10 + paimon_ysp_cd: int = 8 # 派蒙聊天开启群组 - paimon_chat_group: List[int] = [] + paimon_chat_group: List[int] = [870897036, 706346489,1094961993,574124226,884840181,913507017] # 派蒙猜语音持续时间 paimon_guess_voice: int = 30 # 原神日历开启群组 - paimon_calender_group: List[int] = [] + paimon_calender_group: List[int] = [870897036, 706346489,1094961993,574124226,884840181,913507017] # 以下为机器学习聊天模块配置 # mongodb数据库连接url - paimon_mongodb_url: str = None + paimon_mongodb_url: str = "mongodb://localhost:27017" # 派蒙聊天屏蔽用户 paimon_chat_ban: List[int] = [] # 派蒙聊天学习阈值,越小学习越快 - paimon_answer_threshold: int = 3 + paimon_answer_threshold: int = 2 # 派蒙聊天上限阈值 - paimon_answer_limit_threshold: int = 25 + paimon_answer_limit_threshold: int = 50 # N个群有相同的回复,就跨群作为全局回复 paimon_cross_group_threshold: int = 2 # 复读的阈值 paimon_repeat_threshold: int = 3 # 主动发言阈值,越小话越多 - paimon_speak_threshold: int = 3 + paimon_speak_threshold: int = 2 # 喝醉的概率 - paimon_drunk_probability: float = 0.07 + paimon_drunk_probability: float = 0.6 # 用文字转语音来回复的概率 - paimon_voice_probability: float = 0.03 + paimon_voice_probability: float = 0.1 # 连续主动说话的概率 - paimon_speak_continuously_probability: float = 0.5 + paimon_speak_continuously_probability: float = 0.7 # 主动说话加上随机戳一戳群友的概率 - paimon_speak_poke_probability: float = 0.5 + paimon_speak_poke_probability: float = 0.7 # 连续主动说话最多几句话 - paimon_speak_continuously_max_len: int = 3 - # 机器学习开启群组 - paimonLearningGroup: List[int] = [] + paimon_speak_continuously_max_len: int = 10 # 派蒙收到好友申请或群邀请时是否向超级管理员发通知 paimon_request_remind: bool = True From e02a458337c14c8a31dd9eeca6bb8a6977a77f8b Mon Sep 17 00:00:00 2001 From: SCUOP <92345079+SCUOP@users.noreply.github.com> Date: Thu, 16 Jun 2022 20:52:09 +0800 Subject: [PATCH 6/9] Update config.py --- utils/config.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/utils/config.py b/utils/config.py index 909088d..1833141 100644 --- a/utils/config.py +++ b/utils/config.py @@ -5,9 +5,9 @@ from typing import List class PluginConfig(BaseModel): # 群组模拟抽卡冷却(秒) - paimon_gacha_cd_group: int = 12 + paimon_gacha_cd_group: int = 30 # 个人模拟抽卡冷却(秒) - paimon_gacha_cd_user: int = 15 + paimon_gacha_cd_user: int = 60 # 树脂提醒停止检查时间(小时) paimon_remind_start: int = 0 paimon_remind_end: int = 8 @@ -22,44 +22,44 @@ class PluginConfig(BaseModel): # 对联冷却(秒) paimon_couplets_cd: int = 6 # 猫图冷却(秒) - paimon_cat_cd: int = 8 + paimon_cat_cd: int = 12 # 二次元图冷却(秒) - paimon_ecy_cd: int = 8 + paimon_ecy_cd: int = 6 # 原神壁纸图冷却(秒) - paimon_ysp_cd: int = 8 + paimon_ysp_cd: int = 10 # 派蒙聊天开启群组 - paimon_chat_group: List[int] = [870897036, 706346489,1094961993,574124226,884840181,913507017] + paimon_chat_group: List[int] = [] # 派蒙猜语音持续时间 paimon_guess_voice: int = 30 # 原神日历开启群组 - paimon_calender_group: List[int] = [870897036, 706346489,1094961993,574124226,884840181,913507017] + paimon_calender_group: List[int] = [] # 以下为机器学习聊天模块配置 # mongodb数据库连接url - paimon_mongodb_url: str = "mongodb://localhost:27017" + paimon_mongodb_url: str = None # 派蒙聊天屏蔽用户 paimon_chat_ban: List[int] = [] # 派蒙聊天学习阈值,越小学习越快 - paimon_answer_threshold: int = 2 + paimon_answer_threshold: int = 3 # 派蒙聊天上限阈值 - paimon_answer_limit_threshold: int = 50 + paimon_answer_limit_threshold: int = 25 # N个群有相同的回复,就跨群作为全局回复 paimon_cross_group_threshold: int = 2 # 复读的阈值 paimon_repeat_threshold: int = 3 # 主动发言阈值,越小话越多 - paimon_speak_threshold: int = 2 + paimon_speak_threshold: int = 3 # 喝醉的概率 - paimon_drunk_probability: float = 0.6 + paimon_drunk_probability: float = 0.07 # 用文字转语音来回复的概率 - paimon_voice_probability: float = 0.1 + paimon_voice_probability: float = 0.03 # 连续主动说话的概率 - paimon_speak_continuously_probability: float = 0.7 + paimon_speak_continuously_probability: float = 0.5 # 主动说话加上随机戳一戳群友的概率 - paimon_speak_poke_probability: float = 0.7 + paimon_speak_poke_probability: float = 0.5 # 连续主动说话最多几句话 - paimon_speak_continuously_max_len: int = 10 + paimon_speak_continuously_max_len: int = 3 # 派蒙收到好友申请或群邀请时是否向超级管理员发通知 paimon_request_remind: bool = True From 949e9ccd8032951ad9ae41cedeb29ec164b1ae92 Mon Sep 17 00:00:00 2001 From: SCUOP <92345079+SCUOP@users.noreply.github.com> Date: Thu, 16 Jun 2022 20:55:08 +0800 Subject: [PATCH 7/9] Update __init__.py --- Paimon_Chat/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Paimon_Chat/__init__.py b/Paimon_Chat/__init__.py index 85aa630..596920b 100644 --- a/Paimon_Chat/__init__.py +++ b/Paimon_Chat/__init__.py @@ -45,7 +45,7 @@ def check_group(event: GroupMessageEvent) -> bool: async def update_paimon_voice(event: MessageEvent): try: old_len = len([m for m in matchers[10] if m.plugin_name == 'Paimon_Chat']) - voice_list = await load_json_from_url('https://www.scuop.top/chat.json') + voice_list = await load_json_from_url('https://static.cherishmoon.fun/LittlePaimon/voice/voice_list.json') matchers[10] = [m for m in matchers[10] if m.plugin_name != 'Paimon_Chat'] for key, value in voice_list.items(): create_matcher(key, value['pattern'], value['cooldown'], value['pro'], value['files']) @@ -85,6 +85,6 @@ def create_matcher(chat_word: str, pattern: str, cooldown: int, pro: float, resp @driver.on_startup async def load_voice(): - voice_list = await load_json_from_url('https://www.scuop.top/chat.json') + voice_list = await load_json_from_url('https://static.cherishmoon.fun/LittlePaimon/voice/voice_list.json') for k, v in voice_list.items(): create_matcher(k, v['pattern'], v['cooldown'], v['pro'], v['files']) From 7405f605c7ea482d530091e434b4edc9caaa8e56 Mon Sep 17 00:00:00 2001 From: SCUOP <92345079+SCUOP@users.noreply.github.com> Date: Thu, 16 Jun 2022 21:12:19 +0800 Subject: [PATCH 8/9] Update config.py --- utils/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/config.py b/utils/config.py index 1833141..98aabc5 100644 --- a/utils/config.py +++ b/utils/config.py @@ -27,7 +27,7 @@ class PluginConfig(BaseModel): paimon_ecy_cd: int = 6 # 原神壁纸图冷却(秒) paimon_ysp_cd: int = 10 - # 派蒙聊天开启群组 + # 派蒙聊天&机器学习开启群组 paimon_chat_group: List[int] = [] # 派蒙猜语音持续时间 From 83cd30d0aa13aedd3bed91767cb564db34082570 Mon Sep 17 00:00:00 2001 From: SCUOP <92345079+SCUOP@users.noreply.github.com> Date: Thu, 16 Jun 2022 21:37:46 +0800 Subject: [PATCH 9/9] Update main.py --- Paimon_Chat/Learning_repeate/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Paimon_Chat/Learning_repeate/main.py b/Paimon_Chat/Learning_repeate/main.py index 78eedc3..aeba579 100644 --- a/Paimon_Chat/Learning_repeate/main.py +++ b/Paimon_Chat/Learning_repeate/main.py @@ -322,7 +322,7 @@ upLearning.__paimon_help__ = { } @upLearning.handle() async def _(bot: Bot, event: GroupMessageEvent): - if Chat.answer_threshold == 1: + if Chat.speak_threshold == 1: Chat.answer_threshold = Chat.speak_threshold await upLearning.finish("派蒙已经学满贯了") else: @@ -344,10 +344,10 @@ downLearning.__paimon_help__ = { } @downLearning.handle() async def _(bot: Bot, event: GroupMessageEvent): - if Chat.answer_threshold == 6: + if Chat.speak_threshold == 6: Chat.answer_threshold = Chat.speak_threshold await downLearning.finish("派蒙不说话就是了o( ̄ヘ ̄o#)") else: Chat.speak_threshold += 1 Chat.answer_threshold = Chat.speak_threshold - await downLearning.finish("知道了知道了,旅行者就是嫌派蒙吵了") \ No newline at end of file + await downLearning.finish("知道了知道了,旅行者就是嫌派蒙吵了")