JaBa/commands/General/setafk.js

41 lines
878 B
JavaScript
Raw Normal View History

2021-12-10 21:39:54 +05:00
const Command = require("../../base/Command.js");
class Setafk extends Command {
2021-12-26 19:29:37 +05:00
constructor(client) {
2021-12-10 21:39:54 +05:00
super(client, {
name: "setafk",
dirname: __dirname,
enabled: true,
guildOnly: false,
2021-12-26 19:29:37 +05:00
aliases: ["afk"],
2021-12-10 21:39:54 +05:00
memberPermissions: [],
2021-12-26 19:29:37 +05:00
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
2021-12-10 21:39:54 +05:00
nsfw: false,
ownerOnly: false,
cooldown: 2000
2021-12-10 21:39:54 +05:00
});
}
2021-12-26 19:29:37 +05:00
async run(message, args, data) {
2021-12-10 21:39:54 +05:00
const reason = args.join(" ");
2021-12-11 01:11:50 +05:00
if (!reason) return message.error("general/setafk:MISSING_REASON");
2021-12-29 02:15:26 +05:00
if (reason === "delete") {
if (data.userData.afk) {
data.userData.afk = null;
await data.userData.save();
message.sendT("general/setafk:DELETED", {
username: message.author.username
});
};
};
2021-12-10 21:39:54 +05:00
2021-12-26 19:29:37 +05:00
message.success("general/setafk:SUCCESS", {
reason
});
2021-12-10 21:39:54 +05:00
data.userData.afk = reason;
data.userData.save();
}
2021-12-11 01:11:50 +05:00
};
2021-12-10 21:39:54 +05:00
module.exports = Setafk;