async def update_store(ctx, *, details): store_details = details.split(':') if len(store_details) == 5: # Correct number of arguments provided old_store_name = store_details[0].strip() new_store_name = store_details[1].strip() new_store_location_x = store_details[2].strip() new_store_location_z = store_details[3].strip() new_store_description = store_details[4].strip() catalogue = Catalogue() catalogue.load_stores(PATH_TO_DATA_FILE) # Attempt to remove old store from catalogue. is_removed = catalogue.remove_store(old_store_name) if not is_removed: embed = discord.Embed( title=f'Store: \'{old_store_name}\' cannot be found', color=13424046) await ctx.send(embed=embed) else: # Add updated store updated_store = Store(new_store_name, new_store_location_x, new_store_location_z, new_store_description) catalogue.add_store(updated_store) # Update save file catalogue.save_stores(PATH_TO_DATA_FILE) embed = discord.Embed(title='Store Updated Successfully', color=13424046) await ctx.send(embed=embed) await stores(ctx) else: embed = discord.Embed(title='Error: Please use the following format', color=13424046) await ctx.send(embed=embed) await help(ctx, 'update_store')
async def remove_store(ctx, *, store_name): catalogue = Catalogue() catalogue.load_stores(PATH_TO_DATA_FILE) # Attempt to remove store from catalogue. is_removed = catalogue.remove_store(store_name) if not is_removed: embed = discord.Embed(title=f'Store: \'{store_name}\' cannot be found', color=13424046) await ctx.send(embed=embed) else: # Update save file catalogue.save_stores(PATH_TO_DATA_FILE) await ctx.send('Store removed successfully!') await stores(ctx)