🐛 fix some bugs (#146)

🐛 批量修复错误
This commit is contained in:
Xtao_dada 2021-11-10 15:46:07 +08:00 committed by GitHub
parent 3fb0578995
commit 0cc112f316
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 5 deletions

View File

@ -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:

View File

@ -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()

View File

@ -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)} "