mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
Bridged WebSocket Events and REST Requests. Now REST Requests will respond exactly like WS Events to data
This commit is contained in:
31
src/client/actions/MessageCreate.js
Normal file
31
src/client/actions/MessageCreate.js
Normal file
@@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
|
||||
const Action = require('./Action');
|
||||
const Constants = require('../../util/Constants');
|
||||
const Message = require('../../structures/Message');
|
||||
|
||||
class MessageCreateAction extends Action {
|
||||
|
||||
constructor(client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
handle(data) {
|
||||
|
||||
let client = this.client;
|
||||
let channel = client.store.get('channels', data.channel_id);
|
||||
|
||||
if (channel) {
|
||||
let message = channel._cacheMessage(new Message(channel, data, client));
|
||||
return {
|
||||
m: message,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
m: null,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = MessageCreateAction;
|
||||
Reference in New Issue
Block a user