add adding selected text to quotes, instead of full text of replied message

This commit is contained in:
Rykov7
2024-03-16 18:55:06 +03:00
parent 88f24ce5a7
commit 3231d8c263
+2 -2
View File
@@ -60,7 +60,7 @@ async def mute(chat_id, user_id, period):
@bot.message_handler(func=is_white_id, commands=["add"]) @bot.message_handler(func=is_white_id, commands=["add"])
async def add_stan_quote(message: types.Message): async def add_stan_quote(message: types.Message):
if message.reply_to_message and message.reply_to_message.text: if message.reply_to_message and message.reply_to_message.text:
quote = message.reply_to_message.text quote = (message.quote and message.quote.text) or message.reply_to_message.text
if not is_quote_in_chat(quote, message.chat.id): if not is_quote_in_chat(quote, message.chat.id):
add_quote(message.chat.id, quote) add_quote(message.chat.id, quote)
ok_message = await bot.send_message(message.chat.id, f"⭐️ Добавил: {quote}", parse_mode='Markdown') ok_message = await bot.send_message(message.chat.id, f"⭐️ Добавил: {quote}", parse_mode='Markdown')
@@ -75,7 +75,7 @@ async def add_stan_quote(message: types.Message):
@bot.message_handler(func=is_white_id, commands=["remove"]) @bot.message_handler(func=is_white_id, commands=["remove"])
async def remove_stan_quote(message: types.Message): async def remove_stan_quote(message: types.Message):
if message.reply_to_message and message.reply_to_message.text: if message.reply_to_message and message.reply_to_message.text:
quote = message.reply_to_message.text quote = (message.quote and message.quote.text) or message.reply_to_message.text
if is_quote_in_chat(quote, message.chat.id): if is_quote_in_chat(quote, message.chat.id):
delete_quote_in_chat(quote, message.chat.id) delete_quote_in_chat(quote, message.chat.id)
remove_message = await bot.send_message(message.chat.id, f"🗑 Удалил: {quote}", parse_mode='Markdown') remove_message = await bot.send_message(message.chat.id, f"🗑 Удалил: {quote}", parse_mode='Markdown')