fix channel check

This commit is contained in:
2024-03-22 19:04:30 +08:00
parent a5ae2321c5
commit 7a35b06d4e
+2 -2
View File
@@ -1,6 +1,6 @@
from aiohttp import ClientSession from aiohttp import ClientSession
from telegram import Update, Chat from telegram import Update, Chat
from telegram.constants import ParseMode, ChatAction from telegram.constants import ParseMode, ChatAction, ChatType
from telegram.ext import ( from telegram.ext import (
Application, Application,
ApplicationBuilder, ApplicationBuilder,
@@ -56,7 +56,7 @@ async def cmd_set_forward_channel(update: Update, context: ContextTypes.DEFAULT_
except Exception as e: except Exception as e:
await update.effective_message.reply_text(str(e)) await update.effective_message.reply_text(str(e))
return return
if channel.type != "CHANNEL": if channel.type != ChatType.CHANNEL:
await update.effective_message.reply_text("That is not a channel.") await update.effective_message.reply_text("That is not a channel.")
return return
channel_admin = await channel.get_administrators() channel_admin = await channel.get_administrators()