async def change_prefix(self, ctx, prefix: CheckLength.check_length): """Changes server's command prefix :param ctx: the context in which a command is called :type ctx: discord.ext.commands.Context :param prefix: new prefix which invokes commands :type prefix: str """ old_prefix = \ Database.get_one(Database.db_servers, {'_id': ctx.guild.id}, selection={'settings.prefix': 1, '_id': 0})[ 'settings']['prefix'] # Zapytanie w MongoDB, aby wejsc glebiej do slownika po kluczach uzywamy '.' if Database.update_one(Database.db_servers, {'_id': ctx.guild.id}, {'settings.prefix': prefix}): await ctx.send(f'Pomyślnie zmienio prefix z {old_prefix} na {prefix}')