buddy

node MVC discord bot
Log | Files | Refs | README

GuildRolesPositionUpdate.js (477B)


      1 'use strict';
      2 
      3 const Action = require('./Action');
      4 
      5 class GuildRolesPositionUpdate extends Action {
      6   handle(data) {
      7     const client = this.client;
      8 
      9     const guild = client.guilds.cache.get(data.guild_id);
     10     if (guild) {
     11       for (const partialRole of data.roles) {
     12         const role = guild.roles.cache.get(partialRole.id);
     13         if (role) role.rawPosition = partialRole.position;
     14       }
     15     }
     16 
     17     return { guild };
     18   }
     19 }
     20 
     21 module.exports = GuildRolesPositionUpdate;