Saltearse al contenido
sern

of

of(root): object

Create a Presence body which can be either:

  • once, the presence is activated only once.
  • repeated, per cycle or event, the presence can be changed.

Parameters

root: Omit<Result, "repeat" | "onRepeat">

Returns

object

once()

once: () => Omit<Result, "repeat" | "onRepeat">

Example

1
Presence
2
.of({
3
activities: [
4
{ name: "Chilling out" }
5
]
6
})
7
.once() // Sets the presence once, with what's provided in '.of()'

Returns

Omit<Result, "repeat" | "onRepeat">

repeated()

repeated: (onRepeat, repeat) => object

Example

1
Presence
2
.of({
3
activities: [{ name: "deez nuts" }]
4
}) //starts the presence with "deez nuts".
5
.repeated(prev => {
6
return {
7
afk: true,
8
activities: prev.activities?.map(s => ({ ...s, name: s.name+"s" }))
9
};
10
}, 10000)) //every 10 s, the callback sets the presence to the returned one.

Parameters

onRepeat: PresenceReduce

repeat: number | [Emitter, string]

Returns

object

activities?

optional activities: ActivitiesOptions[]

afk?

optional afk: boolean

onRepeat

onRepeat: PresenceReduce

repeat

repeat: number | [Emitter, string]

shardId?

optional shardId: number[]

status?

optional status: Status

Source

src/core/presences.ts:37