临时调整权限模块,备份
This commit is contained in:
@@ -22,6 +22,10 @@ class DouyinParserError(Exception):
|
||||
class DouyinParserPlugin(MessagePluginInterface):
|
||||
"""抖音无水印解析插件"""
|
||||
|
||||
# 功能权限常量
|
||||
FEATURE_KEY = "DOUYIN_PARSER"
|
||||
FEATURE_DESCRIPTION = "🎵 抖音解析功能 [自动解析抖音链接]"
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
return "抖音解析"
|
||||
@@ -46,10 +50,20 @@ class DouyinParserPlugin(MessagePluginInterface):
|
||||
def commands(self) -> List[str]:
|
||||
return [] # 不使用命令触发,而是通过消息内容匹配
|
||||
|
||||
@property
|
||||
def feature_key(self) -> Optional[str]:
|
||||
return self.FEATURE_KEY
|
||||
|
||||
@property
|
||||
def feature_description(self) -> Optional[str]:
|
||||
return self.FEATURE_DESCRIPTION
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.LOG = logger
|
||||
self.url_pattern = re.compile(r'https?://v\.douyin\.com/\w+/?')
|
||||
# 注册功能权限
|
||||
self.feature = self.register_feature()
|
||||
# 修改为使用插件目录下的down_load_dir文件夹
|
||||
self.download_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "down_load_dir")
|
||||
# 确保下载目录存在
|
||||
@@ -105,7 +119,7 @@ class DouyinParserPlugin(MessagePluginInterface):
|
||||
|
||||
bot: WechatAPIClient = message.get("bot")
|
||||
# 检查权限
|
||||
if roomid and gbm.get_group_permission(roomid, Feature.DOUYIN_PARSER) == PermissionStatus.DISABLED:
|
||||
if roomid and gbm.get_group_permission(roomid, self.feature) == PermissionStatus.DISABLED:
|
||||
return False, "没有权限"
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user