Bafflux Docs Developer Portal

API reference

Community and Discovery

Turn on Community for a server, list it in Discovery, and read the public server and app lists.

Community

A Community server has a rules channel and a Community Updates channel (kept for notices meant for moderators). Only Community servers can be listed in Discovery. Both requests need Manage Server.

RequestBody / returns
GET /api/servers/{serverId}/communityThe settings below
PUT /api/servers/{serverId}/community{ "enabled": true, "rulesChannelId": "...", "updatesChannelId": "..." } turns it on or changes the channels; { "enabled": false } turns it off
json
{
	"community": true,
	"rulesChannelId": "103700000000000201",
	"updatesChannelId": "103700000000000202",
	"discovery": {
		"listed": true,
		"category": "art_creators",
		"description": "Share pixel art, get feedback on sprites, join weekly palette challenges.",
		"tags": ["pixel art", "sprites", "gamedev"]
	}
}
  • Both channels must be text channels in the server. Pass "new" instead of an ID to have one made: #rules, or #moderator-only for updates (hidden from @everyone).
  • Turning Community on needs both channels. Once it's on, leave a field out to keep that channel.
  • Turning it off clears both channels and takes the server out of Discovery. The listing's category, description and tags are kept for next time.
  • If a chosen channel is deleted, its field goes back to null.

Listing a server

RequestBody
PUT /api/servers/{serverId}/discovery{ "listed": true, "category": "gaming", "description": "...", "tags": ["speedruns"] }

Needs Manage Server and returns the same object as GET .../community.

FieldRules
listedtrue needs a Community server and a description. false unlists at any time
categorygaming, music, entertainment, science_tech, education, art_creators, anime_manga, community_social or other
descriptionUp to 300 characters
tagsUp to 5 keywords, each up to 24 characters, no commas. Duplicates (in any case) are dropped

Browsing servers

GET /api/discovery/servers?q=&category=&offset=&limit= lists Community servers that are listed, with the most members first.

QueryNotes
qMatches the name, description and tags, ignoring case
categoryOne of the keys above; leave it out for every category
offset, limitlimit is 1 to 48 (default 24). offset stops at 960; search to narrow things down past that
json
{
	"items": [
		{
			"id": "103700000000000000",
			"name": "Pixel Painters Guild",
			"iconUrl": null,
			"description": "Share pixel art, get feedback on sprites, join weekly palette challenges.",
			"category": "art_creators",
			"tags": ["pixel art", "sprites", "gamedev"],
			"memberCount": 182,
			"onlineCount": 23,
			"joined": false,
			"types": ["verified"]
		}
	],
	"hasMore": false
}

onlineCount counts members connected right now (Invisible counts as offline). joined is whether you're already in it. types are its server types. Bafflux staff and developer servers never show up here and can't be listed (400 team_server).

POST /api/discovery/servers/{serverId}/join joins a listed server without an invite and returns the server, like accepting an invite. The same rules apply: banned people get 403 banned, servers with paused invites answer 403 invites_paused, and nobody can be in more than 100 servers (400 too_many_servers). A server that isn't listed answers 404. Bots can't use this route.

The App Directory

GET /api/discovery/apps?q=&offset=&limit= lists public bots their developers chose to show. Verified bots come first, then the ones in the most servers. q matches the app name, description and the bot's username.

json
{
	"items": [
		{
			"id": "103700000000000500",
			"name": "Palette Helper",
			"description": "Posts a random color palette with /palette.",
			"iconUrl": null,
			"bot": { "id": "103700000000000501", "username": "palette_helper", "displayName": "Palette Helper", "avatarUrl": null, "tag": "bot" },
			"serverCount": 12
		}
	],
	"hasMore": false
}

bot.tag is verified_bot for bots checked by Bafflux. Adding one works like an install link: the person picks a server they manage and the permissions to give it (POST /api/applications/{id}/authorize with { "serverId": "...", "permissions": 0 }).

To list your app, turn on Show in App Directory on its Bot page in the Developer Portal, or send PATCH /api/applications/{id} with { "inDirectory": true }. Only public bots can be listed (400 not_public otherwise), and making a bot private unlists it.