From 7a35b06d4e081ce36dffff800954d7cd4df4bbef Mon Sep 17 00:00:00 2001 From: YoursFunny Date: Fri, 22 Mar 2024 19:04:30 +0800 Subject: [PATCH] fix channel check --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 071925f..3b28f3f 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,6 @@ from aiohttp import ClientSession from telegram import Update, Chat -from telegram.constants import ParseMode, ChatAction +from telegram.constants import ParseMode, ChatAction, ChatType from telegram.ext import ( Application, ApplicationBuilder, @@ -56,7 +56,7 @@ async def cmd_set_forward_channel(update: Update, context: ContextTypes.DEFAULT_ except Exception as e: await update.effective_message.reply_text(str(e)) return - if channel.type != "CHANNEL": + if channel.type != ChatType.CHANNEL: await update.effective_message.reply_text("That is not a channel.") return channel_admin = await channel.get_administrators()