🐛 del command only for channel

This commit is contained in:
xtaodada 2023-09-10 13:36:50 +08:00
parent 1cd96818c5
commit 733a78e004
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659

View File

@ -4,7 +4,7 @@ from urllib.parse import urlparse
from pydantic import BaseModel from pydantic import BaseModel
from pyrogram import Client, filters, ContinuePropagation from pyrogram import Client, filters, ContinuePropagation
from pyrogram.enums import MessageEntityType from pyrogram.enums import MessageEntityType, ChatType
from pyrogram.types import Message from pyrogram.types import Message
from defs.fix_twitter_api import ( from defs.fix_twitter_api import (
@ -148,7 +148,7 @@ async def twitter_share(_: Client, message: Message):
# 过滤绑定频道的转发 # 过滤绑定频道的转发
return return
mid = message.id mid = message.id
if message.text.startswith("del"): if message.text.startswith("del") and message.chat.type == ChatType.CHANNEL:
with contextlib.suppress(Exception): with contextlib.suppress(Exception):
await message.delete() await message.delete()
mid = None mid = None