nyx/events/afk.js

39 lines
1 KiB
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-06-24 09:53:19 +02:00
client.on("message", 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) {
message.inlineReply(
`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) {
message.inlineReply(
message.mentions.members.first().user.tag +
` is in afk (${data1.AFK})`
);
} else {
return;
}
} else {
return;
}
} else {
return;
}
});