mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 17:13:31 +01:00
Backport: Guild#createChannel (#2145)
* Backport: Guild#createChannel * this should not return a buffer
This commit is contained in:
@@ -11,6 +11,7 @@ const Channel = require('../structures/Channel');
|
||||
const GuildMember = require('../structures/GuildMember');
|
||||
const Emoji = require('../structures/Emoji');
|
||||
const ReactionEmoji = require('../structures/ReactionEmoji');
|
||||
const Role = require('../structures/Role');
|
||||
|
||||
/**
|
||||
* The DataResolver identifies different objects and tries to resolve a specific piece of information from them, e.g.
|
||||
@@ -101,6 +102,27 @@ class ClientDataResolver {
|
||||
return guild.members.get(user.id) || null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Data that can be resolved to a Role object. This can be:
|
||||
* * A Role
|
||||
* * A Snowflake
|
||||
* @typedef {Role|Snowflake} RoleResolvable
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves a RoleResolvable to a Role object.
|
||||
* @param {GuildResolvable} guild The guild that this role is part of
|
||||
* @param {RoleResolvable} role The role resolvable to resolve
|
||||
* @returns {?Role}
|
||||
*/
|
||||
resolveRole(guild, role) {
|
||||
if (role instanceof Role) return role;
|
||||
guild = this.resolveGuild(guild);
|
||||
if (!guild) return null;
|
||||
if (typeof role === 'string') return guild.roles.get(role);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Data that can be resolved to give a Channel object. This can be:
|
||||
* * A Channel object
|
||||
|
||||
Reference in New Issue
Block a user