mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-09 13:50:00 +08:00
✨ 添加bot画像
* ✨ 新增自我介绍功能及自动发送图片支持 - 在 bot_profile.py 中实现自我介绍指令及重载功能 - 在 group_handle 中添加自动发送自我介绍图片的逻辑 - 在 fg_request 中实现添加好友时自动发送自我介绍图片 - 新增 bot_profile_manager.py 管理 BOT 自我介绍及图片生成 - 更新 models.py 以支持插件自我介绍和注意事项字段 * 🎨 调整管理帮助宽度 * ✨ 更新数据访问层,优化获取数据的方法并引入缓存机制 * ✨ 更新用户数据访问逻辑,优化获取用户信息的方法,使用新的函数替代原有实现 * ✨ 在 BotProfileManager 中添加自我介绍文件不存在的日志记录,优化文件读取逻辑 * ✨ 更新 BOT 自我介绍帮助信息,增加文件不存在时自动创建功能
This commit is contained in:
@@ -344,6 +344,16 @@ class ShopManage:
|
||||
if goods_name.isdigit():
|
||||
try:
|
||||
user = await UserConsole.get_user(user_id=session.user.id)
|
||||
goods_list = await GoodsInfo.filter(uuid__in=user.props.keys()).all()
|
||||
goods_by_uuid = {item.uuid: item for item in goods_list}
|
||||
props_str = str(user.props)
|
||||
user.props = {
|
||||
uuid: count
|
||||
for uuid, count in user.props.items()
|
||||
if count > 0 and goods_by_uuid.get(uuid)
|
||||
}
|
||||
if props_str != str(user.props):
|
||||
await user.save(update_fields=["props"])
|
||||
uuid = list(user.props.keys())[int(goods_name)]
|
||||
goods_info = await GoodsInfo.get_or_none(uuid=uuid)
|
||||
except IndexError:
|
||||
@@ -501,11 +511,14 @@ class ShopManage:
|
||||
|
||||
goods_list = await GoodsInfo.filter(uuid__in=user.props.keys()).all()
|
||||
goods_by_uuid = {item.uuid: item for item in goods_list}
|
||||
props_str = str(user.props)
|
||||
user.props = {
|
||||
uuid: count
|
||||
for uuid, count in user.props.items()
|
||||
if count > 0 and goods_by_uuid.get(uuid)
|
||||
}
|
||||
if props_str != str(user.props):
|
||||
await user.save(update_fields=["props"])
|
||||
|
||||
table_rows = []
|
||||
for i, prop_uuid in enumerate(user.props):
|
||||
|
||||
Reference in New Issue
Block a user