iShotaBot/modules/post.py

31 lines
712 B
Python
Raw Permalink Normal View History

2022-10-05 15:15:35 +00:00
from pyrogram import Client, filters
from defs.glover import admin
from pyrogram.types import Message
from defs.post import LofterPost
from init import bot
2022-10-05 15:15:35 +00:00
@bot.on_message(
2023-01-12 13:19:54 +00:00
filters.incoming
& filters.private
& filters.user(admin)
& filters.command(["lofter_post"])
)
2022-10-05 15:15:35 +00:00
async def lofter_post_command(client: Client, message: Message):
"""
2023-01-12 13:19:54 +00:00
抓取 lofter 粮单
2022-10-05 15:15:35 +00:00
"""
data = message.text.split(" ")
offset = 0
if len(data) < 2:
await message.reply("参数错误")
return
elif len(data) == 2:
url = data[1]
else:
url = data[1]
offset = data[2]
data = LofterPost(url, offset)
client.loop.create_task(data.upload(message))