mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 11:03:30 +01:00
Fix channelCreate being emitted twice - fixes #698
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1,13 +1,10 @@
|
|||||||
const AbstractHandler = require('./AbstractHandler');
|
const AbstractHandler = require('./AbstractHandler');
|
||||||
|
|
||||||
const Constants = require('../../../../util/Constants');
|
|
||||||
|
|
||||||
class ChannelCreateHandler extends AbstractHandler {
|
class ChannelCreateHandler extends AbstractHandler {
|
||||||
handle(packet) {
|
handle(packet) {
|
||||||
const client = this.packetManager.client;
|
const client = this.packetManager.client;
|
||||||
const data = packet.d;
|
const data = packet.d;
|
||||||
const response = client.actions.ChannelCreate.handle(data);
|
client.actions.ChannelCreate.handle(data);
|
||||||
if (response.channel) client.emit(Constants.Events.CHANNEL_CREATE, response.channel);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ client.on('ready', () => {
|
|||||||
console.log('ready!');
|
console.log('ready!');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
client.on('channelCreate', channel => {
|
||||||
|
console.log(`made ${channel.name}`);
|
||||||
|
});
|
||||||
|
|
||||||
client.on('guildMemberAdd', (g, m) => {
|
client.on('guildMemberAdd', (g, m) => {
|
||||||
console.log(`${m.user.username} joined ${g.name}`);
|
console.log(`${m.user.username} joined ${g.name}`);
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user