Update convert
This commit is contained in:
parent
0225dafa96
commit
65f15ebc5c
1 changed files with 6 additions and 2 deletions
|
@ -16,6 +16,10 @@ i = module('convert', alias=('conv', 'unit'), desc='{convert.help.desc}',
|
|||
async def _(msg: Bot.MessageSession):
|
||||
from_val = msg.parsed_msg['<from_val>']
|
||||
to_unit = msg.parsed_msg['<to_unit>']
|
||||
ori = ureg.parse_expression(from_val)
|
||||
res = ureg.parse_expression(from_val).to(to_unit)
|
||||
try:
|
||||
ori = ureg.parse_expression(from_val)
|
||||
res = ureg.parse_expression(from_val).to(to_unit)
|
||||
except:
|
||||
await msg.finish(msg.locale.t("convert.message.error"))
|
||||
|
||||
await msg.finish(f"{ori:~Pg} = {res:~Pg}")
|
||||
|
|
Reference in a new issue