DiscordPHP-MTG Documentation

Module

A self-contained bot feature, as in Tutelar: it declares its own application commands ({@see commands()}, which the client registers or updates), listens for them, and routes clicks on the components of the messages it sends, from {@see boot()}.

Component custom ids are stable prefix:action:args strings handled by one INTERACTION_CREATE listener per module, so the buttons on a message keep working after a restart and never stack listeners.

Tags
since
1.1.0

Table of Contents

Methods

boot()  : void
Registers commands and listeners. Called once, after the gateway and the application are ready.
commands()  : array<string|int, CommandBuilder>
The application commands the module answers, as they should be registered. The client creates missing ones and updates changed ones.
name()  : string
Stable short name, for logs.

Methods

boot()

Registers commands and listeners. Called once, after the gateway and the application are ready.

public boot(MTG $mtg) : void
Parameters
$mtg : MTG

commands()

The application commands the module answers, as they should be registered. The client creates missing ones and updates changed ones.

public commands(MTG $mtg) : array<string|int, CommandBuilder>
Parameters
$mtg : MTG
Return values
array<string|int, CommandBuilder>

name()

Stable short name, for logs.

public name() : string
Return values
string
On this page

Search results