Get Servers

LoopServers

Retrieve a list of Discord servers the bot is a member of.

This data is retrieved from Discord and may not include all server information.
  • Loop block: the blocks placed inside it run once for each item, and can use the current item's outputs.

Inputs

Loop Body

Blocks to run for each server.

Holds blocks

Outputs

Iteration Number

Current iteration (1-based).

Example: 1

Total Iterations

Total number of iterations.

Example: 5

Server ID

ID of the server.

Server Name

Name of the server.

Server Icon URL

Icon URL for the server.

Build a bot using blocks like Get Servers

Use this block in our visual flow editor. Bots are hosted 24/7 for free on inventor.bot.

Advanced Documentation

This documentation can be useful when using code mode. View as Markdown

ID: get_discord_guilds
  • Loop block: write for item := range get_discord_guilds(Args{...}) { ... } and read the current item's outputs from item. See loops.

Inputs

FieldInventScript nameValue
Loop Bodybodyblocks: func() { ... }

Outputs

FieldInventScript nameValue
Iteration Numberiteration_numbere.g. "1"
Total Iterationstotal_iterationse.g. "5"
Server IDserver_id
Server Nameserver_name
Server Icon URLserver_icon_url

Example InventScript

for guild := range get_discord_guilds() {
	send_text_message(Args{
		channel_id:      trigger.channel_id,
		message_content: "Server ID: " + guild.server_id,
	})
}

More servers blocks