mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-09-28 16:20:56 +08:00
删除了昵称系统的完整实现,包括: - 移除 nickname.py 插件文件及其所有功能代码 - 从 FriendUser 和 GroupInfoUser 模型中删除 nickname 字段 - 移除相关的数据库配置 - 更新 GroupManager 中的操作者名称获取逻辑 - 简化平台处理的数据源代码
34 lines
1.0 KiB
Python
34 lines
1.0 KiB
Python
from tortoise import fields
|
|
|
|
from zhenxun.services.db_context import Model
|
|
|
|
|
|
class FriendUser(Model):
|
|
id = fields.IntField(pk=True, generated=True, auto_increment=True)
|
|
"""自增id"""
|
|
user_id = fields.CharField(255, unique=True, description="用户id")
|
|
"""用户id"""
|
|
user_name = fields.CharField(max_length=255, default="", description="用户名称")
|
|
"""用户名称"""
|
|
platform = fields.CharField(255, null=True, description="平台")
|
|
"""平台"""
|
|
|
|
class Meta: # pyright: ignore [reportIncompatibleVariableOverride]
|
|
table = "friend_users"
|
|
table_description = "好友信息数据表"
|
|
|
|
@classmethod
|
|
async def get_user_name(cls, user_id: str) -> str:
|
|
"""获取好友用户名称
|
|
|
|
参数:
|
|
user_id: 用户id
|
|
"""
|
|
if user := await cls.get_or_none(user_id=user_id):
|
|
return user.user_name
|
|
return ""
|
|
|
|
@classmethod
|
|
def _run_script(cls):
|
|
return ["ALTER TABLE friend_users DROP COLUMN nickname;"]
|