def assert_type(slot: str, server: discord.Server):
""" Assert if a type does not exist, and show the valid types. """
match = get_close_matches(slot, api["types"], n=1, cutoff=0.4)
if match:
matches_string = " Perhaps you meant `{}`?".format(match[0])
else:
matches_string = " See `{}help pokedex type`.".format(server_command_prefix(server))
assert slot in api["types"], "**{}** is not a valid pokemon type.{}".format(
slot.capitalize(), matches_string)
评论列表
文章目录