2022-01-04 02:18:28 +05:00
|
|
|
const Command = require("../../base/Command.js");
|
|
|
|
|
|
|
|
class Setafk extends Command {
|
|
|
|
constructor(client) {
|
|
|
|
super(client, {
|
|
|
|
name: "setafk",
|
|
|
|
dirname: __dirname,
|
|
|
|
enabled: true,
|
|
|
|
guildOnly: false,
|
|
|
|
aliases: ["afk"],
|
|
|
|
memberPermissions: [],
|
|
|
|
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
|
|
nsfw: false,
|
|
|
|
ownerOnly: false,
|
|
|
|
cooldown: 2000
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
async run(message, args, data) {
|
|
|
|
const reason = args.join(" ");
|
2022-01-06 15:29:31 +05:00
|
|
|
if (!reason || reason.length > 250) return message.error("general/setafk:MISSING_REASON");
|
2022-01-06 15:37:52 +05:00
|
|
|
|
2022-01-04 02:18:28 +05:00
|
|
|
if (reason === "delete") {
|
|
|
|
if (data.userData.afk) {
|
|
|
|
data.userData.afk = null;
|
2022-01-06 15:37:52 +05:00
|
|
|
data.userData.save();
|
|
|
|
|
2022-01-06 15:34:19 +05:00
|
|
|
return message.sendT("general/setafk:DELETED", {
|
2022-01-04 02:18:28 +05:00
|
|
|
username: message.author.username
|
|
|
|
});
|
|
|
|
};
|
2022-01-06 15:37:52 +05:00
|
|
|
} else {
|
|
|
|
data.userData.afk = reason;
|
|
|
|
data.userData.save();
|
2022-01-04 02:18:28 +05:00
|
|
|
|
2022-01-11 19:59:03 +05:00
|
|
|
const m = await message.success("general/setafk:SUCCESS", {
|
2022-01-06 15:37:52 +05:00
|
|
|
reason,
|
2022-01-12 18:58:33 +05:00
|
|
|
prefix: message.guild ? data.guild.prefix : "$"
|
2022-01-06 15:37:52 +05:00
|
|
|
});
|
2022-01-11 19:59:03 +05:00
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
if (m.deletable) m.delete();
|
|
|
|
if (message.deletable) message.delete();
|
|
|
|
}, 10 * 1000);
|
2022-01-06 15:37:52 +05:00
|
|
|
};
|
2022-01-04 02:18:28 +05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = Setafk;
|