Weird fix to a weird problem

This commit is contained in:
Christopher Cookman 2024-07-22 12:41:33 -06:00
parent ceb797da81
commit f5787cb105
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42

View file

@ -96,11 +96,7 @@ client.on('ready', async () => {
const sendMessages = async (data) => {
const channel = await client.channels.fetch(process.env.DISCORD_BANLOG_CHANNEL_ID);
console.log(data)
for (const ban in data.added) {
thisBan = data.added[ban]
embed = {
title: "Ban Added",
color: 0xff0000,
fields: [
{
name: "Banned Username",
@ -114,12 +110,12 @@ const sendMessages = async (data) => {
},
{
name: "Banned",
value: `<t:${thisBan.banned_timestamp / 1000}:f> <t:${thisBan.banned_timestamp / 1000}:R>`,
value: `<t:${new Date(thisBan.banned_timestamp) / 1000}:f> <t:${new Date(thisBan.banned_timestamp) / 1000}:R>`,
inline: true
},
{
name: "Expires",
value: `<t:${thisBan.expires / 1000}:f> <t:${thisBan.expires / 1000}:R>`,
value: `<t:${new Date(thisBan.expires) / 1000}:f> <t:${new Date(thisBan.expires) / 1000}:R>`,
inline: true
},
{
@ -134,6 +130,11 @@ const sendMessages = async (data) => {
}
]
}
for (const ban in data.added) {
thisBan = data.added[ban]
embed.title = "Ban Added"
embed.color = 0xff0000
console.log(embed)
channel.send({ embeds: [embed] })
}
@ -141,42 +142,8 @@ const sendMessages = async (data) => {
for (const ban in data.removed) {
thisBan = data.removed[ban]
embed = {
title: "Ban Removed",
color: 0x00ff00,
fields: [
{
name: "Banned Username",
value: thisBan.banned_username,
inline: true
},
{
name: "Banned ID",
value: thisBan.banned_id,
inline: true
},
{
name: "Banned",
value: `<t:${thisBan.banned_timestamp / 1000}:f> <t:${thisBan.banned_timestamp / 1000}:R>`,
inline: true
},
{
name: "Expires",
value: `<t:${thisBan.expires / 1000}:f> <t:${thisBan.expires / 1000}:R>`,
inline: true
},
{
name: "Reason",
value: thisBan.reason,
inline: true
},
{
name: "Moderator",
value: thisBan.moderator,
inline: true
}
]
}
embed.title = "Ban Removed"
embed.color = 0x00ff00
console.log(embed)
channel.send({ embeds: [embed] })
};