Changed CallbackQuery delimiter (from ; to :)

This commit is contained in:
Profitroll 2023-08-12 22:36:55 +02:00
parent aee5cdf6a5
commit e9ef008080
Signed by: profitroll
GPG Key ID: FA35CAB49DACD3B2
5 changed files with 11 additions and 11 deletions

View File

@ -9,7 +9,7 @@ class CallbackVerify:
@classmethod
def from_callback(cls, callback: CallbackQuery):
action, user_id = str(callback.data).split(";")
action, user_id = str(callback.data).split(":")
if action.lower() != "verify":
raise ValueError("Callback provided is not a verification callback")
return cls(int(user_id))
@ -22,7 +22,7 @@ class CallbackEmoji:
@classmethod
def from_callback(cls, callback: CallbackQuery):
action, user_id, emoji = str(callback.data).split(";")
action, user_id, emoji = str(callback.data).split(":")
if action.lower() != "emoji":
raise ValueError("Callback provided is not an emoji button callback")
return cls(int(user_id), emoji)
@ -34,7 +34,7 @@ class CallbackBan:
@classmethod
def from_callback(cls, callback: CallbackQuery):
action, user_id = str(callback.data).split(";")
action, user_id = str(callback.data).split(":")
if action.lower() != "ban":
raise ValueError("Callback provided is not a ban callback")
return cls(int(user_id))
@ -46,7 +46,7 @@ class CallbackLanguage:
@classmethod
def from_callback(cls, callback: CallbackQuery):
action, language = str(callback.data).split(";")
action, language = str(callback.data).split(":")
if action.lower() != "language":
raise ValueError("Callback provided is not a language callback")
return cls(language)

View File

@ -11,7 +11,7 @@ from classes.pyrogroup import PyroGroup
logger = logging.getLogger(__name__)
@PyroClient.on_callback_query(filters.regex(r"ban;[\s\S]*")) # type: ignore
@PyroClient.on_callback_query(filters.regex(r"ban:[\s\S]*")) # type: ignore
async def callback_ban(app: PyroClient, callback: CallbackQuery):
group = await PyroGroup.create_if_not_exists(callback.message.chat.id, None, True)
locale = group.select_locale(app, callback.message.from_user)

View File

@ -16,7 +16,7 @@ from classes.pyrogroup import PyroGroup
logger = logging.getLogger(__name__)
@PyroClient.on_callback_query(filters.regex(r"emoji;[\s\S]*")) # type: ignore
@PyroClient.on_callback_query(filters.regex(r"emoji:[\s\S]*")) # type: ignore
async def callback_emoji_button(app: PyroClient, callback: CallbackQuery):
parsed = CallbackEmoji.from_callback(callback)
group = await PyroGroup.create_if_not_exists(callback.message.chat.id, None, True)

View File

@ -17,7 +17,7 @@ from modules.utils import get_captcha_image
logger = logging.getLogger(__name__)
@PyroClient.on_callback_query(filters.regex(r"verify;[\s\S]*")) # type: ignore
@PyroClient.on_callback_query(filters.regex(r"verify:[\s\S]*")) # type: ignore
async def callback_verify(app: PyroClient, callback: CallbackQuery):
parsed = CallbackVerify.from_callback(callback)
group = await PyroGroup.create_if_not_exists(callback.message.chat.id, None, True)
@ -50,7 +50,7 @@ async def callback_verify(app: PyroClient, callback: CallbackQuery):
await user.set_emojis(captcha.emojis_correct)
buttons = [
InlineButton(emoji, f"emoji;{user.id};{emoji}") for emoji in captcha.emojis_all
InlineButton(emoji, f"emoji:{user.id}:{emoji}") for emoji in captcha.emojis_all
]
keyboard = InlineKeyboard(3)

View File

@ -35,12 +35,12 @@ async def command_language(app: PyroClient, message: Message):
for language, data in app.in_every_locale("metadata").items():
if data["selectable"]:
buttons.append(
InlineButton(f"{data['flag']} {data['name']}", f"language;{language}")
InlineButton(f"{data['flag']} {data['name']}", f"language:{language}")
)
buttons.append(
InlineButton(
f"🤖 {app._('locale_default', 'buttons', locale=locale)}", "language;default"
f"🤖 {app._('locale_default', 'buttons', locale=locale)}", "language:default"
)
)
@ -52,7 +52,7 @@ async def command_language(app: PyroClient, message: Message):
)
@Client.on_callback_query(filters.regex(r"language;[\s\S]*")) # type: ignore
@Client.on_callback_query(filters.regex(r"language:[\s\S]*")) # type: ignore
async def callback_language(app: PyroClient, callback: CallbackQuery):
group = await PyroGroup.create_if_not_exists(callback.message.chat.id, None, True)
locale = group.select_locale(app, callback.message.from_user)