Skip to main content

Channels

Channels are where everything happens. This subcategory creates them, reads them, changes them, and sends messages into them.

Show the whole Channels flyout

The Channels subcategory

Sending a message​

Send message in channel

send message in channel is the block you will use more than any other in DisFuse. Give it a channel, then build the message in the components input using the Components blocks. The files input takes file blocks.

Message sent by the bot

Right after sending, message sent by the bot is the message that just went out. Use it to react to it, pin it, or store its ID.

Allowing pings​

Send message in channel with allowed pings

By default, a message your bot sends can only ping users. Role, @everyone and @here mentions still show up in the message, but nobody gets a notification. This stops people from using your bot to ping a role or everyone just by getting it to repeat what they typed.

To change which pings are allowed, click the gear on the block and check include allowed pings. An allowed pings row appears on the block. Check the pings you want this message to send:

OptionWhat it allows
usersMentions of members and users
rolesMentions of roles
@everyone & @here@everyone and @here

The gear only shows or hides the row. Your choices still apply when the row is hidden.

Every block that sends, replies to or edits a message has this option, including DMs, interaction replies, webhooks and polls.

info

Projects made before this option existed keep pinging like they always did. Their blocks allow all three pings, with the row hidden. Show the row from the gear to change that.

Getting a channel​

BlockReturns
get channelA channel by name, or by ID.
for each channelLoops over every channel in a server.
current channelThe channel being handled inside that loop.

Creating a channel​

Create a channel

create a channel in the server takes a name, an optional category, and a type: text, announcements, voice, stage or forum. Blocks in the then part run once it exists.

Created channel

created channel is the new channel. Send a welcome message into it, set permissions on it, or store its ID.

Clone a channel

clone the channel copies an existing channel, permissions included, under a new name. This is how "nuke and recreate" moderation commands work.

Reading a channel​

BlockReturns
nameThe channel name.
idIts ID.
urlA link that jumps to it.
topicThe channel topic.
categoryThe category it sits in.
serverThe server the channel belongs to. Plug it into any Server block.
slowmodeIts slowmode, in seconds.
nsfwWhether it is marked age restricted.
typeWhether it is a given kind of channel.
createdWhen it was created.
deletableWhether the bot is allowed to delete it.
manageableWhether the bot is allowed to change it.
voice member countHow many members are connected to a voice or stage channel right now. Returns 0 for any other kind of channel.

Changing a channel​

BlockWhat it does
renameRenames the channel.
set topicSets the topic.
set slowmodeSets seconds between messages.
set nsfwMarks it age restricted.
move to categoryMoves it into a category, optionally syncing permissions.
sync permissionsResets its permissions to match its category.
set positionMoves it up or down the channel list.
auto archiveSets how long threads stay active before archiving.
move memberMoves a member to another voice channel. Does nothing if the member is not in a voice channel.
deleteDeletes the channel.

Most of these accept a reason, which is written into the server's audit log.

Permissions​

Set permission

set permission ... to Allow/Deny/Default on channel ... for role/everyone/member is how you lock a channel down or open it up. Pick the permission from the dropdown, and the target can be a role, a member, or everyone.

Delete permission

delete all permissions of ... removes a role or member's override entirely, so they fall back to the server defaults.

This pair is what ticket bots use: create a channel, deny View Channel for everyone, allow it for the person who opened the ticket.

Bulk actions​

Bulk delete

delete the last ... messages on channel clears a number of recent messages at once.

warning

Discord does not allow bulk deleting messages older than 14 days. Anything older has to be deleted one at a time.

Start typing

start typing on channel shows the "bot is typing" indicator. Use it before something slow so the channel does not look dead.

Reading recent messages​

Fetch last messages

get last ... messages of channel fetches a batch. Inside the then part:

Fetched message

message # 1 picks one out of the batch by position.

Waiting for a reply​

Wait for responses

wait for responses in channel collects messages for a while, then runs one of two stacks: one when messages arrived, one when the time ran out.

FieldWhat it is
Accept messages ifA test that decides whether a message counts.
Time (seconds)How long to wait.
Max messagesHow many to collect before stopping early.
When finished collectingRuns with the collected messages.
If no responses receivedRuns when nothing matched in time.

Message being checked

Inside the filter, message being checked is the candidate. A common filter is "the author is the person who ran the command".

Responses

In the finished part, responses is a list. Use the Lists blocks to read it.

This is how you build a setup wizard that asks questions in a channel one at a time.

A worked example: a lockdown command​

  1. A slash command called lockdown.
  2. for each channel on the server.
  3. Skip anything that is not a text channel, using channel is Text channel?.
  4. set permission Send Messages to Deny on channel <current channel> for @everyone, with the reason "Lockdown by " and the moderator's name.
  5. Reply with how many channels were locked.