Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @client.command(name='updatePrice',aliases= ['up'], pass_context=True)
- async def update_price(ctx, item: str, quantity: float):
- if (ctx.message.author.id in adminUsers):
- item = item.replace(" ", "").lower()
- with open(CONFIG, 'r+') as f:
- data = json.load(f)
- try:
- items[item] = quantity
- data['items'] = items
- f.seek(0)
- json.dump(data, f, indent=4)
- f.truncate()
- await client.say('{item} price updated'.format(item = item))
- except KeyError:
- await client.say('No match found for ' + item)
- else:
- await client.say('You are not permitted to update item prices')
Add Comment
Please, Sign In to add comment