Compare commits
2 Commits
5b28f9f588
...
02a6960391
Author | SHA1 | Date | |
---|---|---|---|
02a6960391 | |||
7939f8b65e |
@ -105,8 +105,8 @@
|
||||
"spoiler_started": "Розпочато створення спойлера. Будь ласка, оберіть категорію спойлера за допомогою клавіатури бота.",
|
||||
"spoiler_unfinished": "У вас ще є незавершений спойлер. Надішліть /cancel щоб зупинити його створення",
|
||||
"spoiler_cancel": "Створення спойлера було припинено",
|
||||
"spoiler_empty": "Спойлер без опису",
|
||||
"spoiler_described": "Спойлер: {0}",
|
||||
"spoiler_empty": "Спойлер категорії \"{0}\" без опису",
|
||||
"spoiler_described": "Спойлер категорії \"{0}\": {1}",
|
||||
"spoiler_description_enter": "Добре, введіть бажаний опис спойлера",
|
||||
"spoiler_using_description": "Встановлено опис спойлера: {0}\n\nЗалишилось додати вміст самого спойлера. Бот приймає текстове повідомлення, фото, відео а також гіф зображення (1 шт.)",
|
||||
"spoiler_send_description": "Тепер треба надіслати коротенький опис спойлера, щоб люди розуміли що під ним варто очкувати. Надішли мінус (-) щоб пропустити цей крок.",
|
||||
|
@ -1,3 +1,4 @@
|
||||
from traceback import print_exc
|
||||
from app import app, isAnAdmin
|
||||
import asyncio
|
||||
from pyrogram import filters
|
||||
@ -117,9 +118,10 @@ async def any_stage(app: Client, msg: Message):
|
||||
ready = True
|
||||
|
||||
if spoiler["photo"] is None and spoiler["video"] is None and spoiler["animation"] is None and spoiler["text"] is None:
|
||||
col_spoilers.find_one_and_update( {"user": msg.from_user.id, "completed": False}, {"$set": {"text": msg.text, "completed": True}} )
|
||||
logWrite(f"Adding text '{msg.text}' to {msg.from_user.id}'s spoiler")
|
||||
ready = True
|
||||
if msg.text is not None:
|
||||
col_spoilers.find_one_and_update( {"user": msg.from_user.id, "completed": False}, {"$set": {"text": msg.text, "completed": True}} )
|
||||
logWrite(f"Adding text '{msg.text}' to {msg.from_user.id}'s spoiler")
|
||||
ready = True
|
||||
|
||||
if ready is True:
|
||||
await msg.reply_text(locale("spoiler_ready", "message", locale=msg.from_user), reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(locale("spoiler_send", "button", locale=msg.from_user), switch_inline_query=f"spoiler:{spoiler['_id'].__str__()}")]]))
|
||||
@ -132,10 +134,12 @@ async def message_in_group(app: Client, msg: Message):
|
||||
if (msg.chat is not None) and (msg.via_bot is not None):
|
||||
if (msg.via_bot.id == (await app.get_me()).id) and (msg.chat.id == configGet("users", "groups")):
|
||||
if msg.text.startswith(locale("spoiler_described", "message").split()[0]) or msg.text.startswith(locale("spoiler_empty", "message").split()[0]):
|
||||
logWrite(f"User {msg.from_user.id} sent spoiler to user's group")
|
||||
try:
|
||||
await msg.forward(configGet("users", "groups"), disable_notification=True)
|
||||
except:
|
||||
pass
|
||||
logWrite("Forwarding spoiler to admin's group")
|
||||
await msg.copy(configGet("admin", "groups"), disable_notification=True)
|
||||
except Exception as exp:
|
||||
logWrite(f"Could not forward spoiler to admin's group due to '{exp}': {print_exc()}")
|
||||
return
|
||||
if configGet("remove_application_time") > 0:
|
||||
logWrite(f"User {msg.from_user.id} requested application in destination group, removing in {configGet('remove_application_time')} minutes")
|
||||
|
@ -28,7 +28,7 @@ async def inline_answer(client: Client, inline_query: InlineQuery):
|
||||
|
||||
if spoil is not None:
|
||||
|
||||
desc = locale("spoiler_empty", "message", locale=inline_query.from_user) if spoil["description"] == "" else locale("spoiler_described", "message", locale=inline_query.from_user).format(spoil["description"])
|
||||
desc = locale("spoiler_empty", "message", locale=inline_query.from_user).format(locale(spoil["category"], "message", "spoiler_categories")) if spoil["description"] == "" else locale("spoiler_described", "message", locale=inline_query.from_user).format(locale(spoil["category"], "message", "spoiler_categories"), spoil["description"])
|
||||
|
||||
results = [
|
||||
InlineQueryResultArticle(
|
||||
|
Reference in New Issue
Block a user