mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-14 00:20:06 +08:00
update v0.0.5.0
This commit is contained in:
+28
-13
@@ -4,13 +4,28 @@ from nonebot.adapters.cqhttp import Bot, MessageEvent, GroupMessageEvent
|
||||
from nonebot.typing import T_State
|
||||
from utils.utils import scheduler, get_bot
|
||||
from .data_source import get_epic_game
|
||||
from models.group_remind import GroupRemind
|
||||
from nonebot.adapters.cqhttp.exception import ActionFailed
|
||||
|
||||
__plugin_name__ = "epic免费游戏提醒"
|
||||
|
||||
__plugin_usage__ = "用法:发送’epic‘"
|
||||
from utils.manager import group_manager
|
||||
|
||||
__zx_plugin_name__ = "epic免费游戏"
|
||||
__plugin_usage__ = """
|
||||
usage:
|
||||
可以不玩,不能没有,每日白嫖
|
||||
指令:
|
||||
epic
|
||||
""".strip()
|
||||
__plugin_des__ = "可以不玩,不能没有,每日白嫖"
|
||||
__plugin_cmd__ = ["epic"]
|
||||
__plugin_version__ = 0.1
|
||||
__plugin_author__ = "HibiKier"
|
||||
__plugin_settings__ = {
|
||||
"level": 5,
|
||||
"default_status": True,
|
||||
"limit_superuser": False,
|
||||
"cmd": ["epic"],
|
||||
}
|
||||
__plugin_task__ = {
|
||||
'epic_free_game': 'epic免费游戏'
|
||||
}
|
||||
|
||||
epic = on_command("epic", priority=5, block=True)
|
||||
|
||||
@@ -33,13 +48,13 @@ async def _(bot: Bot, event: MessageEvent, state: T_State):
|
||||
)
|
||||
async def _():
|
||||
bot = get_bot()
|
||||
gl = await bot.get_group_list(self_id=bot.self_id)
|
||||
gl = await bot.get_group_list()
|
||||
gl = [g["group_id"] for g in gl]
|
||||
for g in gl:
|
||||
if await GroupRemind.get_status(g, "epic"):
|
||||
result, code = await get_epic_game()
|
||||
if code == 200:
|
||||
try:
|
||||
if await group_manager.check_group_task_status(g, 'epic_free_game'):
|
||||
try:
|
||||
result, code = await get_epic_game()
|
||||
if code == 200:
|
||||
await bot.send_group_msg(group_id=g, message=result)
|
||||
except ActionFailed:
|
||||
logger.error(f"{g}群 epic免费游戏推送错误")
|
||||
except Exception as e:
|
||||
logger.error(f"GROUP {g} epic免费游戏推送错误 {type(e)}: {e}")
|
||||
|
||||
Reference in New Issue
Block a user