Added timestamp

This commit is contained in:
CorwinDev 2022-12-29 11:25:09 +01:00
parent b57e59cc33
commit 45eea34eb4
18 changed files with 75 additions and 70 deletions

View file

@ -43,6 +43,10 @@ module.exports = async (client, event) => {
{
name: `> Location type`,
value: `- ${locations[event.entityType]}`
},
{
name: `> Timestamp`,
value: `- <t:${Math.floor(Date.now() / 1000)}:R>`
}
]
}, logsChannel).catch(() => { })

View file

@ -43,6 +43,10 @@ module.exports = async (client, event) => {
{
name: `> Location type`,
value: `- ${locations[event.entityType]}`
},
{
name: `> Timestamp`,
value: `- <t:${Math.floor(Date.now() / 1000)}:R>`
}
]
}, logsChannel).catch(() => { })

View file

@ -36,6 +36,10 @@ module.exports = async (client, oldEvent, newEvent) => {
name: `> Creator`,
value: `- <@!${newEvent.creatorId}> (${newEvent.creatorId})`
},
{
name: `> Timestamp`,
value: `- <t:${Math.floor(Date.now() / 1000)}:R>`
}
]
}, logsChannel).catch(() => { })
};

View file

@ -19,6 +19,10 @@ module.exports = async (client, guild, afkChannel) => {
{
name: `> ID`,
value: `- ${afkChannel.id}`
},
{
name: `> Timestamp`,
value: `- <t:${Math.floor(afkChannel.createdTimestamp / 1000)}:R>`
}
]
}, logsChannel).catch(() => { })

View file

@ -20,6 +20,10 @@ module.exports = async (client, ban) => {
{
name: `> ID`,
value: `- ${ban.user.id}`
},
{
name: `> Timestamp`,
value: `- <t:${Math.floor(ban.createdTimestamp / 1000)}:R>`
}
]
}, logsChannel).catch(() => { })

View file

@ -20,6 +20,10 @@ module.exports = async (client, ban) => {
{
name: `> ID`,
value: `- ${ban.user.id}`
},
{
name: `> Timestamp`,
value: `- <t:${Math.floor(ban.createdTimestamp / 1000)}:R>`
}
]
}, logsChannel).catch(() => { })

View file

@ -15,6 +15,10 @@ module.exports = async (client, guild, oldLevel, newLevel) => {
{
name: `> New level`,
value: `- ${newLevel}`
},
{
name: `> Timestamp`,
value: `- <t:${Math.floor(Date.now() / 1000)}:R>`
}
]
}, logsChannel).catch(() => { })

View file

@ -15,6 +15,10 @@ module.exports = async (client, guild, oldLevel, newLevel) => {
{
name: `> New level`,
value: `- ${newLevel}`
},
{
name: `> Timestamp`,
value: `- <t:${Math.floor(Date.now() / 1000)}:R>`
}
]
}, logsChannel).catch(() => { })

View file

@ -12,6 +12,10 @@ module.exports = async (client, guild, url) => {
name: `> URL`,
value: `- ${url}`
},
{
name: `> Timestamp`,
value: `- <t:${Math.floor(Date.now() / 1000)}:R>`
}
]
}, logsChannel).catch(() => { })
};

View file

@ -15,6 +15,10 @@ module.exports = async (client, invite) => {
{
name: `> Inviter`,
value: `- ${invite.inviter} (${invite.inviter.tag})`
},
{
name: `> Timestamp`,
value: `- <t:${Math.floor(invite.createdTimestamp / 1000)}:R>`
}
]
}, logsChannel).catch(() => { })

View file

@ -11,6 +11,10 @@ module.exports = async (client, invite) => {
{
name: `> Code`,
value: `- ${invite.code}`
},
{
name: `> Timestamp`,
value: `- <t:${Math.floor(invite.createdTimestamp / 1000)}:R>`
}
]
}, logsChannel).catch(() => { })

View file

@ -32,6 +32,10 @@ module.exports = async (client, messageDeleted) => {
{
name: `> Message`,
value: `\`\`\`${content.replace(/`/g, "'")}\`\`\``
},
{
name: `> Timestamp`,
value: `- <t:${Math.floor(messageDeleted.createdTimestamp / 1000)}:R>`
}
]
}, logsChannel).catch(() => { })

View file

@ -32,6 +32,10 @@ module.exports = async (client, oldMessage, newMessage) => {
{
name: `> New message`,
value: `\`\`\`${newMessage.content.replace(/`/g, "'")}\`\`\``
},
{
name: `> Timestamp`,
value: `- <t:${Math.floor(newMessage.createdTimestamp / 1000)}:R>`
}
]
}, logsChannel).catch(() => { })

View file

@ -23,6 +23,10 @@ module.exports = async (client, role, oldColor, newColor) => {
{
name: `> ID`,
value: `${role.id}`
},
{
name: `> Timestamp`,
value: `- <t:${Math.floor(Date.now() / 1000)}:R>`
}
]
}, logsChannel).catch(() => { })

View file

@ -27,6 +27,10 @@ module.exports = async (client, role) => {
{
name: `> Position`,
value: `${role.position}`
},
{
name: `> Timestamp`,
value: `- <t:${Math.floor(Date.now() / 1000)}:R>`
}
]
}, logsChannel).catch(() => { })

View file

