/nearby, subscriptions check, geocoding #2
@ -352,6 +352,10 @@ class HoloUser():
|
|||||||
progress = col_tmp.find_one({"user": self.id, "type": "application"})
|
progress = col_tmp.find_one({"user": self.id, "type": "application"})
|
||||||
stage = progress["stage"]
|
stage = progress["stage"]
|
||||||
|
|
||||||
|
if self.sponsorship_state()[0] == "fill":
|
||||||
|
await msg.reply_text(locale("finish_sponsorship", "message"), quote=should_quote(msg))
|
||||||
|
return
|
||||||
|
|
||||||
if progress["state"] == "fill" and progress["sent"] is False:
|
if progress["state"] == "fill" and progress["sent"] is False:
|
||||||
|
|
||||||
if stage == 2:
|
if stage == 2:
|
||||||
|
@ -90,6 +90,8 @@
|
|||||||
"sponsorships_expires": "⚠️ **Нагадування**\nНадана платна підписка припинить діяти **за {0} д**. Будь ласка, оновіть дані про неї командою /sponsorship інакше роль буде втрачено!",
|
"sponsorships_expires": "⚠️ **Нагадування**\nНадана платна підписка припинить діяти **за {0} д**. Будь ласка, оновіть дані про неї командою /sponsorship інакше роль буде втрачено!",
|
||||||
"sponsorships_expired": "⚠️ **Нагадування**\nТермін дії вказаної підписки сплив. Для повторного отримання ролі користуйся командою /sponsorship.",
|
"sponsorships_expired": "⚠️ **Нагадування**\nТермін дії вказаної підписки сплив. Для повторного отримання ролі користуйся командою /sponsorship.",
|
||||||
"label_too_long": "Довжина назви ролі не повинна перевищувати 16 символів",
|
"label_too_long": "Довжина назви ролі не повинна перевищувати 16 символів",
|
||||||
|
"finish_sponsorship": "❌ **Дія неможлива**\nПерш ніж заповнювати анкету, треба завершити заповнення форми спонсора.",
|
||||||
|
"finish_application": "❌ **Дія неможлива**\nПерш ніж заповнювати форму спонсора, треба завершити заповнення анкети.",
|
||||||
"voice_message": [
|
"voice_message": [
|
||||||
"why are u gae",
|
"why are u gae",
|
||||||
"руки відірвало? пиши як людина",
|
"руки відірвало? пиши як людина",
|
||||||
|
@ -3,7 +3,7 @@ from app import app
|
|||||||
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, ReplyKeyboardRemove
|
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, ReplyKeyboardRemove
|
||||||
from pyrogram import filters
|
from pyrogram import filters
|
||||||
from classes.holo_user import HoloUser
|
from classes.holo_user import HoloUser
|
||||||
from modules.utils import configGet, locale, logWrite
|
from modules.utils import configGet, locale, logWrite, should_quote
|
||||||
from modules.handlers.confirmation import confirm_yes
|
from modules.handlers.confirmation import confirm_yes
|
||||||
from modules.handlers.welcome import welcome_pass
|
from modules.handlers.welcome import welcome_pass
|
||||||
from modules.database import col_tmp, col_applications
|
from modules.database import col_tmp, col_applications
|
||||||
@ -76,6 +76,11 @@ async def callback_query_reapply_reject(app, clb):
|
|||||||
@app.on_callback_query(filters.regex("reapply_old_[\s\S]*"))
|
@app.on_callback_query(filters.regex("reapply_old_[\s\S]*"))
|
||||||
async def callback_query_reapply_old(app, clb):
|
async def callback_query_reapply_old(app, clb):
|
||||||
fullclb = clb.data.split("_")
|
fullclb = clb.data.split("_")
|
||||||
|
|
||||||
|
if HoloUser(clb.from_user).sponsorship_state()[0] == "fill":
|
||||||
|
await clb.message.reply_text(locale("finish_sponsorship", "message"), quote=False))
|
||||||
|
return
|
||||||
|
|
||||||
message = await app.get_messages(clb.from_user.id, int(fullclb[2]))
|
message = await app.get_messages(clb.from_user.id, int(fullclb[2]))
|
||||||
await confirm_yes(app, message, kind="application")
|
await confirm_yes(app, message, kind="application")
|
||||||
await clb.message.edit(clb.message.text, reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(locale("done", "button", locale=clb.from_user), "nothing")]]))
|
await clb.message.edit(clb.message.text, reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(locale("done", "button", locale=clb.from_user), "nothing")]]))
|
||||||
@ -86,6 +91,10 @@ async def callback_query_reapply_new(app, clb):
|
|||||||
|
|
||||||
fullclb = clb.data.split("_")
|
fullclb = clb.data.split("_")
|
||||||
|
|
||||||
|
if HoloUser(clb.from_user).sponsorship_state()[0] == "fill":
|
||||||
|
await clb.message.reply_text(locale("finish_sponsorship", "message"), quote=False))
|
||||||
|
return
|
||||||
|
|
||||||
await clb.answer(locale("reapply_stopped", "callback", locale=clb.from_user))
|
await clb.answer(locale("reapply_stopped", "callback", locale=clb.from_user))
|
||||||
message = await app.get_messages(clb.from_user.id, int(fullclb[2]))
|
message = await app.get_messages(clb.from_user.id, int(fullclb[2]))
|
||||||
col_tmp.update_one({"user": clb.from_user.id}, {"$set": {"state": "fill", "completed": False, "stage": 1}})
|
col_tmp.update_one({"user": clb.from_user.id}, {"$set": {"state": "fill", "completed": False, "stage": 1}})
|
||||||
|
@ -1,18 +1,23 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from app import app
|
from app import app
|
||||||
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, ForceReply
|
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, ForceReply, CallbackQuery
|
||||||
|
from pyrogram.client import Client
|
||||||
from pyrogram import filters
|
from pyrogram import filters
|
||||||
from classes.holo_user import HoloUser
|
from classes.holo_user import HoloUser
|
||||||
from modules.utils import configGet, locale, logWrite
|
from modules.utils import configGet, locale, logWrite, should_quote
|
||||||
from modules.database import col_tmp, col_sponsorships
|
from modules.database import col_tmp, col_sponsorships
|
||||||
|
|
||||||
# Callbacks sponsorship ========================================================================================================
|
# Callbacks sponsorship ========================================================================================================
|
||||||
@app.on_callback_query(filters.regex("sponsor_apply_[\s\S]*"))
|
@app.on_callback_query(filters.regex("sponsor_apply_[\s\S]*"))
|
||||||
async def callback_query_sponsor_apply(app, clb):
|
async def callback_query_sponsor_apply(app: Client, clb: CallbackQuery):
|
||||||
|
|
||||||
fullclb = clb.data.split("_")
|
fullclb = clb.data.split("_")
|
||||||
holo_user = HoloUser(int(fullclb[2]))
|
holo_user = HoloUser(int(fullclb[2]))
|
||||||
|
|
||||||
|
if holo_user.application_state()[0] == "fill":
|
||||||
|
await clb.message.reply_text(locale("finish_application", "message"), quote=should_quote(clb.message))
|
||||||
|
return
|
||||||
|
|
||||||
logWrite(f"User {holo_user.id} applied for sponsorship")
|
logWrite(f"User {holo_user.id} applied for sponsorship")
|
||||||
|
|
||||||
holo_user.sponsorship_restart()
|
holo_user.sponsorship_restart()
|
||||||
|
@ -2,7 +2,7 @@ from app import app
|
|||||||
from pyrogram import filters
|
from pyrogram import filters
|
||||||
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
||||||
from classes.holo_user import HoloUser
|
from classes.holo_user import HoloUser
|
||||||
from modules.utils import configGet, locale
|
from modules.utils import configGet, locale, should_quote
|
||||||
from modules.handlers.welcome import welcome_pass
|
from modules.handlers.welcome import welcome_pass
|
||||||
from modules.database import col_tmp
|
from modules.database import col_tmp
|
||||||
|
|
||||||
@ -19,6 +19,9 @@ async def cmd_reapply(app, msg):
|
|||||||
if member.user.id == msg.from_user.id:
|
if member.user.id == msg.from_user.id:
|
||||||
left_chat = False
|
left_chat = False
|
||||||
if not left_chat:
|
if not left_chat:
|
||||||
|
if holo_user.sponsorship_state()[0] == "fill":
|
||||||
|
await msg.reply_text(locale("finish_sponsorship", "message"), quote=should_quote(msg))
|
||||||
|
return
|
||||||
holo_user.application_restart(reapply=True)
|
holo_user.application_restart(reapply=True)
|
||||||
await welcome_pass(app, msg, once_again=True)
|
await welcome_pass(app, msg, once_again=True)
|
||||||
else:
|
else:
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from app import app, isAnAdmin
|
from app import app, isAnAdmin
|
||||||
from pyrogram import filters
|
from pyrogram import filters
|
||||||
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
||||||
|
from classes.holo_user import HoloUser
|
||||||
from modules.utils import locale, should_quote
|
from modules.utils import locale, should_quote
|
||||||
from modules.database import col_applications
|
from modules.database import col_applications
|
||||||
|
|
||||||
@ -8,6 +9,9 @@ from modules.database import col_applications
|
|||||||
@app.on_message(~ filters.scheduled & filters.command(["sponsorship"], prefixes=["/"]))
|
@app.on_message(~ filters.scheduled & filters.command(["sponsorship"], prefixes=["/"]))
|
||||||
async def cmd_sponsorship(app, msg):
|
async def cmd_sponsorship(app, msg):
|
||||||
if (await isAnAdmin(msg) is True) or (col_applications.find_one({"user": msg.from_user.id}) is not None):
|
if (await isAnAdmin(msg) is True) or (col_applications.find_one({"user": msg.from_user.id}) is not None):
|
||||||
|
if HoloUser(msg.from_user).application_state()[0] == "fill":
|
||||||
|
await msg.reply_text(locale("finish_application", "message"), quote=should_quote(msg))
|
||||||
|
return
|
||||||
await msg.reply_text(locale("sponsorship_apply", "message"), reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(text=str(locale("sponsor_apply", "button")), callback_data=f"sponsor_apply_{msg.from_user.id}")]]), quote=should_quote(msg))
|
await msg.reply_text(locale("sponsorship_apply", "message"), reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(text=str(locale("sponsor_apply", "button")), callback_data=f"sponsor_apply_{msg.from_user.id}")]]), quote=should_quote(msg))
|
||||||
else:
|
else:
|
||||||
await msg.reply_text(locale("sponsorship_application_empty", "message"))
|
await msg.reply_text(locale("sponsorship_application_empty", "message"))
|
||||||
|
Reference in New Issue
Block a user