mirror of
https://github.com/TheFunny/TelegramTwitterMediaBot.git
synced 2026-09-23 23:32:05 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ebb48d2bb5
|
||
|
|
be77a33e9d
|
@@ -17,7 +17,7 @@ from utils.pixiv import ProcessPixiv
|
||||
from utils.telegram import Telegram
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from telegram import Chat, Message, Update
|
||||
from telegram import Message, Update
|
||||
from telegram.ext import Application, ContextTypes
|
||||
|
||||
logger = get_logger(__name__)
|
||||
@@ -141,7 +141,7 @@ async def cmd_set_forward_channel(update: Update, context: ContextTypes.DEFAULT_
|
||||
return
|
||||
channel = context.args[0]
|
||||
try:
|
||||
channel: Chat = await context.bot.get_chat(channel)
|
||||
channel = await context.bot.get_chat(channel)
|
||||
except Exception as e:
|
||||
await update.effective_message.reply_text(str(e))
|
||||
return
|
||||
@@ -153,6 +153,11 @@ async def cmd_set_forward_channel(update: Update, context: ContextTypes.DEFAULT_
|
||||
except Exception as e:
|
||||
await update.effective_message.reply_text(str(e) + "\nPlease add the bot to the channel and set as admin")
|
||||
return
|
||||
user = filter(lambda x: x.user.id == update.effective_user.id, channel_admin)
|
||||
user = next(user, None)
|
||||
if not user:
|
||||
await update.effective_message.reply_text("You are not an admin of the channel.")
|
||||
return
|
||||
user_bot = filter(lambda x: x.user.id == context.bot.id, channel_admin)
|
||||
user_bot = next(user_bot, None)
|
||||
if user_bot.can_post_messages:
|
||||
|
||||
+1
-1
@@ -205,7 +205,7 @@ class TelegramPixiv:
|
||||
logger.info(str(media))
|
||||
if pixiv.type in ("illust", "manga"):
|
||||
yield InputMediaPhoto(
|
||||
media=media.url,
|
||||
media=media.large,
|
||||
has_spoiler=pixiv.is_nsfw
|
||||
)
|
||||
else:
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ class Telegram:
|
||||
async with TelegramPixiv(self._url) as pixiv:
|
||||
return pixiv
|
||||
else:
|
||||
return None
|
||||
return None # TODO add raise and catch
|
||||
|
||||
async def __aexit__(self, exc_type, exc_val, exc_tb):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user