How can I create a slash command? #1130
Replies: 3 comments 1 reply
-
After created how to remove it? |
Beta Was this translation helpful? Give feedback.
1 reply
-
Read Discord API Docs and figured it out?
…On Sun, 10 Sept 2023, 03:55 Bruno Funnie, ***@***.***> wrote:
After created how to remove it?
—
Reply to this email directly, view it on GitHub
<#1130 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAE7SALRZ6HA5GLOAD2FNI3XZUMYTANCNFSM6AAAAAAZB47UB4>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
0 replies
-
$discord->application->commands->freshen()->then(function (GlobalCommandRepository $commands): void
{
// if ($command = $commands->get('name', 'ping')) $commands->delete($command);
if (! $commands->get('name', 'ping')) $commands->save(new Command($discord, [
'name' => 'ping',
'description' => 'Replies with Pong!',
]));
$discord->listenCommand('ping', fn (Interaction $interaction): PromiseInterface =>
$interaction->respondWithMessage('Pong!', true)
);
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
valzargaming
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
How can I create a / command? Does DiscordPHP support this? I want to create a command like the one in the attachment, but I couldn't find a solution in the documentation. Can you provide an example command that outputs '/ping pong'?
Beta Was this translation helpful? Give feedback.
All reactions