20241018
20241018
/slash コマンドを作る
code:php
$discord->application->commands->freshen()->done(function (\Discord\Repository\Interaction\GlobalCommandRepository $commands): void
{
updateCommands($commands);
});
code:php
/**
* 実装予定
* "/forecast_add"
* "/forecast_remove"
* "/ddg" - !ddg QUERY - URL を返す */
['name' => "forecast_add", 'description' => '天気予報を受け取りたい地域を追加します。', 'options' => (function () use ($discord) {
$opt = new \Discord\Parts\Interactions\Command\Option($discord);
$opt
->setName('location_id')
->setDescription('地域IDをそのまま設定します。該当しない場合はエラーを返します。')
->addChoice(
\Discord\Parts\Interactions\Command\Choice::new($discord, 'type', '設定方法')
->
)
;
return $opt;
})()],