JaBa/commands/General/setafk.js

42 lines
938 B
JavaScript
Raw Normal View History

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(" ");
if (!reason || reason.length > 250) return message.error("general/setafk:MISSING_REASON");
2022-01-04 02:18:28 +05:00
if (reason === "delete") {
if (data.userData.afk) {
data.userData.afk = null;
await data.userData.save();
return message.sendT("general/setafk:DELETED", {
2022-01-04 02:18:28 +05:00
username: message.author.username
});
};
};
message.success("general/setafk:SUCCESS", {
reason,
prefix: data.guild.prefix
2022-01-04 02:18:28 +05:00
});
data.userData.afk = reason;
data.userData.save();
}
};
module.exports = Setafk;