An async templater class to help with the application of templates for presence statuses.

Supported templates:

Template Replaced by
{num_guild} Get the number of guilds the client is connected to.
{prefix} Get the prefix used by the client.
{cur_time} Get the current time in the client's locale.
{owner_name} Get the owner's name. If no owner is specified then it returns undefined.
{client_name} Get the client's name. If the client's user is not ready yet, then it returns undefined.
{uptime} Get the client's uptime since last ready event emitted in a human-readable shape. Returns null if no uptime is available.
{ready_time} Get the client's time at which the last ready event was emitted. Returns null if no readyAt timestamp is available.
{num_members} Get the total number of members across all the guilds that the client is connected to.
{num_commands} Get the number of commands registered to this client.

Hierarchy

Constructors

Properties

The client that this presence async templater will use as a data source.

Memberof

PresenceTemplater

An object to map a templater key to a custom getter. The getter function should return a Promise that resolves to the correct string that the templater should replace the key with.

Memberof

PresenceTemplater

keys: string[]

The keys handled by this async templater. They don't include the curly braces.

Memberof

AsyncTemplater

Methods

  • Get the actual value that will replace the key inside the template.

    Parameters

    • key: string

      The key to replace.

    Returns Promise<string>

    A promise that resolves to the corresponding string for the given key.

    Throws

    Rejects if given key does not correspond to this async templater.

  • Get the client's name. If the client's user is not ready yet, then it returns undefined.

    Returns Promise<string>

    A promise that resolves to the client's name.

  • Get the owner's name. If no owner is specified then it returns undefined.

    Returns Promise<string>

    A promise that resolves to the owner's name.

  • Get the client's time at which the last ready event was emitted. Returns null if no readyAt timestamp is available.

    Returns Promise<string>

    A promise that resolves to the time the client has gone ready.

  • Get the client's uptime since last ready event emitted in a human-readable shape. Returns null if no uptime is available.

    Returns Promise<string>

    A promise that resolves to the client's uptime.

Generated using TypeDoc