Add auto kick functionality #502

Merged
Vylpes merged 10 commits from feature/485-auto-kick into hotfix/3.2.4 2025-01-03 17:47:16 +00:00
Showing only changes of commit 6c48da114a - Show all commits

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,
},
]);