动态auth完成。
This commit is contained in:
21
robot.py
21
robot.py
@@ -1,33 +1,32 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import time
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import threading
|
import threading
|
||||||
|
import time
|
||||||
import tomllib
|
import tomllib
|
||||||
import toml
|
|
||||||
|
|
||||||
import wechat_ipad
|
import toml
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
|
import wechat_ipad
|
||||||
from base.func_epic import is_friday, get_free
|
from base.func_epic import is_friday, get_free
|
||||||
from base.func_news import News
|
from base.func_news import News
|
||||||
from configuration import Config
|
|
||||||
from base.plugin_common.event_system import EventType, EventSystem
|
from base.plugin_common.event_system import EventType, EventSystem
|
||||||
from base.plugin_common.message_plugin_interface import MessagePluginInterface
|
from base.plugin_common.message_plugin_interface import MessagePluginInterface
|
||||||
from base.plugin_common.plugin_interface import PluginStatus
|
from base.plugin_common.plugin_interface import PluginStatus
|
||||||
from base.plugin_common.plugin_manager import PluginManager
|
from base.plugin_common.plugin_manager import PluginManager
|
||||||
from base.plugin_common.plugin_registry import PluginRegistry
|
from base.plugin_common.plugin_registry import PluginRegistry
|
||||||
from utils.sehuatang.shehuatang import pdf_file_path
|
from configuration import Config
|
||||||
|
from db.connection import DBConnectionManager
|
||||||
|
from db.contacts_db import ContactsDBOperator
|
||||||
|
from plugins.xiuren_image.meitu_dl import meitu_dowload_pub_pic
|
||||||
from utils.email_util import EmailSender
|
from utils.email_util import EmailSender
|
||||||
from utils.revoke.message_auto_revoke import MessageAutoRevoke
|
from utils.revoke.message_auto_revoke import MessageAutoRevoke
|
||||||
from utils.robot_cmd.robot_command import GroupBotManager, Feature, PermissionStatus
|
from utils.robot_cmd.robot_command import GroupBotManager, Feature, PermissionStatus
|
||||||
|
from utils.sehuatang.shehuatang import pdf_file_path
|
||||||
from db.connection import DBConnectionManager
|
|
||||||
from db.contacts_db import ContactsDBOperator
|
|
||||||
from utils.wechat.contact_manager import ContactManager
|
from utils.wechat.contact_manager import ContactManager
|
||||||
from utils.wechat.message_to_db import MessageStorage
|
from utils.wechat.message_to_db import MessageStorage
|
||||||
from wechat_ipad import WechatAPIClient
|
from wechat_ipad import WechatAPIClient
|
||||||
from wechat_ipad.models.message import WxMessage, MessageType
|
from wechat_ipad.models.message import WxMessage, MessageType
|
||||||
from plugins.xiuren_image.meitu_dl import meitu_dowload_pub_pic
|
|
||||||
|
|
||||||
|
|
||||||
class Robot:
|
class Robot:
|
||||||
@@ -685,8 +684,10 @@ class Robot:
|
|||||||
receivers = self.gbm.get_group_list()
|
receivers = self.gbm.get_group_list()
|
||||||
if not receivers:
|
if not receivers:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
feature = getattr(Feature, "DAILY_SUMMARY", None)
|
||||||
for r in receivers:
|
for r in receivers:
|
||||||
if self.gbm.get_group_permission(r, Feature.DAILY_SUMMARY) == PermissionStatus.ENABLED:
|
if self.gbm.get_group_permission(r, feature) == PermissionStatus.ENABLED:
|
||||||
output = await self.message_storage.generate_and_send_ranking(r, self.allContacts)
|
output = await self.message_storage.generate_and_send_ranking(r, self.allContacts)
|
||||||
await self.ipad_bot.send_text_message(r, output)
|
await self.ipad_bot.send_text_message(r, output)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -27,12 +27,13 @@ class PermissionStatus(Enum):
|
|||||||
class Feature(Enum):
|
class Feature(Enum):
|
||||||
"""功能权限枚举,带序号"""
|
"""功能权限枚举,带序号"""
|
||||||
ROBOT = 1, "🔧 群机器人 [总开关]"
|
ROBOT = 1, "🔧 群机器人 [总开关]"
|
||||||
# DAILY_NEWS = 2, "📰 每日新闻自动播报 [每日8:30定时发送]"
|
DAILY_NEWS = 2, "📰 每日新闻自动播报 [每日8:30定时发送]"
|
||||||
|
PDF_CAPABILITY = 3, "📄 sehuatang PDF能力 [无]"
|
||||||
|
EPIC = 4, "📊 EPIC自动播报 [每周五自动发送]" # 新增的功能
|
||||||
|
|
||||||
# DAILY_SUMMARY = 3, "🕤 每日群发言总结 [每日9:30定时发送]"
|
# DAILY_SUMMARY = 3, "🕤 每日群发言总结 [每日9:30定时发送]"
|
||||||
# AI_CAPABILITY = 4, "🤖 AI对话 [ai, 聊天, AI] 用法:ai 如何写一个机器人?"
|
# AI_CAPABILITY = 4, "🤖 AI对话 [ai, 聊天, AI] 用法:ai 如何写一个机器人?"
|
||||||
# SUMMARY_CAPABILITY = 5, "📝 群总结能力 [#总结]"
|
# SUMMARY_CAPABILITY = 5, "📝 群总结能力 [#总结]"
|
||||||
# PDF_CAPABILITY = 6, "📄 sehuatang PDF能力 [无]"
|
|
||||||
# EPIC = 7, "📊 EPIC自动播报 [每周五自动发送]" # 新增的功能
|
|
||||||
# PIC = 8, "🖼️ 图来能力 [图来, 秀人]"
|
# PIC = 8, "🖼️ 图来能力 [图来, 秀人]"
|
||||||
# TASK_GAME = 9, "📚 百科答题 [/t, /s, /a 任务ID 答案]"
|
# TASK_GAME = 9, "📚 百科答题 [/t, /s, /a 任务ID 答案]"
|
||||||
# MUSIC = 10, "🎵 点歌功能 [点歌, 音乐, 音乐点播, 点播音乐, 音乐点歌]"
|
# MUSIC = 10, "🎵 点歌功能 [点歌, 音乐, 音乐点播, 点播音乐, 音乐点歌]"
|
||||||
|
|||||||
Reference in New Issue
Block a user