buddy

node MVC discord bot
Log | Files | Refs | README

MessageUpdate.js (566B)


      1 'use strict';
      2 
      3 const Action = require('./Action');
      4 
      5 class MessageUpdateAction extends Action {
      6   handle(data) {
      7     const channel = this.getChannel(data);
      8     if (channel) {
      9       const { id, channel_id, guild_id, author, timestamp, type } = data;
     10       const message = this.getMessage({ id, channel_id, guild_id, author, timestamp, type }, channel);
     11       if (message) {
     12         message.patch(data);
     13         return {
     14           old: message._edits[0],
     15           updated: message,
     16         };
     17       }
     18     }
     19 
     20     return {};
     21   }
     22 }
     23 
     24 module.exports = MessageUpdateAction;