DiscordPHP-MTG Documentation

Stats
in package

Tracks bot runtime metrics — start time, last reconnect, message/event counters — and renders them as an {@see Embed} for a `!stats` style command.

Not tied to any external API.

Tags
see
Discord

The client these metrics describe

since
0.1.0

Table of Contents

Properties

$discord  : Discord
$lastReconnect  : Carbon
Last reconnect time of bot.
$startTime  : Carbon
Start time of bot.

Methods

getHelp()  : string
One-line description of this command for a help listing.
handle()  : Embed
Renders the current metrics (versions, uptime, guild/channel/user counts, memory usage) as an {@see Embed} ready to send.
init()  : void
Records the start time and subscribes to the client's `reconnect` event so the last-reconnect timestamp stays current.
new()  : static
Creates a tracker bound to the given client and starts recording metrics.
getBotVersion()  : string
Returns the current commit of Civilizationbot.
getChannelCount()  : int
Returns the number of channels visible to the bot.
getDiscordPHPVersion()  : string
Returns the current commit of DiscordPHP.
getMemoryUsageFriendly()  : string
Returns the memory usage of the PHP process in a user-friendly format.

Properties

$discord

protected Discord $discord

$lastReconnect

Last reconnect time of bot.

protected Carbon $lastReconnect

$startTime

Start time of bot.

protected Carbon $startTime

Methods

getHelp()

One-line description of this command for a help listing.

public getHelp() : string
Return values
string

handle()

Renders the current metrics (versions, uptime, guild/channel/user counts, memory usage) as an {@see Embed} ready to send.

public handle() : Embed
Return values
Embed

init()

Records the start time and subscribes to the client's `reconnect` event so the last-reconnect timestamp stays current.

public init(Discord &$discord) : void
Parameters
$discord : Discord

The client to observe.

new()

Creates a tracker bound to the given client and starts recording metrics.

public static new(Discord &$discord) : static
Parameters
$discord : Discord

The client to observe.

Return values
static

getBotVersion()

Returns the current commit of Civilizationbot.

protected getBotVersion() : string
Return values
string

getChannelCount()

Returns the number of channels visible to the bot.

protected getChannelCount() : int
Return values
int

getDiscordPHPVersion()

Returns the current commit of DiscordPHP.

protected getDiscordPHPVersion() : string
Return values
string

getMemoryUsageFriendly()

Returns the memory usage of the PHP process in a user-friendly format.

protected getMemoryUsageFriendly() : string
Return values
string
On this page

Search results