Skip to main content

Server

Blocks about a whole Discord server: its name, its members, its icon, and its boosts.

Show the whole Server flyout

The Server subcategory

Getting a server​

Get a server

get the server with the name equal to ... looks a server up. It also accepts a server ID, which is more reliable, since two servers can share a name.

Most of the time you do not need this block. Event blocks already hand you a server, interaction blocks have server of the interaction, and server of channel from Channels gets the server any channel belongs to.

For each server

for each server the bot is in loops over all of them.

Current server in loop

Inside that loop, current server in the loop is the one being handled.

Reading a server​

BlockReturns
nameThe server name.
idIts ID.
member countHow many members it has.
iconA URL to the server icon.
bannerA URL to the server banner.
descriptionThe server description.
owner idThe owner's user ID.
createdWhen the server was created.
vanity urlThe custom invite URL, if the server has one.
verifiedWhether Discord has verified the server.
afk channelThe AFK voice channel.
system channelWhere Discord's own join messages go.
rules channelThe rules channel of a community server.

Boosts​

BlockReturns
boost countHow many boosts the server has.
boost levelThe boost tier, 0 to 3.
progress bar enabledWhether the boost progress bar is shown.

Set progress bar

show the boost progress bar of server turns that bar on or off.

For events when someone boosts or the level changes, see Boosts.

Actions​

BlockWhat it does
disable invitesPauses all invites to the server. A raid control measure.
leaveMakes the bot leave the server.
warning

leave server cannot be undone from inside the bot. Somebody has to re-invite it.

A worked example: a server info command​

  1. A slash command called serverinfo.
  2. Build a container with a section that uses icon URL of server as its thumbnail.
  3. Inside the container, text displays with the name, member count, boost level and creation date.
  4. Format the creation date with create timestamp from date from Time, so it shows in each viewer's own time zone.