mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 09:03:29 +01:00
Moved all error strings to src/errors/messages and a few other things (#1695)
* Added missing error messages As well as `Guild#setRolePosition` and `Guild#setChannelPosition`'s first arg validation And fixed a typo in `Guild#setChannelPosition` `roles` -> `channels` * Reverted collection and Util constructors * Removed leftover messages Should have been in the second commit. * It's a single invalid permission and removed unused flag error * Fix INVALID_TOKEN -> TOKEN_INVALID as of #1703
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
const Constants = require('../util/Constants');
|
||||
const Util = require('../util/Util');
|
||||
const { Error } = require('../errors');
|
||||
|
||||
/**
|
||||
* A wrapper around the ClientUser's settings.
|
||||
@@ -54,7 +55,7 @@ class ClientUserSettings {
|
||||
*/
|
||||
addRestrictedGuild(guild) {
|
||||
const temp = Object.assign([], this.restrictedGuilds);
|
||||
if (temp.includes(guild.id)) return Promise.reject(new Error('Guild is already restricted'));
|
||||
if (temp.includes(guild.id)) return Promise.reject(new Error('GUILD_RESTRICTED', true));
|
||||
temp.push(guild.id);
|
||||
return this.update('restricted_guilds', temp).then(() => guild);
|
||||
}
|
||||
@@ -67,7 +68,7 @@ class ClientUserSettings {
|
||||
removeRestrictedGuild(guild) {
|
||||
const temp = Object.assign([], this.restrictedGuilds);
|
||||
const index = temp.indexOf(guild.id);
|
||||
if (index < 0) return Promise.reject(new Error('Guild is not restricted'));
|
||||
if (index < 0) return Promise.reject(new Error('GUILD_RESTRICTED'));
|
||||
temp.splice(index, 1);
|
||||
return this.update('restricted_guilds', temp).then(() => guild);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user