mirror of https://github.com/Mai-with-u/MaiBot.git
pull/541/head
parent
94d0acdd0c
commit
937024d944
|
|
@ -8,6 +8,7 @@ from .chat_stream import ChatStream
|
||||||
|
|
||||||
class WillingManager:
|
class WillingManager:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
self.chat_reply_willing: Dict[str, float] = {} # 存储每个聊天流的回复意愿
|
||||||
self.chat_reply_willing: Dict[str, float] = {} # 存储每个聊天流的回复意愿
|
self.chat_reply_willing: Dict[str, float] = {} # 存储每个聊天流的回复意愿
|
||||||
self._decay_task = None
|
self._decay_task = None
|
||||||
self._started = False
|
self._started = False
|
||||||
|
|
@ -18,6 +19,8 @@ class WillingManager:
|
||||||
await asyncio.sleep(5)
|
await asyncio.sleep(5)
|
||||||
for chat_id in self.chat_reply_willing:
|
for chat_id in self.chat_reply_willing:
|
||||||
self.chat_reply_willing[chat_id] = max(0, self.chat_reply_willing[chat_id] * 0.6)
|
self.chat_reply_willing[chat_id] = max(0, self.chat_reply_willing[chat_id] * 0.6)
|
||||||
|
for chat_id in self.chat_reply_willing:
|
||||||
|
self.chat_reply_willing[chat_id] = max(0, self.chat_reply_willing[chat_id] * 0.6)
|
||||||
|
|
||||||
def get_willing(self,chat_stream:ChatStream) -> float:
|
def get_willing(self,chat_stream:ChatStream) -> float:
|
||||||
"""获取指定聊天流的回复意愿"""
|
"""获取指定聊天流的回复意愿"""
|
||||||
|
|
@ -25,7 +28,9 @@ class WillingManager:
|
||||||
if stream:
|
if stream:
|
||||||
return self.chat_reply_willing.get(stream.stream_id, 0)
|
return self.chat_reply_willing.get(stream.stream_id, 0)
|
||||||
return 0
|
return 0
|
||||||
|
def set_willing(self, chat_id: str, willing: float):
|
||||||
|
"""设置指定聊天流的回复意愿"""
|
||||||
|
self.chat_reply_willing[chat_id] = willing
|
||||||
def set_willing(self, chat_id: str, willing: float):
|
def set_willing(self, chat_id: str, willing: float):
|
||||||
"""设置指定聊天流的回复意愿"""
|
"""设置指定聊天流的回复意愿"""
|
||||||
self.chat_reply_willing[chat_id] = willing
|
self.chat_reply_willing[chat_id] = willing
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue