Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const fs = require("fs");
- const leave = JSON.parse(fs.readFileSync("./leave.json", "utf-8"));
- const saveLeave = () => fs.writeFileSync("./leave.json", JSON.stringify(leave, null, 2));
- client.on("guildMemberRemove", (member) => {
- if (member.roles.cache.find(r => r.name.toLowerCase() == "muted")) {
- if (!leave[member.guild.id]) leave[member.guild.id] = [];
- leave[member.guild.id].push(member.user.id);
- saveLeave();
- }
- });
- client.on("guildMemberAdd", (member) => {
- if (leave[member.guild.id] && leave[member.guild.id].includes(member.user.id)) {
- let role = member.guild.roles.cache.find(r => r.name.toLowerCase() == "muted");
- if (role) member.roles.add(role, `This member left and rejoined the server to remvoe Mute role.`);
- }
- })
- //By 3Mo_Steve | Toxic Codes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement