diff --git a/pagermaid/modules/account.py b/pagermaid/modules/account.py index a7e5153..d8e192a 100644 --- a/pagermaid/modules/account.py +++ b/pagermaid/modules/account.py @@ -169,6 +169,8 @@ async def profile(context): await context.edit(lang('profile_process')) if context.reply_to_msg_id: reply_message = await context.get_reply_message() + if not reply_message: + return await context.edit(f"{lang('error_prefix')}{lang('arg_error')}") user = reply_message.from_id target_user = await context.client(GetFullUserRequest(user)) else: diff --git a/pagermaid/modules/captions.py b/pagermaid/modules/captions.py index 06c0260..0de6298 100644 --- a/pagermaid/modules/captions.py +++ b/pagermaid/modules/captions.py @@ -190,11 +190,15 @@ async def highlight(context): await context.edit(lang('caption_error')) return await context.edit(lang('highlight_uploading')) - await context.client.send_file( - context.chat_id, - result, - reply_to=reply_id - ) + try: + await context.client.send_file( + context.chat_id, + result, + reply_to=reply_id + ) + except PhotoInvalidDimensionsError: + await context.edit(lang('caption_error')) + return await context.delete() diff --git a/pagermaid/modules/message.py b/pagermaid/modules/message.py index 29b887c..98ee57a 100644 --- a/pagermaid/modules/message.py +++ b/pagermaid/modules/message.py @@ -16,6 +16,14 @@ from pagermaid.listener import listener from pagermaid.utils import lang, alias_command +def isfloat(value): + try: + float(value) + return True + except ValueError: + return False + + @listener(is_plugin=False, outgoing=True, command=alias_command("id"), description=lang('id_des')) async def userid(context): @@ -213,6 +221,8 @@ async def feet2meter(context): if not len(context.parameter) == 1: await context.edit(lang('arg_error')) return + if not isfloat(context.parameter[0]): + return await context.edit(lang('re_arg_error')) feet = float(context.parameter[0]) meter = feet * .3048 await context.edit(f"{lang('m2f_get')} {str(feet)} {lang('m2f_feet')}{lang('m2f_convert_to')} {str(meter)} "