Data export, warnings' improvements, bug fixes #35

Merged
profitroll merged 30 commits from dev into master 2023-04-02 23:27:31 +03:00
29 changed files with 2 additions and 120 deletions
Showing only changes of commit de984c2b78 - Show all commits

View File

@ -5,10 +5,6 @@ from pyrogram.client import Client
from modules.utils import locale
# Callback empty ===============================================================================================================
@app.on_callback_query(filters.regex("nothing"))
async def callback_query_nothing(app: Client, clb: CallbackQuery):
await clb.answer(text=locale("nothing", "callback", locale=clb.from_user))
# ==============================================================================================================================

View File

@ -15,7 +15,6 @@ from modules.handlers.welcome import welcome_pass
from modules.database import col_tmp, col_applications
# Callbacks reapply ============================================================================================================
@app.on_callback_query(filters.regex("reapply_yes_[\s\S]*"))
async def callback_reapply_query_accept(app: Client, clb: CallbackQuery):
fullclb = clb.data.split("_")
@ -285,6 +284,3 @@ async def callback_query_reapply_stop(app: Client, clb: CallbackQuery):
locale("reapply_restarted", "message", locale=holo_user),
reply_markup=ReplyKeyboardRemove(),
)
# ==============================================================================================================================

View File

@ -7,7 +7,6 @@ from modules.utils import locale, logWrite
from modules.commands.rules import DefaultRulesMarkup
# Callback rule ================================================================================================================
@app.on_callback_query(filters.regex("rule_[\s\S]*"))
async def callback_query_rule(app: Client, clb: CallbackQuery):
fullclb = clb.data.split("_")
@ -100,6 +99,3 @@ async def callback_query_rules_additional(app: Client, clb: CallbackQuery):
pass
await clb.answer(text=locale("rules_additional", "callback", locale=clb.from_user))
# ==============================================================================================================================

View File

@ -9,7 +9,6 @@ from bson.objectid import ObjectId
from modules.utils import configGet, jsonLoad, locale
# Callback sid =================================================================================================================
@app.on_callback_query(filters.regex("sid_[\s\S]*"))
async def callback_query_sid(app: Client, clb: CallbackQuery):
await clb.answer(
@ -17,10 +16,6 @@ async def callback_query_sid(app: Client, clb: CallbackQuery):
)
# ==============================================================================================================================
# Callback shc =================================================================================================================
@app.on_callback_query(filters.regex("shc_[\s\S]*"))
async def callback_query_shc(app: Client, clb: CallbackQuery):
if clb.from_user.id not in jsonLoad(
@ -80,6 +75,3 @@ async def callback_query_shc(app: Client, clb: CallbackQuery):
await clb.answer(
locale("spoiler_sent", "callback", locale=clb.from_user), show_alert=True
)
# ==============================================================================================================================

View File

@ -14,7 +14,6 @@ from modules.utils import configGet, locale, logWrite, should_quote
from modules.database import col_tmp, col_sponsorships
# Callbacks sponsorship ========================================================================================================
@app.on_callback_query(filters.regex("sponsor_apply_[\s\S]*"))
async def callback_query_sponsor_apply(app: Client, clb: CallbackQuery):
fullclb = clb.data.split("_")

View File

@ -9,7 +9,6 @@ from modules.database import col_tmp, col_applications
from modules.commands.rules import DefaultRulesMarkup
# Callbacks application ========================================================================================================
@app.on_callback_query(filters.regex("sub_yes_[\s\S]*"))
async def callback_query_accept(app: Client, clb: CallbackQuery):
fullclb = clb.data.split("_")
@ -188,6 +187,3 @@ async def callback_query_reject_russian(app: Client, clb: CallbackQuery):
),
show_alert=True,
)
# ==============================================================================================================================

View File

@ -12,7 +12,6 @@ from modules.utils import configGet, locale, logWrite
from modules.database import col_tmp
# Callbacks sus users ==========================================================================================================
@app.on_callback_query(filters.regex("sus_allow_[\s\S]*"))
async def callback_query_sus_allow(app: Client, clb: CallbackQuery):
fullclb = clb.data.split("_")
@ -99,6 +98,3 @@ async def callback_query_sus_reject(app: Client, clb: CallbackQuery):
{"user": {"$eq": holo_user.id}, "type": {"$eq": "application"}},
{"$set": {"state": "rejected", "sent": False}},
)
# ==============================================================================================================================

View File

@ -13,7 +13,6 @@ from modules.database import col_applications
from modules import custom_filters
# Application command ==========================================================================================================
@app.on_message(
custom_filters.enabled_applications
& ~filters.scheduled
@ -98,6 +97,3 @@ async def cmd_application(app: Client, msg: Message):
locale("application_invalid_syntax", "message", locale=msg.from_user),
quote=should_quote(msg),
)
# ==============================================================================================================================

