mirror of
https://github.com/danbulant/Shasha
synced 2026-06-09 17:40:25 +00:00
stringify FIX
This commit is contained in:
parent
4dad6557c6
commit
d43760a86f
5 changed files with 17 additions and 15 deletions
|
|
@ -21,7 +21,7 @@ module.exports = class mydatabase extends commando.Command {
|
||||||
return errLog(e, msg, this.client);
|
return errLog(e, msg, this.client);
|
||||||
}
|
}
|
||||||
let mes = `Fetched documents for ${msg.guild ? `server **${msg.guild.name}**` : `**${msg.author.tag}**`}`;
|
let mes = `Fetched documents for ${msg.guild ? `server **${msg.guild.name}**` : `**${msg.author.tag}**`}`;
|
||||||
mes = `${mes}\`\`\`js\n${JSON.stringify(fetched).split(',"').join(',\n"').split(',{').join(',\n{').split("{\"").join("{\n\"").split("\"}").join("\"\n}")}\`\`\``;
|
mes = `${mes}\`\`\`js\n${JSON.stringify(fetched, null, 4)}\`\`\``;
|
||||||
trySend(this.client, msg, mes);
|
trySend(this.client, msg, mes);
|
||||||
return ranLog(msg, "mydatabase", fetched);
|
return ranLog(msg, "mydatabase", fetched);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -116,8 +116,9 @@ module.exports = class mute extends commando.Command {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let infractionToDoc;
|
||||||
if (targetUser.length > 0) {
|
if (targetUser.length > 0) {
|
||||||
const infractionToDoc = {
|
infractionToDoc = {
|
||||||
infraction: Math.max(infractionDoc?.map(r => r.infraction) + 1),
|
infraction: Math.max(infractionDoc?.map(r => r.infraction) + 1),
|
||||||
by: targetUser,
|
by: targetUser,
|
||||||
moderator: `**${msg.author.tag}** <@${msg.author.id}> (${msg.author.id})`,
|
moderator: `**${msg.author.tag}** <@${msg.author.id}> (${msg.author.id})`,
|
||||||
|
|
@ -139,6 +140,7 @@ module.exports = class mute extends commando.Command {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resultMsg += `Result:\`\`\`js\nUsers: ${targetUser.map(r => r?.tag).join(", ")}\nReason: ${reason}\nAt: ${invokedAt.toUTCString()}\nFor: ${timeForMessage === "Indefinite" ? timeForMessage : timeForMessage.join(" + ")}\nUntil: ${typeof untilDate !== "string" ? untilDate.toUTCString() : untilDate}\`\`\`\n`;
|
resultMsg += `Result:\`\`\`js\nUsers: ${targetUser.map(r => r?.tag).join(", ")}\nReason: ${reason}\nAt: ${invokedAt.toUTCString()}\nFor: ${timeForMessage === "Indefinite" ? timeForMessage : timeForMessage.join(" + ")}\nUntil: ${typeof untilDate !== "string" ? untilDate.toUTCString() : untilDate}\`\`\`\n`;
|
||||||
|
trySend(this.client, msg, JSON.stringify(infractionToDoc, null, 4));
|
||||||
return trySend(this.client, msg, resultMsg);
|
return trySend(this.client, msg, resultMsg);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const commando = require("@iceprod/discord.js-commando");
|
const commando = require("@iceprod/discord.js-commando");
|
||||||
const { getChannelMessage, ranLog, errLog, noPerm } = require("../../resources/functions");
|
const { getChannelMessage, ranLog, errLog, noPerm, trySend } = require("../../resources/functions");
|
||||||
|
|
||||||
module.exports = class mesemb extends commando.Command {
|
module.exports = class mesemb extends commando.Command {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
|
|
@ -17,9 +17,9 @@ module.exports = class mesemb extends commando.Command {
|
||||||
try {
|
try {
|
||||||
const message = await getChannelMessage(this.client,msg,args[0],args[1]);
|
const message = await getChannelMessage(this.client,msg,args[0],args[1]);
|
||||||
console.log(message.embeds);
|
console.log(message.embeds);
|
||||||
const mesemb = '```js\n'+JSON.stringify(message.embeds).split(',"').join(',\n"').split(',{').join(',\n{').replace(/`/g,"\\`")+'```';
|
const mesemb = '```js\n'+JSON.stringify(message.embeds, null, 4)+'```';
|
||||||
const result = msg.channel.send({content:'Collected:'+mesemb,split:{maxLength:2000,char: ", " || ",\n" || ". " || ".\n" || "," || ".",append:',```',prepend:'```js\n'}});
|
const result = await trySend(this.client, msg, {content:'Collected:'+mesemb,split:{maxLength:2000,char: ", " || ",\n" || ". " || ".\n" || "," || ".",append:',```',prepend:'```js\n'}});
|
||||||
return ranLog(msg,'mesemb',await result.content);
|
return ranLog(msg,'mesemb',result.content);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
noPerm(msg);
|
noPerm(msg);
|
||||||
return errLog(e, msg, this.client);
|
return errLog(e, msg, this.client);
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,13 @@ module.exports = class mesinfo extends commando.Command {
|
||||||
return trySend(this.client, msg, "No message with that ID <:catstareLife:794930503076675584>")
|
return trySend(this.client, msg, "No message with that ID <:catstareLife:794930503076675584>")
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
const mesinfo = 'Collected:```js\n'+JSON.stringify(message).split(',"').join(',\n"').split(',{').join(',\n{').replace(/`/g,"\\`")+'```';
|
const mesinfo = 'Collected:```js\n'+JSON.stringify(message, null, 4).replace(/`/g,"\\`")+'```';
|
||||||
const mentionJSON = message.mentions.toJSON();
|
const mentionJSON = message.mentions.toJSON();
|
||||||
const sendMentionInfo = 'Mentions:```js\n'+JSON.stringify(mentionJSON).split(',"').join(',\n"').split(',{').join(',\n{')+'```';
|
const sendMentionInfo = 'Mentions:```js\n'+JSON.stringify(mentionJSON, null, 4)+'```';
|
||||||
const Attachments = 'Attachments:```js\n'+JSON.stringify(message.attachments).split(',"').join(',\n"').split(',{').join(',\n{')+'```';
|
const Attachments = 'Attachments:```js\n'+JSON.stringify(message.attachments, null, 4)+'```';
|
||||||
const sendmesinfo = mesinfo+sendMentionInfo+Attachments;
|
const sendmesinfo = mesinfo+sendMentionInfo+Attachments;
|
||||||
const result1 = msg.channel.send({content:sendmesinfo,split:{maxLength:2000,char: ", " || ",\n" || ". " || ".\n" || "," || ".",append:',```',prepend:'```js\n'}});
|
const result1 = await trySend(this.client, msg, {content:sendmesinfo,split:{maxLength:2000,char: ", " || ",\n" || ". " || ".\n" || "," || ".",append:',```',prepend:'```js\n'}});
|
||||||
return ranLog(msg,'mesinfo',`${await result1}`);
|
return ranLog(msg,'mesinfo',`${result1}`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
noPerm(msg);
|
noPerm(msg);
|
||||||
return errLog(e, msg, this.client, false, "", false, defaultErrorLogChannel);
|
return errLog(e, msg, this.client, false, "", false, defaultErrorLogChannel);
|
||||||
|
|
|
||||||
|
|
@ -24,16 +24,16 @@ module.exports = class uinfo extends commando.Command {
|
||||||
const member = msg.guild.member(profile);
|
const member = msg.guild.member(profile);
|
||||||
let result = 'User: '+profile.tag+'```js\n';
|
let result = 'User: '+profile.tag+'```js\n';
|
||||||
if (profile) {
|
if (profile) {
|
||||||
result = result+JSON.stringify(profile).split(',"').join(',\n"').split(',{').join(',\n{')+'```';
|
result = result+JSON.stringify(profile, null, 4)+'```';
|
||||||
}
|
}
|
||||||
if (member) {
|
if (member) {
|
||||||
result = result+'As member: '+member.displayName+'```js\n'+JSON.stringify(member).split(',"').join(',\n"').split(',{').join(',\n{')+'```';
|
result = result+'As member: '+member.displayName+'```js\n'+JSON.stringify(member, null, 4)+'```';
|
||||||
if ((member.displayColor)) {
|
if ((member.displayColor)) {
|
||||||
result = result+'Display color:```js\n'+member.displayColor+'```';
|
result = result+'Display color:```js\n'+member.displayColor+'```';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
trySend(this.client, msg, result,{split:{maxLength:2000,char: ", " || ",\n" || ". " || ".\n" || "," || ".",append:',```',prepend:'```js\n'}});
|
trySend(this.client, msg, result, {split:{maxLength:2000,char: ", " || ",\n" || ". " || ".\n" || "," || ".",append:',```',prepend:'```js\n'}});
|
||||||
return ranLog(msg,'profile',msg.content);
|
return ranLog(msg,'profile', msg.content);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return errLog(e, msg, this.client, false, 'Gimme the right ID!', true);
|
return errLog(e, msg, this.client, false, 'Gimme the right ID!', true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue