nyx/events/afk.js

32 lines
939 B
JavaScript
Raw Normal View History

2021-06-24 09:53:19 +02:00
const client = require("../bot");
2021-06-12 12:53:51 +02:00
const moment = require("moment");
2021-09-06 12:38:25 +02:00
client.on("messageCreate", async message => {
2021-06-12 12:53:51 +02:00
if (message.author.bot) return;
if (!message.guild) return;
const dataa = await client.data.getUser(message.author.id);
if (dataa) {
if (dataa.AFK != null) {
2021-09-06 12:38:25 +02:00
message.reply(
2021-06-12 12:53:51 +02:00
`Welcome back <@${dataa.User}>! I have removed your AFK status.`
);
const nothahaa = message.guild.members.cache.get(message.author.id);
nothahaa.setNickname(`${message.author.username}`);
await client.data.DelAFK(message.author.id);
} else return;
} else {
return;
}
if (message.mentions.members.first()) {
const data1 = await client.data.getUser(
message.mentions.members.first().id
);
if (data1) {
if (data1.AFK !== null) {
2021-09-06 12:38:25 +02:00
message.reply(
`${message.mentions.members.first().user.tag}is in afk (${data1.AFK})`
2021-06-12 12:53:51 +02:00
);
}
}
}
});