Bug fixes and small structural changes #7

Merged
profitroll merged 10 commits from dev into master 2023-01-06 17:01:21 +02:00
2 changed files with 10 additions and 4 deletions
Showing only changes of commit 59dafc004d - Show all commits

View File

@ -3,7 +3,7 @@ from app import app
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, ForceReply, CallbackQuery
from pyrogram.client import Client
from pyrogram import filters
from classes.holo_user import HoloUser
from classes.holo_user import HoloUser, LabelSettingError
from modules.utils import configGet, locale, logWrite, should_quote
from modules.database import col_tmp, col_sponsorships
@ -67,7 +67,10 @@ async def callback_query_sponsor_yes(app: Client, clb: CallbackQuery):
}
)
try:
await holo_user.label_set(configGet("users", "groups"), col_tmp.find_one({"user": {"$eq": holo_user.id}, "type": {"$eq": "sponsorship"}})["sponsorship"]["label"])
except LabelSettingError as exp:
await app.send_message(configGet("admin", "groups"), exp.__str__(), disable_notification=True)
edited_markup = [[InlineKeyboardButton(text=str(locale("accepted", "button")), callback_data="nothing")]]

View File

@ -2,8 +2,8 @@ from app import app
from pyrogram import filters
from pyrogram.types import Message
from pyrogram.client import Client
from modules.utils import locale, should_quote, find_user
from classes.holo_user import HoloUser, LabelTooLongError
from modules.utils import configGet, locale, should_quote, find_user
from classes.holo_user import HoloUser, LabelTooLongError, LabelSettingError
from modules import custom_filters
# Label command ================================================================================================================
@ -32,6 +32,9 @@ async def cmd_label(app: Client, msg: Message):
except LabelTooLongError:
await msg.reply_text(locale("label_too_long", "message"))
return
except LabelSettingError as exp:
await app.send_message(configGet("admin", "groups"), exp.__str__(), disable_notification=True)
return
await msg.reply_text(f"Setting **{target.id}**'s label to **{label}**...", quote=should_quote(msg))
else: