mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 06:12:53 +08:00
修复词条在某些回答下出错
This commit is contained in:
parent
def53aa22e
commit
2070014021
@ -299,6 +299,11 @@ PS: **ARM平台** 请使用全量版 同时 **如果你的机器 RAM < 1G 可能
|
||||
|
||||
## 更新
|
||||
|
||||
### 2022/12/31
|
||||
|
||||
* 修复epic报错,优化简介 [@pull/1226](https://github.com/HibiKier/zhenxun_bot/pull/1226)
|
||||
* 修复词条在某些回答下出错
|
||||
|
||||
### 2022/12/27 \[v0.1.6.6]
|
||||
|
||||
* 添加权限检查依赖注入
|
||||
|
||||
@ -144,7 +144,7 @@ class AuthChecker:
|
||||
try:
|
||||
plugin_name = matcher.plugin_name
|
||||
cost_gold = await self.auth_cost(plugin_name, bot, event)
|
||||
if str(event.user_id) not in bot.config.superusers:
|
||||
if hasattr(event, "user_id") and str(event.user_id) not in bot.config.superusers:
|
||||
await self.auth_basic(plugin_name, bot, event)
|
||||
self.auth_group(plugin_name, bot, event)
|
||||
await self.auth_admin(plugin_name, matcher, bot, event)
|
||||
|
||||
@ -9,13 +9,13 @@ def init_plugins_settings():
|
||||
"""
|
||||
初始化插件设置,从插件中获取 __zx_plugin_name__,__plugin_cmd__,__plugin_settings__
|
||||
"""
|
||||
for x in plugins2settings_manager.keys():
|
||||
try:
|
||||
_plugin = nonebot.plugin.get_plugin(x)
|
||||
_module = _plugin.module
|
||||
_module.__getattribute__("__zx_plugin_name__")
|
||||
except (KeyError, AttributeError) as e:
|
||||
logger.warning(f"配置文件 模块:{x} 获取 plugin_name 失败...{e}")
|
||||
# for x in plugins2settings_manager.keys():
|
||||
# try:
|
||||
# _plugin = nonebot.plugin.get_plugin(x)
|
||||
# _module = _plugin.module
|
||||
# _module.__getattribute__("__zx_plugin_name__")
|
||||
# except (KeyError, AttributeError) as e:
|
||||
# logger.warning(f"配置文件 模块:{x} 获取 plugin_name 失败...{e}")
|
||||
for matcher in get_matchers(True):
|
||||
try:
|
||||
if matcher.plugin_name not in plugins2settings_manager.keys():
|
||||
|
||||
@ -194,8 +194,8 @@ class WordBank(db.Model):
|
||||
& (cls.answer == answer)
|
||||
).gino.first()
|
||||
if query and query.placeholder:
|
||||
type_list = re.findall(rf"\[(.*):placeholder_.*]", answer)
|
||||
temp_answer = re.sub(rf"\[(.*):placeholder_.*]", "{}", answer)
|
||||
type_list = re.findall(rf"\[(.*?):placeholder_.*?]", answer)
|
||||
temp_answer = re.sub(rf"\[(.*?):placeholder_.*?]", "{}", answer)
|
||||
seg_list = []
|
||||
for t, p in zip(type_list, query.placeholder.split(",")):
|
||||
if t == "image":
|
||||
@ -207,7 +207,6 @@ class WordBank(db.Model):
|
||||
return MessageTemplate(temp_answer, Message).format(*seg_list)
|
||||
return answer
|
||||
|
||||
|
||||
@classmethod
|
||||
async def check(
|
||||
cls,
|
||||
|
||||
@ -192,7 +192,7 @@ class BuildImage:
|
||||
if plain_text:
|
||||
if not color:
|
||||
color = (255, 255, 255, 0)
|
||||
ttf_w, ttf_h = self.getsize(plain_text)
|
||||
ttf_w, ttf_h = self.getsize(str(plain_text))
|
||||
self.w = self.w if self.w > ttf_w else ttf_w
|
||||
self.h = self.h if self.h > ttf_h else ttf_h
|
||||
self.markImg = Image.new(image_mode, (self.w, self.h), color)
|
||||
@ -229,7 +229,7 @@ class BuildImage:
|
||||
self.size = self.w, self.h
|
||||
if plain_text:
|
||||
fill = font_color if font_color else (0, 0, 0)
|
||||
self.text((0, 0), plain_text, fill)
|
||||
self.text((0, 0), str(plain_text), fill)
|
||||
try:
|
||||
self.loop = asyncio.get_event_loop()
|
||||
except RuntimeError:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user