Add archive plugins
This commit is contained in:
parent
2e2c8be00b
commit
55c82950b6
@ -118,7 +118,12 @@ tg:
|
||||
format: -tg
|
||||
usage: 舔狗语录
|
||||
|
||||
test:
|
||||
cmd: t
|
||||
format: -t
|
||||
usage: 测试
|
||||
archive:
|
||||
cmd: arch
|
||||
format: -arch
|
||||
usage: 归档当前对话
|
||||
|
||||
unarchive:
|
||||
cmd: unarch
|
||||
format: -unarch
|
||||
usage: 撤销归档当前对话
|
||||
|
24
plugins/archive.py
Normal file
24
plugins/archive.py
Normal file
@ -0,0 +1,24 @@
|
||||
import asyncio
|
||||
from core import command
|
||||
from pyrogram import Client
|
||||
from pyrogram.types import Message
|
||||
|
||||
|
||||
@Client.on_message(command("archive"))
|
||||
async def archive(cli: Client, msg: Message):
|
||||
if await cli.archive_chats(msg.chat.id):
|
||||
await msg.edit_text(f"✅ Archive `{msg.chat.title}` successfully!")
|
||||
else:
|
||||
await msg.edit_text(f"❌ Failed to archive `{msg.chat.title}`!")
|
||||
await asyncio.sleep(2)
|
||||
await msg.delete()
|
||||
|
||||
|
||||
@Client.on_message(command("unarchive"))
|
||||
async def unarchive(cli: Client, msg: Message):
|
||||
if await cli.unarchive_chats(msg.chat.id):
|
||||
await msg.edit_text(f"✅ Unarchive `{msg.chat.title}` successfully!")
|
||||
else:
|
||||
await msg.edit_text(f"❌ Failed to unarchive `{msg.chat.title}`!")
|
||||
await asyncio.sleep(2)
|
||||
await msg.delete()
|
Loading…
Reference in New Issue
Block a user