Skip to main content
presence() declares the presence of the bot, once, from any file of src/. It takes one object, PresenceConfig.
src/presence.ts
How to write the file, and what Discord shows for each type, is in the guide. This page lists what exists.

presence()

Declares the presence of the bot: its status and what it is doing, shown under its name. Export the result from any file of src/, once; the bot has it as soon as it is connected.

PresenceDeclaration

What presence() returns: a declaration the framework finds in the exports of a file.
unknown
What the file gave to presence(), not checked yet.

PresenceConfig

What a file gives to presence(): activity for one, or activities for several shown in turn.

SinglePresenceConfig

A presence with one activity, or none.
PresenceStatusName
The status of the bot. 'online' by default.
Activity
What the bot is doing. Nothing by default.

RotatingPresenceConfig

A presence whose activities are shown in turn.
PresenceStatusName
The status of the bot. 'online' by default.
Activities
required
Several activities, shown one after the other, each for its for: a list, or a function that gives it.

PresenceStatusName

The status of the bot: 'online' (green), 'idle' (orange), 'dnd' (red, “do not disturb”) or 'invisible' (shown as offline).

Activities

The activities shown in turn: a list, or a function that gives it (maybe after a promise, from a store for example), run again each time the list has been shown in full.

Activity

What the bot is doing: a PlainActivity or a StreamingActivity.

PlainActivity

An activity that is not a stream.
ActivityKind
required
What the bot is doing, as Discord shows it: “Playing name”, “Listening to name”, “Watching name”, “Competing in name”, or the text itself with 'custom'.
ActivityText
required
What is shown after the type (or alone with 'custom').
Duration
How long the activity is shown before the next one, at least 5 seconds: '30s', '2m'. 30 seconds by default. Alone, it is how often a name that is a function runs again.

ActivityKind

StreamingActivity

A stream: “Streaming name”, with a link to it.
'streaming'
required
ActivityText
required
What is shown after “Streaming”.
string
required
The stream: Discord only accepts a https://twitch.tv/ or a https://youtube.com/ link.
Duration
How long the activity is shown before the next one, at least 5 seconds: '30s', '2m'. 30 seconds by default. Alone, it is how often a name that is a function runs again.

ActivityText

The text of an activity: a text, or a function that gives it (maybe after a promise), run each time the activity is shown.

PresenceContext

What a presence function receives, each time it runs: how many servers the bot is in, and the texts of the language files in the default language.
number
required
How many servers the bot is in, all processes together.
Translator
The texts of the language files, in the default language. Only when the project has language files.
Discord documentation