删除群聊学习中和语音合成有关的内容

This commit is contained in:
CMHopeSunshine 2022-10-02 15:20:49 +08:00
parent 607ac17262
commit b40535e45f
5 changed files with 31 additions and 27 deletions

View File

@ -166,6 +166,7 @@ async def _(event: MessageEvent):
msg = f'{NICKNAME}明明没有在学你们说话!' msg = f'{NICKNAME}明明没有在学你们说话!'
else: else:
msg = random.choice([f'你管得着{NICKNAME}吗!', f'你可没有权限要求{NICKNAME}']) msg = random.choice([f'你管得着{NICKNAME}吗!', f'你可没有权限要求{NICKNAME}'])
config_manager.save()
await set_enable.finish(msg) await set_enable.finish(msg)

View File

@ -18,7 +18,6 @@ class ChatConfig(BaseModel):
repeat_threshold: int = Field(3, alias='复读阈值') repeat_threshold: int = Field(3, alias='复读阈值')
speak_threshold: int = Field(5, alias='主动发言阈值') speak_threshold: int = Field(5, alias='主动发言阈值')
split_probability: float = Field(0.5, alias='按逗号分割回复概率') split_probability: float = Field(0.5, alias='按逗号分割回复概率')
voice_probability: float = Field(0.1, alias='以语音回复概率')
speak_continuously_probability: float = Field(0.5, alias='连续主动发言概率') speak_continuously_probability: float = Field(0.5, alias='连续主动发言概率')
speak_poke_probability: float = Field(0.5, alias='主动发言附带戳一戳概率') speak_poke_probability: float = Field(0.5, alias='主动发言附带戳一戳概率')
speak_continuously_max_len: int = Field(3, alias='最大连续说话句数') speak_continuously_max_len: int = Field(3, alias='最大连续说话句数')

View File

@ -166,10 +166,7 @@ class LearningChat:
'reply': item, 'reply': item,
'reply_keywords': answer_keywords, 'reply_keywords': answer_keywords,
}) })
if '[CQ:' not in item and len(item) > 1 and random.random() < config.voice_probability: yield item
yield MessageSegment.record(f'http://233366.proxy.nscc-gz.cn:8888/?text={item}&speaker=派蒙')
else:
yield item
with LearningChat._reply_lock: with LearningChat._reply_lock:
LearningChat.reply_cache[self.message.group_id][self.message.bot_id] = \ LearningChat.reply_cache[self.message.group_id][self.message.bot_id] = \

View File

