better code

This commit is contained in:
Isaac (eartharoid) 2020-08-25 23:53:35 +01:00
parent 22bfbf201a
commit d3fa3f3e68
2 changed files with 11 additions and 14 deletions

View File

@ -38,8 +38,7 @@ module.exports = {
let path = `user/transcripts/raw/${n.channel.id}.log`; let path = `user/transcripts/raw/${n.channel.id}.log`;
let embeds = []; let embeds = [];
for (let embed in n.embeds) for (let embed in n.embeds)
// embeds.push(n.embeds[embed]); // n.embeds[embed].toJSON() embeds.push({ ...n.embeds[embed] });
embeds[embed] = { ...n.embeds[embed] };
fs.appendFileSync(path, JSON.stringify({ fs.appendFileSync(path, JSON.stringify({
id: n.id, id: n.id,

View File

@ -34,8 +34,7 @@ module.exports.add = (message) => {
let embeds = []; let embeds = [];
for (let embed in message.embeds) for (let embed in message.embeds)
// embeds.push(message.embeds[embed]); // .toJSON() embeds.push({ ...message.embeds[embed] });
embeds[embed] = { ...message.embeds[embed] };
// message // message
fs.appendFileSync(raw, JSON.stringify({ fs.appendFileSync(raw, JSON.stringify({
@ -59,16 +58,15 @@ module.exports.add = (message) => {
let data = JSON.parse(fs.readFileSync(json)); let data = JSON.parse(fs.readFileSync(json));
if (!data.entities.users[message.author.id]) { // if (!data.entities.users[message.author.id])
data.entities.users[message.author.id] = { data.entities.users[message.author.id] = {
avatar: message.author.avatarURL(), avatar: message.author.avatarURL(),
username: message.author.username, username: message.author.username,
discriminator: message.author.discriminator, discriminator: message.author.discriminator,
displayName: message.member.displayName, displayName: message.member.displayName,
color: m.displayColor === 0 ? null : m.displayColor, color: message.member.displayColor === 0 ? null : message.member.displayColor,
badge: message.author.bot ? 'bot' : null badge: message.author.bot ? 'bot' : null
}; };
}
// mentions.users // mentions.users
message.mentions.members.each(m => data.entities.users[m.id] = { // for mentions message.mentions.members.each(m => data.entities.users[m.id] = { // for mentions