buddy

node MVC discord bot
Log | Files | Refs | README

GuildChannelsPositionUpdate.js (507B)


      1 'use strict';
      2 
      3 const Action = require('./Action');
      4 
      5 class GuildChannelsPositionUpdate 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 partialChannel of data.channels) {
     12         const channel = guild.channels.cache.get(partialChannel.id);
     13         if (channel) channel.rawPosition = partialChannel.position;
     14       }
     15     }
     16 
     17     return { guild };
     18   }
     19 }
     20 
     21 module.exports = GuildChannelsPositionUpdate;