Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const contributorRole = message.member.roles.cache.some(role => role.name === "Contributor");
- const boosterRole = message.member.roles.cache.some(role => role.name === "Nitro Boost");
- const memberOfTheWeekRole = message.member.roles.cache.some(role => role.name === "Member of the Week");
- try {
- if (message.author.bot) return;
- if (!contributorRole | !boosterRole | !memberOfTheWeekRole) {
- const LevelSystem = await levelSystem.create({
- nameUser: message.author.tag,
- idUser: message.author.id,
- level: "0",
- xp: "5",
- boost: "0",
- });
- } else {
- const LevelSystem = await levelSystem.create({
- nameUser: message.author.tag,
- idUser: message.author.id,
- level: "0",
- xp: "10",
- boost: "0",
- });
- }
- } catch (error) {
- if (error.name === "SequelizeUniqueConstraintError") {
- const userData = await levelSystem.findOne({ where: { idUser: message.author.id } });
- if (userData.xp % 1000 === 0) userData.increment("level", { by: 1 });
- if (!contributorRole | !boosterRole | !memberOfTheWeekRole) {
- userData.increment("xp", { by: 5 });
- } else {
- userData.increment("xp", { by: 10 });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement