mirror of
https://github.com/TheFunny/TelegramTwitterMediaBot.git
synced 2026-09-23 23:32:05 +00:00
rename
This commit is contained in:
@@ -36,7 +36,7 @@ async def inline_query(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No
|
|||||||
if query == "":
|
if query == "":
|
||||||
return
|
return
|
||||||
logger.info(f"Query: {query}")
|
logger.info(f"Query: {query}")
|
||||||
async with TGTweet(query) as tweet:
|
async with TelegramTweet(query) as tweet:
|
||||||
result = list(tweet.inline_query_generator)
|
result = list(tweet.inline_query_generator)
|
||||||
await update.inline_query.answer(result)
|
await update.inline_query.answer(result)
|
||||||
|
|
||||||
@@ -45,8 +45,8 @@ async def inline_query(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No
|
|||||||
async def url_media(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
async def url_media(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
||||||
url = update.message.text
|
url = update.message.text
|
||||||
logger.info(f"Receiving url: {url}")
|
logger.info(f"Receiving url: {url}")
|
||||||
async with TGTweet(url) as tweet:
|
async with TelegramTweet(url) as tweet:
|
||||||
media = list(tweet.pm_media_generator)
|
media = list(tweet.message_media_generator)
|
||||||
message_to_send = await update.effective_message.reply_media_group(
|
message_to_send = await update.effective_message.reply_media_group(
|
||||||
media,
|
media,
|
||||||
caption=tweet.message_text,
|
caption=tweet.message_text,
|
||||||
@@ -204,7 +204,7 @@ async def post_init(application: Application) -> None:
|
|||||||
DESCRIPTION = "A bot to fetch tweets from Twitter."
|
DESCRIPTION = "A bot to fetch tweets from Twitter."
|
||||||
await application.bot.set_my_description(DESCRIPTION)
|
await application.bot.set_my_description(DESCRIPTION)
|
||||||
await application.bot.set_my_short_description(DESCRIPTION)
|
await application.bot.set_my_short_description(DESCRIPTION)
|
||||||
TGTweet.init_client()
|
TelegramTweet.init_client()
|
||||||
|
|
||||||
|
|
||||||
async def post_stop(application: Application) -> None:
|
async def post_stop(application: Application) -> None:
|
||||||
@@ -212,7 +212,7 @@ async def post_stop(application: Application) -> None:
|
|||||||
|
|
||||||
|
|
||||||
async def post_shutdown(application: Application) -> None:
|
async def post_shutdown(application: Application) -> None:
|
||||||
await TGTweet.close_client()
|
await TelegramTweet.close_client()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ class TelegramTweet(Tweet):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def pm_media_generator(self) -> Generator[InputMediaPhoto | InputMediaVideo | tuple[str, bool], None, None]:
|
def message_media_generator(self) -> Generator[InputMediaPhoto | InputMediaVideo | tuple[str, bool], None, None]:
|
||||||
for tweet_media in self.media:
|
for tweet_media in self.media:
|
||||||
logger.info(str(tweet_media))
|
logger.info(str(tweet_media))
|
||||||
if tweet_media.type == "image":
|
if tweet_media.type == "image":
|
||||||
|
|||||||
Reference in New Issue
Block a user