Bots and Applications
Spacebar is backwards-compatibile with Discord.com, and so all existing bots and applications designed for Discord.com should work relatively easily when connected to a Spacebar instance instead.
The Discord Developer Panel is available at /developers, and allows you all the same functionality to create bots and applications on a Spacebar instance as Discord.com.
Bot Libraries
Discord.js
The Client
class constructor accepts a http
object, which you can use to change
the endpoints used.
const { Client } = require("discord.js");
const client = new Client({
http: {
version: 9,
api: "https://api.spacebar.chat",
cdn: "https://cdn.spacebar.chat",
invite: "https://spacebar.chat/invite",
},
});
client.login("your token here");
Discord.py
import discord
discord.http.Route.BASE = "https://api.spacebar.chat"
client = discord.Client()
client.run('your token here')
JDA
- Create a RestConfig instance:
RestConfig restConfig = new RestConfig();
- Use RestConfig#setBaseUrl to tell JDA what your Rest URI is (this NEEDS to include /api/
, because it's the api base url for all requests): restConfig.setBaseUrl("https://{REPLACE HERE WITH YOUR API SERVER URL}/api/v9");
- Create another class, and extend ConcurrentSessionController, e.g.
public class SpacebarSessionController extends ConcurrentSessionController
- Override the ConcurrentSessionController#getGateway method:
@NotNull @Override public String getGateway() { return "wss://{REPLACE HERE WITH YOUR GATEWAY SERVER URL}/?encoding=json&v=9&compress=zlib-stream"; }
- Finally, configure JDA to use your RestConfig & SpacebarSessionController, like this:
JDA jda = JDABuilder.createDefault("not_a_real_token_lol") .setRestConfig(restConfig) .setSessionController(new SpacebarSessionController()) .build();