presence(); the templates keep it in src/presence.ts.
src/presence.ts
status alone, or an activity alone, works. Several activities shown in turn, and texts that change, are below.
Everything the file declares is in the reference.
Status
Activity
type says how Discord words it, name is the text after it.
A
'streaming' activity needs the url of the stream, and Discord only accepts a Twitch or a YouTube link:
src/presence.ts
name, or a url on another type, is an error when the file loads, with what to write.
Several activities
activities shows several activities one after the other, each for its for: a duration like '30s' or '2m', 30 seconds when left out, 5 seconds at least. After the last one, the first one comes back.
src/presence.ts
activity or activities, never both. Which activity is shown is read from the clock: a large bot running on several processes shows the same one everywhere, at the same time.
Texts that change
Aname can be a function. It runs each time its activity is shown, and receives guilds, the number of servers the bot is in (all processes together), and t, the texts of your language files in the default language.
src/status.ts
name is a function runs it again every for.
Activities from your data
activities can be a function too, async if it needs to: it gives the list, and runs again each time the list has been shown in full. The activities can then come from a store, kept in a file or in Redis, that a command fills:
src/rotation.ts
chapterjs test runs each function of the presence once, and reports the one that throws with its line.
In development
Inchapterjs dev, saving src/presence.ts changes the presence at once, without reconnecting:
presence() reference
Every field of the presence file.
Tasks
What your bot does by itself, every so often.