This tab lists everything. How to write a bot with it is in the guide, starting with the quickstart.
The structures
Guild
A server: its members, roles, channels, bans.
GuildMember
A user in one server: nickname, roles, permissions, moderation.
User
A Discord account, the same in every server.
Role
A role of a server: permissions, position, members.
Channels
Text, voice, category, forum, thread and private channels.
Message
A message: reply, edit, react, pin.
Interaction
Someone used a command, a button, a menu or a form, and waits for an answer.
GuildEmoji
A custom emoji of a server.
Invite
An invite to a server.
Webhook
A way to post in a channel under any name.
Three rules
1
A property never costs anything
guild.name, member.roles, guild.channels… read what the bot remembers. They are instant and never send a request to Discord.2
A fetch method asks Discord
Methods that start with
fetch return a promise. When they get one thing by its id, they look at what the bot remembers first and only ask Discord when it is not there. Pass { force: true } to ask Discord anyway.3
Other methods act
member.ban(), channel.send(), message.delete()… do something on Discord and return a promise. Always await them.Names are in camelCase
Discord names its fields likerate_limit_per_user. In ChapterJS you always read and write rateLimitPerUser: the framework translates in both directions, inside embeds and options too.
Lists are Maps
guild.members, guild.roles, guild.channels, channel.messages… are JavaScript Maps that you can only read, with the id as the key:
Map holds is what the bot remembers, which is not always everything: see Memory.
Ids
A Discord id (aSnowflake) is a text made of digits, like '175928847299117063'. Never store one as a number: it is too big and would lose precision.
Everywhere a method takes a user, a role, a channel or a message, you can pass its id or the structure itself.
The reason
Actions that moderators can see in the audit log of the server take areason, shown there:
Limits are checked for you
What you pass is checked before it is sent: a message that is too long, an image size that does not exist or a timeout of more than 28 days throws an error that says what the limit is. The rate limits of Discord are handled by the framework: a request waits for its turn. When Discord refuses an action (a missing permission, something that no longer exists…), the method throws: see Errors.Logging
console.log(guild) shows the name of the class and the data of the structure with camelCase names. toJSON() returns that data as a plain object. Neither shows a secret: a webhook leaves its token out.