mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
Fix DMs breaking
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -69,7 +69,8 @@ class ClientDataManager {
|
||||
this.client.emit(Constants.Events.CHANNEL_CREATE, channel);
|
||||
}
|
||||
|
||||
return this.client.channels.set(channel.id, channel);
|
||||
this.client.channels.set(channel.id, channel);
|
||||
return channel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ exports.Errors = {
|
||||
BAD_LOGIN: new Error('incorrect login details were provided'),
|
||||
};
|
||||
|
||||
const API = 'https://discordapp.com/api';
|
||||
const API = `https://discordapp.com/api/v${exports.DefaultOptions.protocol_version}`;
|
||||
|
||||
const Endpoints = exports.Endpoints = {
|
||||
// general endpoints
|
||||
|
||||
@@ -11,70 +11,6 @@ client.on('ready', () => {
|
||||
console.log('ready!');
|
||||
});
|
||||
|
||||
client.on('guildCreate', (guild) => {
|
||||
console.log(guild);
|
||||
});
|
||||
client.on('guildDelete', (guild) => {
|
||||
console.log('guilddel', guild.name);
|
||||
});
|
||||
client.on('guildUpdate', (old, guild) => {
|
||||
console.log('guildupdate', old.name, guild.name);
|
||||
});
|
||||
client.on('channelCreate', channel => {
|
||||
console.log(channel);
|
||||
});
|
||||
client.on('channelDelete', channel => {
|
||||
console.log('channDel', channel.name);
|
||||
});
|
||||
|
||||
client.on('channelUpdate', (old, chan) => {
|
||||
console.log('chan update', old.name, chan.name);
|
||||
});
|
||||
|
||||
client.on('guildMemberAdd', (guild, user) => {
|
||||
console.log('new guild member', user.user.username, 'in', guild.name);
|
||||
});
|
||||
|
||||
client.on('guildMemberRemove', (guild, user) => {
|
||||
console.log('dead guild member', user.user.username, 'in', guild.name);
|
||||
});
|
||||
|
||||
client.on('guildRoleCreate', (guild, role) => {
|
||||
console.log('new role', role.name, 'in', guild.name);
|
||||
role.edit({
|
||||
permissions: ['DEAFEN_MEMBERS'],
|
||||
name: 'deafen',
|
||||
}).then(role2 => {
|
||||
console.log('role replace from ' + role.name + ' to ' + role2.name);
|
||||
}).catch(console.log);
|
||||
});
|
||||
|
||||
client.on('guildRoleDelete', (guild, role) => {
|
||||
console.log('dead role', role.name, 'in', guild.name);
|
||||
});
|
||||
|
||||
client.on('guildRoleUpdate', (guild, old, newRole) => {
|
||||
console.log('updated role', old.name, 'to', newRole.name, 'in', guild.name);
|
||||
});
|
||||
|
||||
client.on('presenceUpdate', (oldUser, newUser) => {
|
||||
// console.log('presence from', oldUser.username, 'to', newUser.username);
|
||||
});
|
||||
|
||||
client.on('voiceStateUpdate', (oldMember, newMember) => {
|
||||
console.log('voiceState', oldMember.user.username, oldMember.voiceChannel + '', newMember.voiceChannel + '');
|
||||
});
|
||||
|
||||
client.on('typingStart.', (channel, user) => {
|
||||
if (user.username === 'hydrabolt')
|
||||
console.log(user.username, 'started typing in', channel.name);
|
||||
});
|
||||
|
||||
client.on('typingStop.', (channel, user, data) => {
|
||||
if (user.username === 'hydrabolt')
|
||||
console.log(user.username, 'stopped typing in', channel.name, 'after', data.elapsedTime + 'ms');
|
||||
});
|
||||
|
||||
client.on('message', message => {
|
||||
if (true) {
|
||||
if (message.content === 'makechann') {
|
||||
|
||||
Reference in New Issue
Block a user