async def changeLink(story: Story): try: story.addLink(linkSiteAbbr, linkURL, ignoreMax=isModerator(ctx.author)) except InvalidNameException: fail(A.addLink.errorInvalid(story.cite(), linkSiteAbbr)) except DuplicateException: fail(A.addLink.errorDup(story.cite(), linkSiteAbbr)) except MaxLenException: fail(A.addLink.errorLen(len(linkURL)))
async def changeGenre(story: Story): for genreName in targetGenre: try: story.removeGenre(genreName) print(f"Removed {genreName} genre from {story.cite()}.") except NotFoundException: fail(A.removeGenre.errorNotFound(story.cite(), genreName))
async def changeGenre(story: Story): for genreName in newGenre: try: story.addGenre(genreName.capitalize()) print(f"Added {genreName} genre to {story.cite()}.") except InvalidNameException: fail(A.addGenre.errorInvalid(genreName)) except DuplicateException: fail(A.addGenre.errorDup(story.cite(), genreName))
async def changeCharacter(story: Story): try: story.removeCharacter(targetCharSpecies, targetCharName) print( f"Removed character with species {targetCharSpecies} and name {targetCharName} from {story.cite()}." ) except NotFoundException: fail( A.removeCharacter.errorNorFound(story.cite(), targetCharSpecies, targetCharName))
async def changeCharacter(story: Story): try: story.addCharacter(newCharSpecies, newCharName, ignoreMax=isModerator(ctx.author)) print( f"Added character with species {newCharSpecies} and name {newCharName} to {story.cite()}." ) except DuplicateException: fail( A.addCharacter.errorDup(story.cite(), newCharSpecies, newCharName)) except MaxSpeciesLenException: fail(A.addCharacter.errorLenSpecies(len(newCharSpecies))) except MaxNameLenException: fail(A.addCharacter.errorLenName(len(newCharName)))
async def changeLink(story: Story): try: story.removeLink(targetSiteAbbr) except NotFoundException: fail(A.removeLink.errorNotFound(story.cite(), targetSiteAbbr))
async def changeRating(story: Story): try: story.setRating(newRating) print(f"Set rating of {story.cite()} to {newRating}.") except InvalidNameException: fail(A.setRating.errorInvalid(story.cite(), newRating))