Fix time checking using the wrong function
All checks were successful
Test / build (push) Successful in 13s

This commit is contained in:
Ethan Lane 2024-12-28 16:38:07 +00:00
parent 40a9764192
commit 6c48da114a

View file

@ -33,8 +33,7 @@ export default async function AutoKick() {
const now = new Date();
if (whenToKick < now) {
// await member.kick("Auto Kicked");
console.log("Kicked");
await member.kick("Auto Kicked");
if (config.NoticeChannelId) {
const channel = guild.channels.cache.find(x => x.id == config.NoticeChannelId) || await guild.channels.fetch(config.NoticeChannelId);
@ -46,7 +45,7 @@ export default async function AutoKick() {
const embed = new EmbedBuilder()
.setTitle("Auto Kicked User")
.setColor(EmbedColours.Danger)
.setThumbnail(member.avatarURL())
.setThumbnail(member.user.avatarURL())
.addFields([
{
name: "User",
@ -60,7 +59,7 @@ export default async function AutoKick() {
});
}
} else if (config.NoticeChannelId && config.NoticeTime) {
const whenToNotice = new Date(whenToKick.getMilliseconds() - config.NoticeTime);
const whenToNotice = new Date(whenToKick.getTime() - config.NoticeTime);
const channel = guild.channels.cache.find(x => x.id == config.NoticeChannelId) || await guild.channels.fetch(config.NoticeChannelId);
@ -74,7 +73,7 @@ export default async function AutoKick() {
const embed = new EmbedBuilder()
.setTitle("Auto Kick Notice")
.setColor(EmbedColours.Warning)
.setThumbnail(member.avatarURL())
.setThumbnail(member.user.avatarURL())
.addFields([
{
name: "User",
@ -83,7 +82,7 @@ export default async function AutoKick() {
},
{
name: "When To Kick",
value: `<t:${whenToKick.getMilliseconds()}:R>`,
value: `<t:${Math.round(whenToKick.getTime() / 1000)}:R>`,
inline: true,
},
]);