2022-07-26 17:20:10 +05:00
|
|
|
const BaseEvent = require("../../base/BaseEvent");
|
2022-07-23 17:14:42 +05:00
|
|
|
|
|
|
|
class GuildMemberUpdate extends BaseEvent {
|
|
|
|
constructor() {
|
|
|
|
super({
|
|
|
|
name: "guildMemberRemove",
|
2022-12-15 21:02:38 +05:00
|
|
|
once: false,
|
2022-07-23 17:14:42 +05:00
|
|
|
});
|
2022-01-04 02:18:28 +05:00
|
|
|
}
|
|
|
|
|
2022-07-23 17:14:42 +05:00
|
|
|
/**
|
|
|
|
*
|
2023-11-05 16:03:23 +05:00
|
|
|
* @param {import("../../base/Client")} client
|
2022-07-23 17:14:42 +05:00
|
|
|
* @param {import("discord.js").GuildMember} oldMember
|
|
|
|
* @param {import("discord.js").GuildMember} newMember
|
|
|
|
*/
|
2022-08-02 17:18:47 +05:00
|
|
|
async execute(client, oldMember, newMember) {
|
2023-07-03 19:30:47 +05:00
|
|
|
if (oldMember.guild && oldMember.guildId === "568120814776614924") return;
|
2023-07-10 21:07:24 +05:00
|
|
|
if (oldMember.guild.id !== client.config.support.id) return;
|
2023-06-27 21:19:55 +05:00
|
|
|
if (oldMember.roles.cache.some(r => r.id === "940149470975365191")) return;
|
2022-08-02 17:18:47 +05:00
|
|
|
|
2023-06-27 21:19:55 +05:00
|
|
|
if (newMember?.roles.cache.some(r => r.id === "940149470975365191")) {
|
2024-05-24 23:11:03 +05:00
|
|
|
const userData = await client.getUserData(newMember.id);
|
2023-06-27 21:19:55 +05:00
|
|
|
|
2022-01-04 02:18:28 +05:00
|
|
|
userData.achievements.tip.progress.now = 1;
|
|
|
|
userData.achievements.tip.achieved = true;
|
2023-09-25 21:42:43 +05:00
|
|
|
|
2022-01-04 02:18:28 +05:00
|
|
|
await userData.save();
|
|
|
|
|
|
|
|
newMember.send({
|
2023-07-05 00:58:06 +05:00
|
|
|
files: [
|
|
|
|
{
|
|
|
|
name: "achievement_unlocked5.png",
|
|
|
|
attachment: "./assets/img/achievements/achievement_unlocked5.png",
|
|
|
|
},
|
|
|
|
],
|
2022-01-04 02:18:28 +05:00
|
|
|
});
|
2022-01-13 00:26:23 +05:00
|
|
|
}
|
2022-01-04 02:18:28 +05:00
|
|
|
}
|
2022-07-23 17:14:42 +05:00
|
|
|
}
|
|
|
|
|
2023-07-05 00:58:06 +05:00
|
|
|
module.exports = GuildMemberUpdate;
|