View File

@ -11,7 +11,6 @@ from modules.database import col_applications
from modules import custom_filters
# Applications command =========================================================================================================
@app.on_message(
custom_filters.enabled_applications
& ~filters.scheduled
@ -38,6 +37,3 @@ async def cmd_applications(app: Client, msg: Message):
quote=should_quote(msg),
)
remove(f"tmp{sep}{filename}.json")
# ==============================================================================================================================

View File

@ -7,7 +7,6 @@ from modules.database import col_tmp, col_spoilers, col_applications
from modules import custom_filters
# Cancel command ===============================================================================================================
@app.on_message(
(custom_filters.enabled_applications | custom_filters.enabled_sponsorships)
& ~filters.scheduled
@ -30,6 +29,3 @@ async def command_cancel(app: Client, msg: Message):
reply_markup=ReplyKeyboardRemove(),
)
logWrite(f"Cancelling all ongoing tmp operations for {msg.from_user.id}")
# ==============================================================================================================================

View File

@ -19,7 +19,6 @@ from modules.utils import (
from modules import custom_filters
# Identify command =============================================================================================================
@app.on_message(
(custom_filters.enabled_applications | custom_filters.enabled_sponsorships)
& ~filters.scheduled
@ -104,6 +103,3 @@ async def cmd_identify(app: Client, msg: Message):
await msg.reply_text(output, quote=should_quote(msg))
logWrite(f"User {msg.from_user.id} identified user {holo_user.id}")
# ==============================================================================================================================

View File

@ -1,14 +1,11 @@
from typing import Union
from app import app
from pyrogram import filters
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, User, Message
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, Message
from pyrogram.client import Client
from modules.utils import configGet, locale
from modules import custom_filters
from classes.holo_user import HoloUser
# Issue command ================================================================================================================
@app.on_message(
custom_filters.enabled_general
& ~filters.scheduled
@ -31,6 +28,3 @@ async def cmd_issue(app: Client, msg: Message):
]
),
)
# ==============================================================================================================================

View File

@ -8,7 +8,6 @@ from classes.holo_user import HoloUser
from modules import custom_filters
# Label command ================================================================================================================
@app.on_message(
custom_filters.enabled_applications
& ~filters.scheduled
@ -53,6 +52,3 @@ async def cmd_label(app: Client, msg: Message):
else:
await msg.reply_text(f"User not found")
# ==============================================================================================================================

View File

@ -8,7 +8,6 @@ from modules.utils import logWrite, locale, should_quote, find_user
from modules import custom_filters
# Message command ==============================================================================================================
@app.on_message(
custom_filters.enabled_general
& ~filters.scheduled
@ -71,6 +70,3 @@ async def cmd_message(app: Client, msg: Message):
quote=should_quote(msg),
)
logWrite(f"Admin {msg.from_user.id} tried to send message but 'ValueError'")
# ==============================================================================================================================

View File

@ -12,7 +12,6 @@ from modules.database import col_applications, col_users
from classes.errors.geo import PlaceNotFoundError
# Nearby command ===============================================================================================================
@app.on_message(
custom_filters.enabled_applications
& ~filters.scheduled
@ -116,6 +115,3 @@ async def cmd_nearby(app: Client, msg: Message):
await msg.reply_text(
locale("nearby_empty", "message", locale=holo_user), quote=should_quote(msg)
)
# ==============================================================================================================================

View File

@ -10,7 +10,6 @@ from modules.database import col_tmp, col_applications
from modules import custom_filters
# Reapply command ==============================================================================================================
@app.on_message(
custom_filters.enabled_applications
& ~filters.scheduled
@ -168,6 +167,3 @@ async def cmd_reapply(app: Client, msg: Message):
]
),
)
# ==============================================================================================================================

View File

@ -12,7 +12,6 @@ from modules import custom_filters
pid = getpid()
# Reboot command ===============================================================================================================
@app.on_message(
custom_filters.enabled_general
& ~filters.scheduled
@ -33,6 +32,3 @@ async def cmd_kill(app: Client, msg: Message):
path.join(configGet("cache", "locations"), "shutdown_time"),
)
exit()
# ==============================================================================================================================

View File

@ -10,7 +10,6 @@ from modules import custom_filters
pid = getpid()
# Reset commands command =======================================================================================================
@app.on_message(
custom_filters.enabled_general
& ~filters.scheduled
@ -110,6 +109,3 @@ async def cmd_resetcommands(app: Client, msg: Message):
),
debug=True,
)
# ==============================================================================================================================

View File

@ -42,7 +42,6 @@ class DefaultRulesMarkup(list):
)
# Rules command =============================================================================================================
@app.on_message(
custom_filters.enabled_general
& ~filters.scheduled
@ -56,6 +55,3 @@ async def cmd_rules(app: Client, msg: Message):
disable_web_page_preview=True,
reply_markup=DefaultRulesMarkup(msg.from_user).keyboard,
)
# ==============================================================================================================================

View File

@ -10,7 +10,6 @@ from modules.database import col_spoilers, col_applications
from modules import custom_filters
# Spoiler command ==============================================================================================================
@app.on_message(
custom_filters.enabled_spoilers
& ~filters.scheduled
@ -63,6 +62,3 @@ async def cmd_spoiler(app: Client, msg: Message):
await msg.reply_text(
locale("spoiler_unfinished", "message", locale=msg.from_user)
)
# ==============================================================================================================================

View File

@ -8,7 +8,6 @@ from modules.utils import locale, should_quote
from modules.database import col_applications
# Sponsorship command ==========================================================================================================
@app.on_message(
custom_filters.enabled_sponsorships
& ~filters.scheduled
@ -45,6 +44,3 @@ async def cmd_sponsorship(app: Client, msg: Message):
)
# else:
# await msg.reply_text(locale("sponsorship_application_empty", "message"))
# ==============================================================================================================================

View File

@ -9,7 +9,6 @@ from bson.objectid import ObjectId
from bson.errors import InvalidId
# Start command ================================================================================================================
@app.on_message(
custom_filters.enabled_applications
& ~filters.scheduled
@ -69,6 +68,3 @@ async def cmd_start(app: Client, msg: Message):
await msg.reply_text(spoiler["text"])
except InvalidId:
await msg.reply_text(f"Got an invalid ID {msg.command[1]}")
# ==============================================================================================================================

View File

@ -8,7 +8,6 @@ from modules.database import col_warnings
from modules import custom_filters
# Warn command =================================================================================================================
@app.on_message(
custom_filters.enabled_warnings
& ~filters.scheduled
@ -42,6 +41,3 @@ async def cmd_warn(app: Client, msg: Message):
message,
)
)
# ==============================================================================================================================

View File

@ -8,7 +8,6 @@ from modules.database import col_users, col_warnings
from modules import custom_filters
# Warnings command =============================================================================================================
@app.on_message(
custom_filters.enabled_warnings
& ~filters.scheduled
@ -72,6 +71,3 @@ async def cmd_warnings(app: Client, msg: Message):
),
quote=should_quote(msg),
)
# ==============================================================================================================================

View File

@ -18,7 +18,7 @@ from modules.handlers.welcome import welcome_pass
from modules.database import col_tmp, col_applications
from modules import custom_filters
# Confirmation =================================================================================================================
confirmation_1 = []
for pattern in all_locales("confirm", "keyboard"):
confirmation_1.append(pattern[0][0])
@ -286,6 +286,3 @@ async def confirm_no(
f"User {msg.from_user.id} restarted the sponsorship application due to typo in it"
)
return
# ==============================================================================================================================

View File

@ -10,7 +10,6 @@ from classes.holo_user import HoloUser
from modules import custom_filters
# Contact getting ==============================================================================================================
@app.on_message(
custom_filters.enabled_applications
& ~filters.scheduled
@ -82,6 +81,3 @@ async def get_contact(app: Client, msg: Message):
await msg.reply_text(
locale("contact_not_member", "message", locale=holo_user.locale)
)
# ==============================================================================================================================

View File

@ -41,7 +41,6 @@ async def message_context(msg: Message) -> tuple:
return 0, 0
# Any other input ==============================================================================================================
@app.on_message(
~filters.scheduled
& (filters.private | filters.chat(configGet("admin", "groups")))
@ -400,6 +399,3 @@ async def message_in_group(app: Client, msg: Message):
logWrite(
f"Removed application requested by {msg.from_user.id} in destination group"
)
# ==============================================================================================================================

View File

@ -15,7 +15,6 @@ from classes.holo_user import HoloUser
from dateutil.relativedelta import relativedelta
# Filter users on join =========================================================================================================
@app.on_chat_member_updated(
custom_filters.enabled_invites_check, group=configGet("users", "groups")
)
@ -150,6 +149,3 @@ async def filter_join(app: Client, member: ChatMemberUpdated):
can_send_polls=False,
),
)
# ==============================================================================================================================

View File

@ -6,7 +6,6 @@ from classes.holo_user import HoloUser
from modules.utils import all_locales, locale, logWrite
from modules import custom_filters
# Welcome check ================================================================================================================
welcome_1 = []
for pattern in all_locales("welcome", "keyboard"):
welcome_1.append(pattern[0][0])
@ -72,6 +71,3 @@ async def welcome_reject(app: Client, msg: Message):
locale("return", "keyboard", locale=msg.from_user), resize_keyboard=True
),
)
# ==============================================================================================================================