mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 01:53:30 +01:00
refactor: remove user bot methods (#2559)
* [WIP] Remove user bots * more backend userbot removal * Add mfaEnabled back * revert client presences store removal * partially revert getAuth changes * remove more no longer used children of ClientUserGuildSettings * fix a bug with this pr and TextBasedChannel.applyToClass * remove a syncGuilds reference * more user bot data handling * various guildSync cleanup * bots can't call logout Had the user/bot portions of the code mixed up. Though, does this need to be a promise anymore? * make ClientManager#destroy() sync It nolonger needs to be a promise, and nothing depended on it being a promise that I can tell. * requested change * Fix massive error * no longer used as it's userbot only
This commit is contained in:
@@ -20,8 +20,6 @@ class ActionsManager {
|
||||
this.register(require('./GuildRoleDelete'));
|
||||
this.register(require('./GuildRoleUpdate'));
|
||||
this.register(require('./UserUpdate'));
|
||||
this.register(require('./UserNoteUpdate'));
|
||||
this.register(require('./GuildSync'));
|
||||
this.register(require('./GuildEmojiCreate'));
|
||||
this.register(require('./GuildEmojiDelete'));
|
||||
this.register(require('./GuildEmojiUpdate'));
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
const Action = require('./Action');
|
||||
|
||||
class GuildSync extends Action {
|
||||
handle(data) {
|
||||
const client = this.client;
|
||||
|
||||
const guild = client.guilds.get(data.id);
|
||||
if (guild) {
|
||||
if (data.presences) {
|
||||
for (const presence of data.presences) guild.presences.add(presence);
|
||||
}
|
||||
|
||||
if (data.members) {
|
||||
for (const syncMember of data.members) {
|
||||
const member = guild.members.get(syncMember.user.id);
|
||||
if (member) {
|
||||
member._patch(syncMember);
|
||||
} else {
|
||||
guild.members.add(syncMember, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ('large' in data) guild.large = data.large;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = GuildSync;
|
||||
@@ -1,30 +0,0 @@
|
||||
const Action = require('./Action');
|
||||
const { Events } = require('../../util/Constants');
|
||||
|
||||
class UserNoteUpdateAction extends Action {
|
||||
handle(data) {
|
||||
const client = this.client;
|
||||
|
||||
const oldNote = client.user.notes.get(data.id);
|
||||
const note = data.note.length ? data.note : null;
|
||||
|
||||
client.user.notes.set(data.id, note);
|
||||
|
||||
client.emit(Events.USER_NOTE_UPDATE, data.id, oldNote, note);
|
||||
|
||||
return {
|
||||
old: oldNote,
|
||||
updated: note,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Emitted whenever a note is updated.
|
||||
* @event Client#userNoteUpdate
|
||||
* @param {User} user The user the note belongs to
|
||||
* @param {string} oldNote The note content before the update
|
||||
* @param {string} newNote The note content after the update
|
||||
*/
|
||||
|
||||
module.exports = UserNoteUpdateAction;
|
||||
Reference in New Issue
Block a user