API Reference¶
-
class
discord.ext.levenshtein.Levenshtein(bot, max_length=3)[source]¶ The root of the module. Creates a list of commands when
on_readyis called, and dispatches theon_command_suggestcoroutine when command_not_found is invoked. :param bot: discord.py bot instance :type bot:Bot:param max_length: The Levenshtein distance thresholdfor considering a similar command. the Levenshtein distance is a string metric for measuring the difference between two sequences.
Informally, the Levenshtein distance between two words is the minimum number of single-character edits (insertions, deletions or substitutions) required to change one word into the other.
Note
When CommandNotFound exception is raised in discord.py,
command_suggestevent will be dispatched. Thecommand_suggestevent is given two arguments, the former is the Context(Context) and the latter is a list of similar commands (List(str)).