Compare commits
2 Commits
06685d0ad4
...
523f057ea3
Author | SHA1 | Date | |
---|---|---|---|
523f057ea3 | |||
a0a9383d32 |
@ -55,9 +55,9 @@ module.exports.interval = setInterval(async () => {
|
||||
|
||||
|
||||
async function deactivateMember(member) {
|
||||
//if (ds.get(member.id + "deactivated")) return "member is already deactivated";
|
||||
await member.roles.add(config.inactive_role);
|
||||
ds.put(member.id + "deactivated");
|
||||
ds.put(member.id, Date.now());
|
||||
|
||||
var magic_channel = client.channels.resolve(ds.get(member.id + "magicchannelid"));
|
||||
if (!magic_channel) {
|
||||
@ -96,7 +96,6 @@ async function deactivateMember(member) {
|
||||
}
|
||||
|
||||
async function reactivateMember(member) {
|
||||
//if (!ds.get(member.id + "deactivated")) return "member is not deactivated";
|
||||
await member.roles.remove(config.inactive_role);
|
||||
ds.del(member.id + "deactivated");
|
||||
var magic_channel = client.channels.resolve(ds.get(member.id + "magicchannelid"));
|
||||
@ -104,4 +103,14 @@ async function reactivateMember(member) {
|
||||
}
|
||||
|
||||
module.exports.deactivateMember = deactivateMember;
|
||||
module.exports.reactivateMember = reactivateMember;
|
||||
module.exports.reactivateMember = reactivateMember;
|
||||
|
||||
|
||||
client.on("messageCreate", message => {
|
||||
if (message.guildId != config.guild) return;
|
||||
let deactivatedMembersMentionedViaRoles = [...new Set(message.mentions.roles.flatMap(r => r.members).values())].filter(x => ds.get(x.id + "deactivated"));
|
||||
if (deactivatedMembersMentionedViaRoles.length) {
|
||||
for (let m of deactivatedMembersMentionedViaRoles) await reactivateMember(m);
|
||||
await message.reply({content: deactivatedMembersMentionedViaRoles.map(String).join(' '), allowedMentions:{repliedUser: false}});
|
||||
}
|
||||
});
|
@ -13,7 +13,6 @@ client.once("ready", () => {
|
||||
hour12: true
|
||||
}).format(d);
|
||||
t = t.replace(/[a-z]+(?: |$)/g, ''); // most of the abbrv are GMT+n >:(
|
||||
t = t.replace("AM", "A.M.").replace("PM", "P.M.");
|
||||
client.channels.resolve(x.channel)?.setName(t);
|
||||
}
|
||||
d.setMinutes(60);
|
||||
|
Loading…
x
Reference in New Issue
Block a user