显示回复概率为百分数
This commit is contained in:
@@ -100,7 +100,9 @@ class ChatBot:
|
|||||||
)
|
)
|
||||||
current_willing = willing_manager.get_willing(event.group_id)
|
current_willing = willing_manager.get_willing(event.group_id)
|
||||||
|
|
||||||
print(f"\033[1;32m[{current_time}][{message.group_name}]{message.user_nickname}:\033[0m {message.processed_plain_text}\033[1;36m[回复意愿:{current_willing:.2f}][概率:{reply_probability:.1f}]\033[0m")
|
|
||||||
|
print(f"\033[1;32m[{current_time}][{message.group_name}]{message.user_nickname}:\033[0m {message.processed_plain_text}\033[1;36m[回复意愿:{current_willing:.2f}][概率:{reply_probability * 100:.1f}%]\033[0m")
|
||||||
|
|
||||||
response = ""
|
response = ""
|
||||||
|
|
||||||
if random() < reply_probability:
|
if random() < reply_probability:
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class WillingManager:
|
|||||||
|
|
||||||
self.group_reply_willing[group_id] = min(current_willing, 3.0)
|
self.group_reply_willing[group_id] = min(current_willing, 3.0)
|
||||||
|
|
||||||
reply_probability = (current_willing - 0.5) * 2
|
reply_probability = max((current_willing - 0.5) * 2, 0)
|
||||||
if group_id not in config.talk_allowed_groups:
|
if group_id not in config.talk_allowed_groups:
|
||||||
current_willing = 0
|
current_willing = 0
|
||||||
reply_probability = 0
|
reply_probability = 0
|
||||||
@@ -61,6 +61,7 @@ class WillingManager:
|
|||||||
# if is_mentioned_bot and user_id == int(1026294844):
|
# if is_mentioned_bot and user_id == int(1026294844):
|
||||||
# reply_probability = 1
|
# reply_probability = 1
|
||||||
|
|
||||||
|
reply_probability = min(reply_probability, 1)
|
||||||
return reply_probability
|
return reply_probability
|
||||||
|
|
||||||
def change_reply_willing_sent(self, group_id: int):
|
def change_reply_willing_sent(self, group_id: int):
|
||||||
|
|||||||
Reference in New Issue
Block a user