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 embeds = [];
for (let embed in n.embeds)
// embeds.push(n.embeds[embed]); // n.embeds[embed].toJSON()
embeds[embed] = { ...n.embeds[embed] };
embeds.push({ ...n.embeds[embed] });
fs.appendFileSync(path, JSON.stringify({
id: n.id,

View File

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