Constructor
new StoreChannel(guild, data)
Parameters:
Name | Type | Description |
---|---|---|
guild |
* | The guild the store channel is part of |
data |
* | The data for the store channel |
- Source:
Extends
Members
(readonly) client :Client
The client that instantiated this
Type:
- Overrides:
- Source:
(readonly) createdAt :Date
The time the channel was created at
Type:
- Date
- Overrides:
- Source:
(readonly) createdTimestamp :number
The timestamp the channel was created at
Type:
- number
- Overrides:
- Source:
(readonly) deletable :boolean
Whether the channel is deletable by the client user
Type:
- boolean
- Overrides:
- Source:
deleted :boolean
Whether the channel has been deleted
Type:
- boolean
- Overrides:
- Source:
guild :Guild
The guild the channel is in
Type:
- Overrides:
- Source:
id :Snowflake
The unique ID of the channel
Type:
- Overrides:
- Source:
(readonly) manageable :boolean
Whether the channel is manageable by the client user
Type:
- boolean
- Overrides:
- Source:
(readonly) members :Collection.<Snowflake, GuildMember>
A collection of members that can see this channel, mapped by their ID
Type:
- Collection.<Snowflake, GuildMember>
- Overrides:
- Source:
name :string
The name of the guild channel
Type:
- string
- Overrides:
- Source:
(readonly) nsfw :boolean
If the guild considers this channel NSFW
Type:
- boolean
- Source:
(readonly, nullable) parent :CategoryChannel
The category parent of this channel
Type:
- Overrides:
- Source:
(nullable) parentID :Snowflake
The ID of the category parent of this channel
Type:
- Overrides:
- Source:
permissionOverwrites :Collection.<Snowflake, PermissionOverwrites>
A map of permission overwrites in this channel for roles and users
Type:
- Collection.<Snowflake, PermissionOverwrites>
- Overrides:
- Source:
(readonly, nullable) permissionsLocked :boolean
If the permissionOverwrites match the parent channel, null if no parent
Type:
- boolean
- Overrides:
- Source:
(readonly) position :number
The position of the channel
Type:
- number
- Overrides:
- Source:
rawPosition :number
The raw position of the channel from discord
Type:
- number
- Overrides:
- Source:
type :string
The type of the channel, either:
* `dm` - a DM channel
* `text` - a guild text channel
* `voice` - a guild voice channel
* `category` - a guild category channel
* `news` - a guild news channel
* `store` - a guild store channel
* `unknown` - a generic channel of unknown type, could be Channel or GuildChannel
Type:
- string
- Overrides:
- Source:
(readonly) viewable :boolean
Whether the channel is viewable by the client user
Type:
- boolean
- Overrides:
- Source:
Methods
clone(optionsopt) → {Promise.<GuildChannel>}
Clones this channel.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
The options
Properties
|
- Overrides:
- Source:
Returns:
- Type
- Promise.<GuildChannel>
createInvite(optionsopt) → {Promise.<Invite>}
Creates an invite to this guild channel.
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
{} | Options for the invite
Properties
|
- Overrides:
- Source:
Returns:
- Type
- Promise.<Invite>
Example
// Create an invite to a channel
channel.createInvite()
.then(invite => console.log(`Created an invite with a code of ${invite.code}`))
.catch(console.error);
createOverwrite(userOrRole, options, reasonopt) → {Promise.<GuildChannel>}
Overwrites the permissions for a user or role in this channel. (replaces if existent)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
userOrRole |
RoleResolvable | UserResolvable | The user or role to update | |
options |
PermissionOverwriteOptions | The options for the update | |
reason |
string |
<optional> |
Reason for creating/editing this overwrite |
- Overrides:
- Source:
Returns:
- Type
- Promise.<GuildChannel>
Example
// Create or Replace permissions overwrites for a message author
message.channel.createOverwrite(message.author, {
SEND_MESSAGES: false
})
.then(channel => console.log(channel.permissionOverwrites.get(message.author.id)))
.catch(console.error);
delete(reasonopt) → {Promise.<GuildChannel>}
Deletes this channel.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
reason |
string |
<optional> |
Reason for deleting this channel |
- Overrides:
- Source:
Returns:
- Type
- Promise.<GuildChannel>
Example
// Delete the channel
channel.delete('making room for new channels')
.then(console.log)
.catch(console.error);
edit(data, reasonopt) → {Promise.<GuildChannel>}
Edits the channel.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
data |
ChannelData | The new data for the channel | |
reason |
string |
<optional> |
Reason for editing this channel |
- Overrides:
- Source:
Returns:
- Type
- Promise.<GuildChannel>
Example
// Edit a channel
channel.edit({ name: 'new-channel' })
.then(console.log)
.catch(console.error);
equals(channel) → {boolean}
Checks if this channel has the same type, topic, position, name, overwrites and ID as another channel.
In most cases, a simple `channel.id === channel2.id` will do, and is much faster too.
Parameters:
Name | Type | Description |
---|---|---|
channel |
GuildChannel | Channel to compare with |
- Overrides:
- Source:
Returns:
- Type
- boolean
fetch(forceopt) → {Promise.<Channel>}
Fetches this channel.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
force |
boolean |
<optional> |
false | Whether to skip the cache check and request the API |
- Overrides:
- Source:
Returns:
- Type
- Promise.<Channel>
fetchInvites() → {Promise.<Collection.<string, Invite>>}
Fetches a collection of invites to this guild channel.
Resolves with a collection mapping invites by their codes.
- Overrides:
- Source:
Returns:
- Type
- Promise.<Collection.<string, Invite>>
isText() → {boolean}
Indicates whether this channel is text-based.
- Overrides:
- Source:
Returns:
- Type
- boolean
lockPermissions() → {Promise.<GuildChannel>}
Locks in the permission overwrites from the parent channel.
- Overrides:
- Source:
Returns:
- Type
- Promise.<GuildChannel>
(private) memberPermissions(member) → {Readonly.<Permissions>}
Gets the overall set of permissions for a member in this channel, taking into account channel overwrites.
Parameters:
Name | Type | Description |
---|---|---|
member |
GuildMember | The member to obtain the overall permissions for |
- Overrides:
- Source:
Returns:
- Type
- Readonly.<Permissions>
overwritePermissions(overwrites, reasonopt) → {Promise.<GuildChannel>}
Replaces the permission overwrites in this channel.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
overwrites |
Array.<OverwriteResolvable> | Collection.<Snowflake, OverwriteResolvable> | Permission overwrites the channel gets updated with | |
reason |
string |
<optional> |
Reason for updating the channel overwrites |
- Overrides:
- Source:
Returns:
- Type
- Promise.<GuildChannel>
Example
channel.overwritePermissions([
{
id: message.author.id,
deny: ['VIEW_CHANNEL'],
},
], 'Needed to change permissions');
permissionsFor(memberOrRole) → {Readonly.<Permissions>}
Gets the overall set of permissions for a member or role in this channel, taking into account channel overwrites.
Parameters:
Name | Type | Description |
---|---|---|
memberOrRole |
GuildMemberResolvable | RoleResolvable | The member or role to obtain the overall permissions for |
- Overrides:
- Source:
Returns:
- Type
- Readonly.<Permissions>
(private) rolePermissions(role) → {Readonly.<Permissions>}
Gets the overall set of permissions for a role in this channel, taking into account channel overwrites.
Parameters:
Name | Type | Description |
---|---|---|
role |
Role | The role to obtain the overall permissions for |
- Overrides:
- Source:
Returns:
- Type
- Readonly.<Permissions>
setName(name, reasonopt) → {Promise.<GuildChannel>}
Sets a new name for the guild channel.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | The new name for the guild channel | |
reason |
string |
<optional> |
Reason for changing the guild channel's name |
- Overrides:
- Source:
Returns:
- Type
- Promise.<GuildChannel>
Example
// Set a new channel name
channel.setName('not_general')
.then(newChannel => console.log(`Channel's new name is ${newChannel.name}`))
.catch(console.error);
setParent(channel, optionsopt) → {Promise.<GuildChannel>}
Sets the category parent of this channel.
Parameters:
Name | Type | Attributes | Default | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
channel |
CategoryChannel | Snowflake | Parent channel | |||||||||||||||||
options |
Object |
<optional> |
{} | Options to pass
Properties
|
- Overrides:
- Source:
Returns:
- Type
- Promise.<GuildChannel>
Example
// Add a parent to a channel
message.channel.setParent('355908108431917066', { lockPermissions: false })
.then(channel => console.log(`New parent of ${message.channel.name}: ${channel.name}`))
.catch(console.error);
setPosition(position, optionsopt) → {Promise.<GuildChannel>}
Sets a new position for the guild channel.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
position |
number | The new position for the guild channel | ||||||||||||||||
options |
Object |
<optional> |
Options for setting position
Properties
|
- Overrides:
- Source:
Returns:
- Type
- Promise.<GuildChannel>
Example
// Set a new channel position
channel.setPosition(2)
.then(newChannel => console.log(`Channel's new position is ${newChannel.position}`))
.catch(console.error);
setTopic(topic, reasonopt) → {Promise.<GuildChannel>}
Sets a new topic for the guild channel.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
topic |
string | The new topic for the guild channel | |
reason |
string |
<optional> |
Reason for changing the guild channel's topic |
- Overrides:
- Source:
Returns:
- Type
- Promise.<GuildChannel>
Example
// Set a new channel topic
channel.setTopic('needs more rate limiting')
.then(newChannel => console.log(`Channel's new topic is ${newChannel.topic}`))
.catch(console.error);
toString() → {string}
When concatenated with a string, this automatically returns the channel's mention instead of the Channel object.
- Overrides:
- Source:
Returns:
- Type
- string
Example
// Logs: Hello from <#123456789012345678>!
console.log(`Hello from ${channel}!`);
updateOverwrite(userOrRole, options, reasonopt) → {Promise.<GuildChannel>}
Updates Overwrites for a user or role in this channel. (creates if non-existent)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
userOrRole |
RoleResolvable | UserResolvable | The user or role to update | |
options |
PermissionOverwriteOptions | The options for the update | |
reason |
string |
<optional> |
Reason for creating/editing this overwrite |
- Overrides:
- Source:
Returns:
- Type
- Promise.<GuildChannel>
Example
// Update or Create permission overwrites for a message author
message.channel.updateOverwrite(message.author, {
SEND_MESSAGES: false
})
.then(channel => console.log(channel.permissionOverwrites.get(message.author.id)))
.catch(console.error);