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