mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
refactor: rename events to be consistent with WS names (#6010)
Co-authored-by: Noel <buechler.noel@outlook.com>
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
const Action = require('./Action');
|
||||
const { Events } = require('../../util/Constants');
|
||||
|
||||
let deprecationEmitted = false;
|
||||
|
||||
class MessageCreateAction extends Action {
|
||||
handle(data) {
|
||||
const client = this.client;
|
||||
@@ -25,10 +27,22 @@ class MessageCreateAction extends Action {
|
||||
|
||||
/**
|
||||
* Emitted whenever a message is created.
|
||||
* @event Client#message
|
||||
* @event Client#messageCreate
|
||||
* @param {Message} message The created message
|
||||
*/
|
||||
client.emit(Events.MESSAGE_CREATE, message);
|
||||
|
||||
/**
|
||||
* Emitted whenever a message is created.
|
||||
* @event Client#message
|
||||
* @param {Message} message The created message
|
||||
* @deprecated Use {@link Client#messageCreate} instead
|
||||
*/
|
||||
if (client.emit('message', message) && !deprecationEmitted) {
|
||||
deprecationEmitted = true;
|
||||
process.emitWarning('The message event is deprecated. Use messageCreate instead', 'DeprecationWarning');
|
||||
}
|
||||
|
||||
return { message };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user