mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
29 lines
588 B
JavaScript
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());
|
|
}
|
|
};
|