Guest User

Untitled

a guest
Dec 17th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. @client.command(name='updatePrice',aliases= ['up'], pass_context=True)
  2. async def update_price(ctx, item: str, quantity: float):
  3. if (ctx.message.author.id in adminUsers):
  4. item = item.replace(" ", "").lower()
  5. with open(CONFIG, 'r+') as f:
  6. data = json.load(f)
  7. try:
  8. items[item] = quantity
  9. data['items'] = items
  10. f.seek(0)
  11. json.dump(data, f, indent=4)
  12. f.truncate()
  13. await client.say('{item} price updated'.format(item = item))
  14. except KeyError:
  15. await client.say('No match found for ' + item)
  16. else:
  17. await client.say('You are not permitted to update item prices')
Add Comment
Please, Sign In to add comment