mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 17:13:31 +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:
@@ -3,6 +3,7 @@ const Constants = require('../util/Constants');
|
||||
const { Presence } = require('./Presence');
|
||||
const UserProfile = require('./UserProfile');
|
||||
const Snowflake = require('../util/Snowflake');
|
||||
const { Error } = require('../errors');
|
||||
|
||||
/**
|
||||
* Represents a user on Discord.
|
||||
@@ -212,7 +213,7 @@ class User {
|
||||
* @returns {Promise<DMChannel>}
|
||||
*/
|
||||
deleteDM() {
|
||||
if (!this.dmChannel) return Promise.reject(new Error('No DM Channel exists!'));
|
||||
if (!this.dmChannel) return Promise.reject(new Error('USER_NO_DMCHANNEL'));
|
||||
return this.client.api.channels[this.dmChannel.id].delete()
|
||||
.then(data => this.client.actions.ChannelDelete.handle(data).channel);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user