mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-18 13:56:25 +02:00
Fix
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
const Command = require('../../framework/Command');
|
const Command = require('../../framework/Command');
|
||||||
const { Util: { escapeMarkdown } } = require('discord.js');
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const { letterTrans } = require('custom-translate');
|
const { letterTrans } = require('custom-translate');
|
||||||
@@ -24,7 +23,7 @@ module.exports = class MorseCommand extends Command {
|
|||||||
type: 'string',
|
type: 'string',
|
||||||
validate: text => {
|
validate: text => {
|
||||||
const translated = letterTrans(text.toLowerCase(), dictionary, ' ');
|
const translated = letterTrans(text.toLowerCase(), dictionary, ' ');
|
||||||
if (escapeMarkdown(translated.replace(/ {2}/g, ' / ')).length < 2000) return true;
|
if (this.escapeMarkdown(translated.replace(/ {2}/g, ' / ')).length < 2000) return true;
|
||||||
return 'Invalid text, your text is too long.';
|
return 'Invalid text, your text is too long.';
|
||||||
},
|
},
|
||||||
parse: text => text.toLowerCase()
|
parse: text => text.toLowerCase()
|
||||||
@@ -37,7 +36,7 @@ module.exports = class MorseCommand extends Command {
|
|||||||
|
|
||||||
async run(msg, { text }) {
|
async run(msg, { text }) {
|
||||||
const translated = letterTrans(text.toLowerCase(), dictionary, ' ');
|
const translated = letterTrans(text.toLowerCase(), dictionary, ' ');
|
||||||
const parsed = escapeMarkdown(translated.replace(/ {2}/g, ' / '));
|
const parsed = this.escapeMarkdown(translated.replace(/ {2}/g, ' / '));
|
||||||
const connection = msg.guild && this.client.dispatchers.get(msg.guild.id);
|
const connection = msg.guild && this.client.dispatchers.get(msg.guild.id);
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
const usage = this.client.registry.commands.get('join').usage();
|
const usage = this.client.registry.commands.get('join').usage();
|
||||||
@@ -111,4 +110,8 @@ module.exports = class MorseCommand extends Command {
|
|||||||
processScript(str) {
|
processScript(str) {
|
||||||
return str.replace(/[^.-]/gi, ' ').trim();
|
return str.replace(/[^.-]/gi, ' ').trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
escapeMarkdown(str) {
|
||||||
|
return str.replace(/-/g, '\\-');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user