Convert Figma logo to code with AI

discord logodiscord-api-docs

Official Discord API Documentation

5,940
1,255
5,940
255

Top Related Projects

An API wrapper for Discord written in Python.

A powerful JavaScript library for interacting with the Discord API

4,280

Java wrapper for the popular chat & VOIP service: Discord https://discord.com

Discord4J is a fast, powerful, unopinionated, reactive library to enable quick and easy development of Discord bots for Java, Kotlin, and other JVM languages using the official Discord Bot API.

Quick Overview

The discord/discord-api-docs repository contains the official documentation for the Discord API. It provides comprehensive information about Discord's various API endpoints, data models, and best practices for developers building applications and bots for the Discord platform.

Pros

  • Comprehensive and detailed documentation covering all aspects of the Discord API
  • Regularly updated to reflect the latest changes and features in the Discord platform
  • Includes examples and explanations for common use cases and implementations
  • Maintained by the official Discord team, ensuring accuracy and reliability

Cons

  • Can be overwhelming for beginners due to the extensive amount of information
  • Some sections may lack detailed explanations or examples for more complex features
  • Documentation updates may occasionally lag behind actual API changes
  • Navigation can be challenging for users unfamiliar with the structure of the documentation

Note: As this is a documentation repository and not a code library, the code examples and getting started instructions sections have been omitted.

Competitor Comparisons

An API wrapper for Discord written in Python.

Pros of discord.py

  • Ready-to-use Python library for Discord bot development
  • Extensive documentation and community support
  • Abstracts away many low-level API details for easier implementation

Cons of discord.py

  • Limited to Python programming language
  • May not always be up-to-date with the latest Discord API changes
  • Adds an extra layer of abstraction, potentially limiting fine-grained control

Code Comparison

discord-api-docs (JSON example):

{
  "content": "Hello, World!",
  "tts": false,
  "embeds": []
}

discord.py (Python example):

@client.event
async def on_message(message):
    if message.content.startswith('!hello'):
        await message.channel.send('Hello, World!')

The discord-api-docs repository provides raw API documentation and examples, while discord.py offers a higher-level interface for bot development in Python. The discord-api-docs example shows the JSON structure for sending a message, whereas the discord.py example demonstrates how to respond to a command using the library's event system.

discord-api-docs is language-agnostic and provides comprehensive API documentation, making it suitable for developers working in various programming languages. On the other hand, discord.py simplifies bot development for Python users but is limited to that specific language ecosystem.

A powerful JavaScript library for interacting with the Discord API

Pros of discord.js

  • Provides a high-level, object-oriented API for interacting with Discord
  • Simplifies bot development with built-in abstractions and utility functions
  • Offers TypeScript support for improved type safety and developer experience

Cons of discord.js

  • Requires learning an additional library on top of the Discord API
  • May have a larger footprint and overhead compared to direct API usage
  • Potential for version mismatches or delays in implementing new Discord features

Code Comparison

discord-api-docs (raw API usage):

fetch('https://discord.com/api/v10/channels/123456789/messages', {
  method: 'POST',
  headers: { 'Authorization': 'Bot TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ content: 'Hello, Discord!' })
});

discord.js:

const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });

client.on('ready', () => {
  client.channels.cache.get('123456789').send('Hello, Discord!');
});

Summary

discord-api-docs provides comprehensive documentation for direct API interaction, while discord.js offers a more developer-friendly approach with abstracted methods and object-oriented design. The choice between them depends on the developer's preferences, project requirements, and desired level of control over API interactions.

4,280

Java wrapper for the popular chat & VOIP service: Discord https://discord.com

Pros of JDA

  • Ready-to-use Java library for Discord bot development
  • Extensive documentation and examples for quick implementation
  • Active community and frequent updates

Cons of JDA

  • Limited to Java programming language
  • May not always reflect the most up-to-date Discord API changes immediately

Code Comparison

discord-api-docs (REST API example):

const response = await fetch('https://discord.com/api/channels/123456789/messages', {
  method: 'POST',
  headers: {
    'Authorization': 'Bot TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ content: 'Hello, Discord!' }),
});

JDA (Java library example):

JDA jda = JDABuilder.createDefault("TOKEN").build();
TextChannel channel = jda.getTextChannelById("123456789");
channel.sendMessage("Hello, Discord!").queue();

Summary

discord-api-docs provides comprehensive documentation for the Discord API, suitable for developers using any programming language. It offers flexibility but requires more setup and implementation effort.

JDA is a Java-specific library that simplifies Discord bot development with pre-built methods and abstractions. It's ideal for Java developers but lacks the language-agnostic nature of the official API documentation.

Choose discord-api-docs for a deeper understanding of the Discord API or when working with languages other than Java. Opt for JDA when developing Discord bots in Java for quicker implementation and easier maintenance.

Discord4J is a fast, powerful, unopinionated, reactive library to enable quick and easy development of Discord bots for Java, Kotlin, and other JVM languages using the official Discord Bot API.

Pros of Discord4J

  • Provides a ready-to-use Java library for Discord bot development
  • Offers higher-level abstractions and convenience methods for common Discord operations
  • Includes built-in reactive programming support with Project Reactor

Cons of Discord4J

  • Limited to Java programming language
  • May have a steeper learning curve for developers new to reactive programming
  • Requires keeping up with Discord API changes and potential library updates

Code Comparison

Discord4J example:

GatewayDiscordClient client = DiscordClientBuilder.create(token)
    .build()
    .login()
    .block();

client.getEventDispatcher().on(MessageCreateEvent.class)
    .map(MessageCreateEvent::getMessage)
    .filter(message -> message.getContent().equalsIgnoreCase("!ping"))
    .flatMap(Message::getChannel)
    .flatMap(channel -> channel.createMessage("Pong!"))
    .subscribe();

discord-api-docs example (HTTP request):

POST https://discord.com/api/v10/channels/{channel.id}/messages
{
  "content": "Pong!"
}

Note: discord-api-docs provides API documentation rather than implementation, so the comparison is between using a library and direct API calls.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Discord API Documentation

This repo contains the official Discord API documentation, which can be viewed online HERE. Before submitting pull-requests, please remember to fully read the Contributing guidelines.

This repository reflects the Discord API as it is meant to be accessed by third-party applications. It omits features and capabilities that are not generally available, or are not fully supported for third-party usage.

We welcome your contributions!

  • Issue tracker: Discord API bugs
  • Discussions: Discord API feature and improvement requests
  • Pull Requests: See Contributing.md for types of changes accepted and specific markdown syntax used in the documentation.

Need some help?

Here are some Discord servers that can help you out with everything Discord API:

The Official Discord Developers server has plenty of help channels with knowledgeable people and Discord's developers to get you help with something you need, and get updates straight from the developers. However do keep in mind this is a purely on-topic server. If you are looking for a community, join the server below.

The Unofficial Discord API server is a common hangout for library and bot developers alike. It's a great starting point for those looking to dive in and learn bot-creation with the Discord API.

License

Except as otherwise noted, the Discord API Documentation and other content in this repository is licensed under the Creative Commons Attribution-ShareAlike 4.0 License (see LICENSE), and code samples in this repository are licensed under the MIT License (see LICENSE-CODE). These licenses do not grant you rights to use any of Discord’s trademarks or other brand features. Please see the Discord Developer Terms of Service for more information about use of Discord’s brand features and APIs.