|
15 | 15 | * Represents a command registered on the Discord servers. |
16 | 16 | * |
17 | 17 | * @author David Cole <[email protected]> |
| 18 | + * |
| 19 | + * @see https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-structure |
| 20 | + * |
| 21 | + * @property string $id The unique identifier of the command. |
| 22 | + * @property int $type The type of the command, defaults 1 if not set. |
| 23 | + * @property string $application_id The unique identifier of the parent Application that made the command, if made by one. |
| 24 | + * @property string|null $guild_id The unique identifier of the guild that the command belongs to. Null if global. |
| 25 | + * @property string $name 1-32 character name of the command. |
| 26 | + * @property ?string[]|null $name_localizations Localization dictionary for the name field. Values follow the same restrictions as name. |
| 27 | + * @property string $description 1-100 character description for CHAT_INPUT commands, empty string for USER and MESSAGE commands. |
| 28 | + * @property ?string[]|null $description_localizations Localization dictionary for the description field. Values follow the same restrictions as description. |
| 29 | + * @property array|null $options The parameters for the command, max 25. Only for Slash command (CHAT_INPUT). |
| 30 | + * @property ?string $default_member_permissions Set of permissions represented as a bit set. |
| 31 | + * @property bool|null $dm_permission Indicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible. |
| 32 | + * @property string $version Autoincrementing version identifier updated during substantial record changes. |
18 | 33 | */ |
19 | 34 | class Command extends Part |
20 | 35 | { |
| 36 | + /** Slash commands; a text-based command that shows up when a user types / */ |
| 37 | + public const CHAT_INPUT = 1; |
| 38 | + |
| 39 | + /** |
| 40 | + * @inheritdoc |
| 41 | + */ |
| 42 | + protected $fillable = [ |
| 43 | + 'id', |
| 44 | + 'type', |
| 45 | + 'application_id', |
| 46 | + 'guild_id', |
| 47 | + 'name', |
| 48 | + 'name_localizations', |
| 49 | + 'description', |
| 50 | + 'description_localizations', |
| 51 | + 'options', |
| 52 | + 'default_member_permissions', |
| 53 | + 'dm_permission', |
| 54 | + 'default_permission', |
| 55 | + 'version', |
| 56 | + ]; |
| 57 | + |
| 58 | + /** |
| 59 | + * Returns a formatted mention of the command. |
| 60 | + * |
| 61 | + * @return string A formatted mention of the command. |
| 62 | + */ |
| 63 | + public function __toString() |
| 64 | + { |
| 65 | + return "</{$this->name}:{$this->id}>"; |
| 66 | + } |
21 | 67 | } |
0 commit comments