Skip to content

Instantly share code, notes, and snippets.

@tigrang
Created March 3, 2022 04:41
Show Gist options
  • Save tigrang/87246784b8f1c6f084a65a1bc3d55ba4 to your computer and use it in GitHub Desktop.
Save tigrang/87246784b8f1c6f084a65a1bc3d55ba4 to your computer and use it in GitHub Desktop.
Discord\Repository\Interaction\OptionRepository Object
(
[give] => Discord\Parts\Interactions\Request\Option Object
(
[name] => give
[type] => 1
[value] =>
[focused] =>
[options] => Discord\Repository\Interaction\OptionRepository Object
(
)
)
)
<?php
include __DIR__ . '/../src/bootstrap.php';
use Discord\Discord;
use Discord\Parts\Interactions\Interaction;
$discord = new Discord([
'token' => $_ENV['BOT_TOKEN'],
// 'logger' => new \Psr\Log\NullLogger(),
]);
$discord->on('ready', function (Discord $discord) use ($db) {
echo "Bot is ready!", PHP_EOL;
$discord->listenCommand('karma', function(Interaction $interaction) {
print_r($interaction->data->options);
});
});
$discord->run();
{
"name": "karma",
"description": "desc",
"options": [
{
"name": "give",
"description": "Give karma to a user",
"type": 1,
"options": [
{
"name": "user",
"description": "The user to give karma to",
"type": 6,
"required": true
}
]
}
]
}
{
"application_id": "#################",
"channel_id": "#################",
"data": {
"id": "#################",
"name": "karma",
"options": [
{
"name": "give",
"options": [
{
"name": "user",
"type": 6,
"value": "#################"
}
],
"type": 1
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment