revolution / discord-manager
Discord Manager
Installs: 16 813
Dependents: 1
Suggesters: 0
Security: 0
Stars: 3
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: ^8.1
- discord/interactions: ^2.2
- guzzlehttp/guzzle: ^7.5
- illuminate/http: ^10.0||^11.0
- illuminate/support: ^10.0||^11.0
- simplito/elliptic-php: ^1.0
Requires (Dev)
- mockery/mockery: ^1.3
- orchestra/testbench: ^8.0||^9.0
- phpunit/phpunit: ^10.0
- dev-master
- 5.1.1
- 5.1.0
- 5.0.1
- 5.0.0
- 4.x-dev
- 4.3.0
- 4.2.0
- 4.1.4
- 4.1.3
- 4.1.2
- 4.1.1
- 4.1.0
- 4.0.0
- 3.x-dev
- 3.0.0
- 2.x-dev
- 2.2.1
- 2.2.0
- 2.1.0
- 2.0.1
- 2.0.0
- 1.x-dev
- 1.6.0
- 1.5.1
- 1.5.0
- 1.4.2
- 1.4.1
- 1.4.0
- 1.3.1
- 1.3.0
- 1.2.1
- 1.2.0
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
This package is auto-updated.
Last update: 2024-10-29 05:46:42 UTC
README
Note Since v5, only Interactions command is provided. Interactions command is webhook-based, it is easy to use in Laravel. v4 still support Gateway API.
Requirements
- PHP >= 8.1
- Laravel >= 10.0
Installation
composer require revolution/discord-manager
.env
DISCORD_BOT_TOKEN=
# APPLICATION ID
DISCORD_BOT=
# PUBLIC KEY
DISCORD_PUBLIC_KEY=
# GUILD ID
DISCORD_GUILD=
Uninstall
composer remove revolution/discord-manager
- Delete
config/discord_interactions.php
- Delete
app/Discord/
and other files. - Delete
DISCORD_*
in.env
Interactions
Publish config file
php artisan vendor:publish --tag=discord-interactions-config
Edit config/discord_interactions.php
Set INTERACTIONS ENDPOINT URL
in Discord's developer portal.
https://example/discord/webhook
Create a command to respond
php artisan discord:make:interaction HelloCommand
Register commands to Discord server
php artisan discord:interactions:register
Create Event listener
php artisan make:listener InteractionsListener
use Revolution\DiscordManager\Events\InteractionsWebhook; use Revolution\DiscordManager\Facades\DiscordManager; // /** * Handle the event. * * @param InteractionsWebhook $event * @return void */ public function handle(InteractionsWebhook $event) { DiscordManager::interaction($event->request); }
(Only Laravel10) Update EventServiceProvider.php
use App\Listeners\InteractionsListener; use Revolution\DiscordManager\Events\InteractionsWebhook; // protected $listen = [ Registered::class => [ SendEmailVerificationNotification::class, ], InteractionsWebhook::class => [ InteractionsListener::class, ], ];
Workflow
- POST request comes in from Discord to https://example/discord/webhook
- ValidateSignature
- InteractionsWebhookController
- DeferredResponse
- DispatchInteractionsEvent Terminable Middleware
- InteractionsWebhook Event dispatch
- InteractionsListener in your project.
- DiscordManager invokes one of the commands in
app/Discord/
.
LICENSE
MIT