mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
refactor: change xID to xId (#6036)
* refactor: change `xID` to `xId` * Update src/managers/MessageManager.js Co-authored-by: Noel <buechler.noel@outlook.com> Co-authored-by: Noel <buechler.noel@outlook.com>
This commit is contained in:
@@ -44,7 +44,7 @@ class GuildBanManager extends CachedManager {
|
||||
* @returns {?GuildBan}
|
||||
*/
|
||||
resolve(ban) {
|
||||
return super.resolve(ban) ?? super.resolve(this.client.users.resolveID(ban));
|
||||
return super.resolve(ban) ?? super.resolve(this.client.users.resolveId(ban));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,10 +91,10 @@ class GuildBanManager extends CachedManager {
|
||||
*/
|
||||
fetch(options) {
|
||||
if (!options) return this._fetchMany();
|
||||
const user = this.client.users.resolveID(options);
|
||||
const user = this.client.users.resolveId(options);
|
||||
if (user) return this._fetchSingle({ user, cache: true });
|
||||
if (options.user) {
|
||||
options.user = this.client.users.resolveID(options.user);
|
||||
options.user = this.client.users.resolveId(options.user);
|
||||
}
|
||||
if (!options.user) {
|
||||
if ('cache' in options) return this._fetchMany(options.cache);
|
||||
@@ -131,16 +131,16 @@ class GuildBanManager extends CachedManager {
|
||||
* @param {BanOptions} [options] Options for the ban
|
||||
* @returns {Promise<GuildMember|User|Snowflake>} Result object will be resolved as specifically as possible.
|
||||
* If the GuildMember cannot be resolved, the User will instead be attempted to be resolved. If that also cannot
|
||||
* be resolved, the user ID will be the result.
|
||||
* be resolved, the user id will be the result.
|
||||
* @example
|
||||
* // Ban a user by ID (or with a user/guild member object)
|
||||
* // Ban a user by id (or with a user/guild member object)
|
||||
* guild.bans.create('84484653687267328')
|
||||
* .then(user => console.log(`Banned ${user.username ?? user.id ?? user} from ${guild.name}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
async create(user, options = { days: 0 }) {
|
||||
if (typeof options !== 'object') throw new TypeError('INVALID_TYPE', 'options', 'object', true);
|
||||
const id = this.client.users.resolveID(user);
|
||||
const id = this.client.users.resolveId(user);
|
||||
if (!id) throw new Error('BAN_RESOLVE_ID', true);
|
||||
await this.client.api
|
||||
.guilds(this.guild.id)
|
||||
@@ -165,13 +165,13 @@ class GuildBanManager extends CachedManager {
|
||||
* @param {string} [reason] Reason for unbanning user
|
||||
* @returns {Promise<User>}
|
||||
* @example
|
||||
* // Unban a user by ID (or with a user/guild member object)
|
||||
* // Unban a user by id (or with a user/guild member object)
|
||||
* guild.bans.remove('84484653687267328')
|
||||
* .then(user => console.log(`Unbanned ${user.username} from ${guild.name}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
async remove(user, reason) {
|
||||
const id = this.client.users.resolveID(user);
|
||||
const id = this.client.users.resolveId(user);
|
||||
if (!id) throw new Error('BAN_RESOLVE_ID');
|
||||
await this.client.api.guilds(this.guild.id).bans(id).delete({ reason });
|
||||
return this.client.users.resolve(user);
|
||||
|
||||
Reference in New Issue
Block a user