async def restock(self, ctx: Context, *, drink_name: Optional[str]): """ Restock the bar or only one drink. Barman role required. Parameters: drink_name: name of the drink """ server = get_server_from_context(ctx) lang = server.lang if drink_name is not None and len(drink_name) > DRINK_NAME_LENGTH: await ctx.send( conf.lang(lang, "wrong_drink_name").format(DRINK_NAME_LENGTH)) return if drink_name is None: (Drink.update(portions_left=Drink.portions_per_day).where( Drink.server == server)).execute() await ctx.send(conf.lang(lang, "restocked_all")) log.info("Restocked all drinks on {1}".format( drink_name, ctx.guild.id)) else: (Drink.update(portions_left=Drink.portions_per_day).where( Drink.server == server and Drink.name == drink_name)).execute() await ctx.send( conf.lang(lang, "restocked_single").format(drink_name)) log.info("Restocked drink \"{0}\" on {1}".format( drink_name, ctx.guild.id))
async def restock(): (Drink.update(portions_left=Drink.portions_per_day)).execute() log.info("Restocked every server")