Files
xiao/commands/analyze/levenshtein.js
T
2024-05-21 21:02:12 -04:00

29 lines
588 B
JavaScript

const Command = require('../../framework/Command');
const wuzzy = require('wuzzy');
module.exports = class LevenshteinCommand extends Command {
constructor(client) {
super(client, {
name: 'levenshtein',
aliases: ['leven'],
group: 'analyze',
description: 'Determines the levenshtein distance between two strings.',
args: [
{
key: 'text1',
type: 'string'
},
{
key: 'text2',
type: 'string'
}
]
});
}
run(msg, { text1, text2 }) {
const distance = wuzzy.levenshtein(text1, text2);
return msg.reply(distance.toString());
}
};