@ -136,7 +136,7 @@ async def draw_statistics_img(data: Dict[str, Any]):
} }
avatar = await get_group_avatar(data['群号']) avatar = await get_group_avatar(data['群号'])
await img.paste(avatar, (38, 47)) await img.paste(avatar, (38, 47))
await img.text(data['群名称'], 162, 63, fm.get('hywh', 48), '#040404') await img.text(data['群名称'], 162, 58, fm.get('hywh', 48), '#040404')
await img.text(data['群号'], 165, 116, fm.get('hywh', 36), '#040404') await img.text(data['群号'], 165, 116, fm.get('hywh', 36), '#040404')
await img.text(f'CREATED BY LITTLEPAIMON AT {datetime.datetime.now().strftime("%m-%d %H:%M")}', await img.text(f'CREATED BY LITTLEPAIMON AT {datetime.datetime.now().strftime("%m-%d %H:%M")}',
1033, 195, fm.get('bahnschrift_regular.ttf', 30), '#8c4c2e', 'right') 1033, 195, fm.get('bahnschrift_regular.ttf', 30), '#8c4c2e', 'right')
@ -202,30 +202,33 @@ async def draw_statistics_img(data: Dict[str, Any]):
tag = await load_image(RESOURCE_BASE_PATH / 'general' / 'tag.png') tag = await load_image(RESOURCE_BASE_PATH / 'general' / 'tag.png')
# 角色出场率 # 角色出场率
for i in range(4): for i in range(4):
icon, rarity, count = data['11层上半'][i][0].split('-')[0], data['11层上半'][i][0].split('-')[1], data['11层上半'][i][1] try:
await img.paste(box[f'{rarity}bg'], (182 + i * 101, 867)) icon, rarity, count = data['11层上半'][i][0].split('-')[0], data['11层上半'][i][0].split('-')[1], data['11层上半'][i][1]
await img.paste(await load_image(RESOURCE_BASE_PATH / 'avatar' / f'{icon}.png', size=(95, 95)), (182 + i * 101, 867)) await img.paste(box[f'{rarity}bg'], (182 + i * 101, 867))
await img.paste(tag, (236 + i * 101, 942)) await img.paste(await load_image(RESOURCE_BASE_PATH / 'avatar' / f'{icon}.png', size=(95, 95)), (182 + i * 101, 867))
await img.text(str(count), (236 + i * 101, 277 + i * 101), 943, fm.get('bahnschrift_regular.ttf', 19), 'white', 'center') await img.paste(tag, (236 + i * 101, 942))
await img.text(str(count), (236 + i * 101, 277 + i * 101), 943, fm.get('bahnschrift_regular.ttf', 19), 'white', 'center')
icon, rarity, count = data['11层下半'][i][0].split('-')[0], data['11层下半'][i][0].split('-')[1], data['11层下半'][i][1] icon, rarity, count = data['11层下半'][i][0].split('-')[0], data['11层下半'][i][0].split('-')[1], data['11层下半'][i][1]
await img.paste(box[f'{rarity}bg'], (642 + i * 101, 867)) await img.paste(box[f'{rarity}bg'], (642 + i * 101, 867))
await img.paste(await load_image(RESOURCE_BASE_PATH / 'avatar' / f'{icon}.png', size=(95, 95)), (642 + i * 101, 867)) await img.paste(await load_image(RESOURCE_BASE_PATH / 'avatar' / f'{icon}.png', size=(95, 95)), (642 + i * 101, 867))
await img.paste(tag, (696 + i * 101, 942)) await img.paste(tag, (696 + i * 101, 942))
await img.text(str(count), (696 + i * 101, 737 + i * 101), 943, fm.get('bahnschrift_regular.ttf', 19), 'white', 'center') await img.text(str(count), (696 + i * 101, 737 + i * 101), 943, fm.get('bahnschrift_regular.ttf', 19), 'white', 'center')
icon, rarity, count = data['12层上半'][i][0].split('-')[0], data['12层上半'][i][0].split('-')[1], data['12层上半'][i][1] icon, rarity, count = data['12层上半'][i][0].split('-')[0], data['12层上半'][i][0].split('-')[1], data['12层上半'][i][1]
await img.paste(box[f'{rarity}bg'], (182 + i * 101, 983)) await img.paste(box[f'{rarity}bg'], (182 + i * 101, 983))
await img.paste(await load_image(RESOURCE_BASE_PATH / 'avatar' / f'{icon}.png', size=(95, 95)), (182 + i * 101, 983)) await img.paste(await load_image(RESOURCE_BASE_PATH / 'avatar' / f'{icon}.png', size=(95, 95)), (182 + i * 101, 983))
await img.paste(tag, (236 + i * 101, 1058)) await img.paste(tag, (236 + i * 101, 1058))
await img.text(str(count), (236 + i * 101, 278 + i * 101), 1059, fm.get('bahnschrift_regular.ttf', 19), 'white', 'center') await img.text(str(count), (236 + i * 101, 278 + i * 101), 1059, fm.get('bahnschrift_regular.ttf', 19), 'white', 'center')
icon, rarity, count = data['12层下半'][i][0].split('-')[0], data['12层下半'][i][0].split('-')[1], data['12层下半'][i][1] icon, rarity, count = data['12层下半'][i][0].split('-')[0], data['12层下半'][i][0].split('-')[1], data['12层下半'][i][1]
await img.paste(box[f'{rarity}bg'], (642 + i * 101, 983)) await img.paste(box[f'{rarity}bg'], (642 + i * 101, 983))
await img.paste(await load_image(RESOURCE_BASE_PATH / 'avatar' / f'{icon}.png', size=(95, 95)), (642 + i * 101, 983)) await img.paste(await load_image(RESOURCE_BASE_PATH / 'avatar' / f'{icon}.png', size=(95, 95)), (642 + i * 101, 983))
await img.paste(tag, (696 + i * 101, 1058)) await img.paste(tag, (696 + i * 101, 1058))
await img.text(str(count), (696 + i * 101, 737 + i * 101), 1059, fm.get('bahnschrift_regular.ttf', 19), 'white', 'center') await img.text(str(count), (696 + i * 101, 737 + i * 101), 1059, fm.get('bahnschrift_regular.ttf', 19), 'white', 'center')
i += 1 i += 1
except IndexError:
pass
return MessageBuild.Image(img, mode='RGB', quality=80) return MessageBuild.Image(img, mode='RGB', quality=80)

View File

@ -22,3 +22,7 @@ class logger:
@staticmethod @staticmethod
def warning(command: str, info: str = '', action: str = ''): def warning(command: str, info: str = '', action: str = ''):
nb_logger.opt(colors=True).warning(f'<u><y>[{command}]</y></u>{info}<m>{action}</m>') nb_logger.opt(colors=True).warning(f'<u><y>[{command}]</y></u>{info}<m>{action}</m>')
@staticmethod
def debug(command: str, info: str):
nb_logger.opt(colors=True).debug(f'<u><y>[{command}]</y></u>{info}')