Archived
1
0
Fork 0
This commit is contained in:
Nattiden 2023-02-28 18:47:28 +08:00 committed by GitHub
parent b0c07ed48f
commit 2d6578ca6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,11 +10,12 @@ dice = on_command('dice', alias={'d4': 'dice d4', 'd6': 'dice d6',
async def _(msg: MessageSession):
dice = msg.parsed_msg['<dices>']
dc = msg.parsed_msg.get('<dc>', '0')
times = '1'
if '#' in dice:
times = dice.partition('#')[0]
dice = dice.partition('#')[2]
if not times.isdigit():
await msg.finish('发生错误:无效的投骰次数:' + times)
if not times.isdigit():
await msg.finish('发生错误:无效的投骰次数:' + times)
if not dc.isdigit():
await msg.finish('发生错误:无效的 dc' + dc)
await msg.finish(await GenerateMessage(dice, int(times), int(dc)))