sycgram/plugins/archive.py
2022-04-08 10:03:33 +08:00

25 lines
807 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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()