@ -27,6 +27,10 @@ module.exports = async (client, role) => {
{
name: `> Position`,
value: `${role.position}`
},
{
name: `> Timestamp`,
value: `- <t:${Math.floor(Date.now() / 1000)}:R>`
}
]
}, logsChannel).catch(() => { })

View file

@ -23,6 +23,10 @@ module.exports = async (client, role, oldName, newName) => {
{
name: `> ID`,
value: `${role.id}`
},
{
name: `> Timestamp`,
value: `- <t:${Math.floor(Date.now() / 1000)}:R>`
}
]
}, logsChannel).catch(() => { })

View file

@ -1,74 +1,7 @@
const discord = require('discord.js');
const Discord = require('discord.js');
module.exports = async (client, role, oldPerms, newPerms) => {
let perms = {
"1": "CREATE_INSTANT_INVITE",
"2": "KICK_MEMBERS",
"4": "BAN_MEMBERS",
"8": "ADMINISTRATOR",
"16": "MANAGE_CHANNELS",
"32": "MANAGE_GUILD",
"64": "ADD_REACTIONS",
"128": "VIEW_AUDIT_LOG",
"256": "PRIORITY_SPEAKER",
"1024": "VIEW_CHANNEL",
"1024": "READ_MESSAGES",
"2048": "SEND_MESSAGES",
"4096": "SEND_TTS_MESSAGES",
"8192": "MANAGE_MESSAGES",
"16384": "EMBED_LINKS",
"32768": "ATTACH_FILES",
"65536": "READ_MESSAGE_HISTORY",
"131072": "MENTION_EVERYONE",
"262144": "EXTERNAL_EMOJIS",
"262144": "USE_EXTERNAL_EMOJIS",
"1048576": "CONNECT",
"2097152": "SPEAK",
"4194304": "MUTE_MEMBERS",
"8388608": "DEAFEN_MEMBERS",
"16777216": "MOVE_MEMBERS",
"33554432": "USE_VAD",
"67108864": "CHANGE_NICKNAME",
"134217728": "MANAGE_NICKNAMES",
"268435456": "MANAGE_ROLES",
"268435456": "MANAGE_ROLES_OR_PERMISSIONS",
"536870912": "MANAGE_WEBHOOKS",
"1073741824 ": "MANAGE_EMOJIS",
"CREATE_INSTANT_INVITE": "CREATE_INSTANT_INVITE",
"KICK_MEMBERS": "KICK_MEMBERS",
"BAN_MEMBERS": "BAN_MEMBERS",
"ADMINISTRATOR": "ADMINISTRATOR",
"MANAGE_CHANNELS": "MANAGE_CHANNELS",
"MANAGE_GUILD": "MANAGE_GUILD",
"ADD_REACTIONS": "ADD_REACTIONS",
"VIEW_AUDIT_LOG": "VIEW_AUDIT_LOG",
"PRIORITY_SPEAKER": "PRIORITY_SPEAKER",
"VIEW_CHANNEL": "VIEW_CHANNEL",
"READ_MESSAGES": "READ_MESSAGES",
"SEND_MESSAGES": "SEND_MESSAGES",
"SEND_TTS_MESSAGES": "SEND_TTS_MESSAGES",
"MANAGE_MESSAGES": "MANAGE_MESSAGES",
"EMBED_LINKS": "EMBED_LINKS",
"ATTACH_FILES": "ATTACH_FILES",
"READ_MESSAGE_HISTORY": "READ_MESSAGE_HISTORY",
"MENTION_EVERYONE": "MENTION_EVERYONE",
"EXTERNAL_EMOJIS": "EXTERNAL_EMOJIS",
"USE_EXTERNAL_EMOJIS": "USE_EXTERNAL_EMOJIS",
"CONNECT": "CONNECT",
"SPEAK": "SPEAK",
"MUTE_MEMBERS": "MUTE_MEMBERS",
"DEAFEN_MEMBERS": "DEAFEN_MEMBERS",
"MOVE_MEMBERS": "MOVE_MEMBERS",
"USE_VAD": "USE_VAD",
"CHANGE_NICKNAME": "CHANGE_NICKNAME",
"MANAGE_NICKNAMES": "MANAGE_NICKNAMES",
"MANAGE_ROLES": "MANAGE_ROLES",
"MANAGE_ROLES_OR_PERMISSIONS": "MANAGE_ROLES_OR_PERMISSIONS",
"MANAGE_WEBHOOKS": "MANAGE_WEBHOOKS",
"MANAGE_EMOJIS": "MANAGE_EMOJIS"
}
const logsChannel = await client.getLogs(role.guild.id);
if (!logsChannel) return;
@ -82,15 +15,19 @@ module.exports = async (client, role, oldPerms, newPerms) => {
},
{
name: `> Before`,
value: `- ${perms[oldPerms]}`
value: `- ${new Discord.PermissionsBitField(oldPerms).toArray().toLocaleString().split(',').join(', ') || 'None'}`
},
{
name: `> After`,
value: `- ${perms[newPerms]}`
value: `- ${new Discord.PermissionsBitField(newPerms).toArray().toLocaleString().split(',').join(', ') || 'None'}`
},
{
name: `> ID`,
value: `${role.id}`
},
{
name: `> Timestamp`,
value: `<t:${Math.floor(Date.now() / 1000)}:R>`
}
]
}, logsChannel).catch(() => { })