Creating Channels, Invites, etc.

Javacord provides XyzBuilder classes to create new Discord entities like channels, webhooks, servers, etc.

Create Channels

You can get the channel builders for a specific server using the createXyzChannelBuilder or directly calling the constructor, e.g. creating a ServerVoiceChannel would look like this:

Server server = ...;
new ServerVoiceChannelBuilder(server)

Create Webhooks

You can get the WebhookBuilder for a specific text channel:

ServerTextChannel channel = ...;
new WebhookBuilder(channel)
    .setName("Captain Hook")
    .setAvatar(new File("C:/Users/Bastian/Pictures/puppy.jpg"))

Create Invites

You can get the InviteBuilder for a specific server channel:

ServerTextChannel channel = ...;
new InviteBuilder(channel)

Create Servers

You can get the ServerBuilder from the current api instance:

DiscordApi api = ...;
new ServerBuilder(api)
    .setName("My Awesome Server")

Note: By default, bots can only create servers if they are in less than 10 servers. You can contact the Discord support to request a higher limit.

Improve this page