# ChapterJS > The Discord framework: a folder of files becomes a fast, type-safe Discord bot. ## Home - [ChapterJS](https://www.chapterjs.org/index.md): The Discord framework. A folder of files becomes a fast, type-safe Discord bot. ## Guide ### Get started - [Quickstart](https://www.chapterjs.org/quickstart.md): Create a bot, run it on your test server and change its first command, in a few minutes - [Your Discord application](https://www.chapterjs.org/setup/discord-application.md): Create the application of your bot, get its token and the ID of your test server, and enable what your files need - [Project structure](https://www.chapterjs.org/setup/project-structure.md): What each folder and file of your project is for, and how the framework finds what your files declare ### Commands - [Commands](https://www.chapterjs.org/commands/index.md): Write a slash command as one file, choose where it works and who can use it, and see it appear in your test server - [Options](https://www.chapterjs.org/commands/options.md): Declare what people fill in after the name of a command, and receive it typed in your function - [Answering](https://www.chapterjs.org/commands/answering.md): Answer a command, keep the answer private, take your time, change it, and know what the person sees when your function fails - [Menu commands](https://www.chapterjs.org/commands/menus.md): Commands people use with a right click on a message or on a person - [Translations](https://www.chapterjs.org/commands/translations.md): Show the name, the description, the options and the choices of a command in the language of each person ### Messages - [Sending messages](https://www.chapterjs.org/messages.md): Send text, embeds, files and polls, reply, edit, delete, react, pin and read the history of a channel - [Waiting for an answer](https://www.chapterjs.org/waiting.md): Ask something, then wait for the next message, click or reaction, with a time limit ### Events - [Events](https://www.chapterjs.org/events/index.md): React to what happens on Discord: a new member, a deleted channel, a message - [Messages](https://www.chapterjs.org/events/messages.md): React to messages sent, edited or deleted, in servers or in private, from people or from bots - [Reactions, polls and typing](https://www.chapterjs.org/events/reactions.md): React to reactions added and removed, to votes in polls, and to people typing - [Voice](https://www.chapterjs.org/events/voice.md): React to people joining, leaving and moving between voice channels, muting or starting a stream - [Moderation and the server](https://www.chapterjs.org/events/server.md): React to bans, entries of the audit log, invites, emojis, scheduled events, threads, presences and changes of the server ### Voice - [Playing in voice](https://www.chapterjs.org/voice.md): Join a voice channel, play a sound or a song there, pause, stop and leave ### Components - [Buttons](https://www.chapterjs.org/components/index.md): Add buttons to your messages, run code when they are clicked, and change the message they are on - [Select menus](https://www.chapterjs.org/components/selects.md): Add menus to your messages: options you declare, or the users, roles and channels of the server - [Forms](https://www.chapterjs.org/components/modals.md): Open a form in Discord from a command or a button, and receive what was filled in, typed field by field - [Embeds and layout](https://www.chapterjs.org/components/embeds.md): Write an embed once and use it everywhere, and build messages out of texts, sections, galleries and containers ### Tasks - [Tasks](https://www.chapterjs.org/tasks/index.md): Make your bot do something by itself, every so often or at given times, with a task() declaration ### Presence - [Presence](https://www.chapterjs.org/presence.md): Show what your bot is doing under its name, with one file ### Storage - [Storage](https://www.chapterjs.org/storage.md): Keep what your bot learns from one restart to the next, per server, with a store() declaration - [Rankings](https://www.chapterjs.org/rankings.md): Keep a score per member, in order, and show who is first, with a ranking() declaration ### Translations - [Translated messages](https://www.chapterjs.org/translated-messages.md): Answer each person in their language, with one language() declaration per language ### Memory - [What your bot remembers](https://www.chapterjs.org/memory.md): Why reading a server, a member or a channel costs nothing, and how your bot keeps its memory under control by itself ### Testing - [Testing](https://www.chapterjs.org/testing.md): Check your bot without Discord: every file used once by itself, then the scenarios you write ### Run your bot - [chapterjs dev](https://www.chapterjs.org/run/dev.md): Run your bot on your test server while you write it, with every file reloaded when you save - [chapterjs build](https://www.chapterjs.org/run/build.md): Check every file of your bot and compile it into one file for production - [chapterjs start](https://www.chapterjs.org/run/start.md): Run for everyone the bot you built, on one process or several - [Deploy](https://www.chapterjs.org/run/deploy.md): Put your bot on a machine that stays on, and keep it running - [Troubleshooting](https://www.chapterjs.org/run/troubleshooting.md): Every message your bot can show you, and what to do about it ### Roadmap - [Roadmap](https://www.chapterjs.org/roadmap.md): The roadmap of ChapterJS: what it does not do yet, so that you do not look for it, and what to do meanwhile ## Tutorial ### Start here - [Welcome](https://www.chapterjs.org/tutorial/index.md): What this tutorial teaches, who it is for, and how to read it - [How a bot works](https://www.chapterjs.org/tutorial/how-a-bot-works.md): What a Discord bot is, how it talks to Discord, and what ChapterJS does for you - [The tools](https://www.chapterjs.org/tutorial/tools.md): Install Node.js, pick a package manager and an editor, and check that everything answers in a terminal ### Your first bot - [Your Discord application](https://www.chapterjs.org/tutorial/discord-application.md): Create the application of your bot in the Developer Portal, copy its token and the ID of your test server, and understand why you want two applications - [Creating the project](https://www.chapterjs.org/tutorial/create-project.md): Create a project with one command, give it your token, run it, and read what the terminal says line by line - [A tour of the project](https://www.chapterjs.org/tutorial/tour.md): What each file of your project is for, the one rule that organises them, and how the editor and the hot reload help you ### Commands - [Your first command](https://www.chapterjs.org/tutorial/first-command.md): Write /dice from scratch, understand each line, and see what the framework and the editor check for you - [Options](https://www.chapterjs.org/tutorial/options.md): Let people fill in values after a command, receive them typed, and let the editor tell you what may be missing - [Answering](https://www.chapterjs.org/tutorial/answering.md): Answer a command once, keep the answer private, take your time, change it afterwards, and know what the person sees when your code fails - [What you receive](https://www.chapterjs.org/tutorial/what-you-receive.md): The objects your functions receive: users, members, servers, channels and messages, what they tell you without a request, and what they can do - [Sending messages](https://www.chapterjs.org/tutorial/sending-messages.md): Send a text, an embed, a file or a poll where you want, mention people without pinging everyone, and edit, delete or react to a message ### Events - [Events](https://www.chapterjs.org/tutorial/events.md): React to what happens on Discord with an event() per reaction: welcome new members, log changes, run code when the bot connects, and see how intents follow your files - [Messages as events](https://www.chapterjs.org/tutorial/message-events.md): React to the messages people write, choose where your file listens and whether bots count, and read the Message Content Intent - [Reactions and voice](https://www.chapterjs.org/tutorial/reactions-and-voice.md): React to the reactions people add and to who joins a voice channel, and see why some events only give an id ### Voice - [Playing in voice](https://www.chapterjs.org/tutorial/voice.md): Make your bot join a voice channel and play a sound there, and understand what Opus and end-to-end encryption change ### Components - [Buttons](https://www.chapterjs.org/tutorial/buttons.md): Put a button under a message, carry data in it, run code when it is clicked, and decide who may click - [Select menus](https://www.chapterjs.org/tutorial/selects.md): Add a menu to a message with options you declare, or filled with the users, roles and channels of the server, and receive what was picked typed - [Forms](https://www.chapterjs.org/tutorial/forms.md): Open a form in Discord from a command or a button, and receive what was filled in, typed field by field - [Embeds and layout](https://www.chapterjs.org/tutorial/embeds-and-layout.md): Write an embed once and reuse it everywhere, and build messages out of texts, sections, galleries and containers - [Menus and conversations](https://www.chapterjs.org/tutorial/conversations.md): Add a command to the right click menu, then make your bot ask a question and wait for the answer ### By itself - [Tasks](https://www.chapterjs.org/tutorial/tasks.md): Make your bot do something by itself, every so often or at given times, with a task() per thing to do - [Presence](https://www.chapterjs.org/tutorial/presence.md): Choose the status of your bot and what it shows under its name, with one file ### Languages - [Translated messages](https://www.chapterjs.org/tutorial/translations.md): Answer each person in their language with one declaration per language, understand which language a message speaks, and translate what the bot says by itself ### Growing - [Storage](https://www.chapterjs.org/tutorial/storage.md): Give your bot a memory that survives a restart: a store per server, with an expiration when you want one - [Organising a growing project](https://www.chapterjs.org/tutorial/organising.md): Share code between files, keep what the bot learns, set a cooldown, keep files short, and know what the framework does not do yet - [Memory and limits](https://www.chapterjs.org/tutorial/memory-and-limits.md): What your bot remembers so that reading costs nothing, how it keeps its memory under control, and the limits of Discord it handles without you ### Testing - [Testing](https://www.chapterjs.org/tutorial/testing.md): Check your bot without Discord, every time you change something, with one command and a few scenarios ### Going online - [Building](https://www.chapterjs.org/tutorial/build.md): Check every file and the types of your bot, and compile it into one file that production runs - [Going online](https://www.chapterjs.org/tutorial/deploy.md): Run your bot for everyone with the production application, on a machine that stays on, and keep it running - [What's next](https://www.chapterjs.org/tutorial/next-steps.md): A checklist of what you can do now, the habits that keep a bot healthy, and where to look when you need something ## Reference ### Reference - [Overview](https://www.chapterjs.org/reference/index.md): Find every property and method of what your functions receive: servers, members, channels, messages ### Your files - [command()](https://www.chapterjs.org/reference/command.md): Everything a command file declares, every kind of option, menu commands, and what the run function receives - [event()](https://www.chapterjs.org/reference/event.md): The function that declares a reaction to an event, its options and the types behind what your function receives - [Events](https://www.chapterjs.org/reference/events.md): Every event your bot can react to: when it happens, what it needs, and what your function receives - [button()](https://www.chapterjs.org/reference/button.md): Everything a button file declares, what its run function receives, and the types shared by every interactive component - [select()](https://www.chapterjs.org/reference/select.md): Everything a select menu file declares, the three ways to write options, and what the run function receives - [modal()](https://www.chapterjs.org/reference/modal.md): Everything a form file declares, every kind of field, and what the run function receives for each - [embed()](https://www.chapterjs.org/reference/embed.md): The function that declares an embed used in several messages, and what it returns - [Layout](https://www.chapterjs.org/reference/layout.md): The pieces of a message written where the message is: rows, link buttons, texts, sections, galleries, files, separators and containers - [task()](https://www.chapterjs.org/reference/task.md): Everything a task file declares: its schedule, its timezone, and what the run function receives - [store()](https://www.chapterjs.org/reference/store.md): Everything store() declares and does: the scope, the expiration, the keys, and each call - [ranking()](https://www.chapterjs.org/reference/ranking.md): Everything ranking() declares and does: the scope, the storage, the order, and each call - [presence()](https://www.chapterjs.org/reference/presence.md): Everything presence() declares: the status of the bot and what it is doing - [language()](https://www.chapterjs.org/reference/messages.md): Everything language() declares, and t, which every function receives - [Testing](https://www.chapterjs.org/reference/testing.md): Everything a scenario can do: the bot under test, the people and channels of its server, and what an answer can be checked for ### Structures - [Guild](https://www.chapterjs.org/reference/guild.md): Read everything about a server and manage its members, roles, channels and bans - [GuildMember](https://www.chapterjs.org/reference/member.md): Read the nickname, roles and permissions of a member and moderate them: timeout, kick, ban - [User](https://www.chapterjs.org/reference/user.md): Read a Discord account, get its avatar and send it a private message - [Role](https://www.chapterjs.org/reference/role.md): Read the permissions, position and members of a role, and change or delete it - [Message](https://www.chapterjs.org/reference/message.md): A message sent in a channel: what it contains, and how to reply, edit, react, pin and start a thread from it - [Interaction](https://www.chapterjs.org/reference/interaction.md): Someone used something of the bot and waits for an answer: reply, defer, edit, follow up - [GuildEmoji](https://www.chapterjs.org/reference/emoji.md): Read, show, rename and delete the custom emojis of a server - [Invite](https://www.chapterjs.org/reference/invite.md): Read the link, the uses and the expiry of an invite, and delete it - [Webhook](https://www.chapterjs.org/reference/webhook.md): Post messages in a channel under any name and avatar, and manage the webhooks of a server - [VoiceConnection](https://www.chapterjs.org/reference/voice-connection.md): The bot in a voice channel: what it plays there, pausing, stopping and leaving #### Channels - [Channels](https://www.chapterjs.org/reference/channels/index.md): Tell the kinds of channels apart, and use what every channel, every channel of a server and every channel with messages has - [TextChannel](https://www.chapterjs.org/reference/channels/text.md): A text or announcement channel of a server: topic, slowmode, threads and following - [VoiceChannel](https://www.chapterjs.org/reference/channels/voice.md): A voice or stage channel: bitrate, user limit, region and status - [CategoryChannel](https://www.chapterjs.org/reference/channels/category.md): A category: the channels it groups - [ForumChannel](https://www.chapterjs.org/reference/channels/forum.md): A forum or media channel: its tags, and how to create a post - [ThreadChannel](https://www.chapterjs.org/reference/channels/thread.md): A thread or a forum post: archive, lock, members and tags - [DMChannel](https://www.chapterjs.org/reference/channels/dm.md): A private conversation between the bot and a user ### Types - [Message options](https://www.chapterjs.org/reference/message-options.md): Everything a message can contain when you send, reply, edit, answer a command or post with a webhook - [Options](https://www.chapterjs.org/reference/options.md): Find every field you can pass to edit() and to the methods that create channels, threads, posts, roles and invites - [Data](https://www.chapterjs.org/reference/data.md): Read the plain objects you get for attachments, reactions, tags, overwrites, bans, audit logs, events, rules, stickers, voice states and presences - [Permissions](https://www.chapterjs.org/reference/permissions.md): Check what a member can do, read what a role allows, and write permissions by name - [Enums](https://www.chapterjs.org/reference/enums.md): Write the values Discord uses by name: channel types, message types, levels, styles, languages - [Helpers](https://www.chapterjs.org/reference/helpers.md): Mention users, channels, roles and commands, write dates everyone reads in their timezone, work with ids and image URLs - [Errors](https://www.chapterjs.org/reference/errors.md): Catch what is thrown when Discord refuses an action, cannot be reached, or rejects the token, and know what the person sees ### CLI - [CLI](https://www.chapterjs.org/reference/cli.md): Every command of chapterjs, what it reads from the environment, its exit codes and the symbols of its messages ## Changelog ### Changelog - [Changelog](https://www.chapterjs.org/changelog.md): What changed in each version of ChapterJS > The links below point to documentation indexes. Follow each `/_llms/` index recursively until you reach documentation pages. ## Indexes - [French (105 pages)](https://www.chapterjs.org/_llms/fr.txt): Accueil, Guide, Tutoriel, Référence, Changelog. This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.