PHP code example of bootdesk / chat-sdk-adapter-discord

1. Go to this page and download the library: Download bootdesk/chat-sdk-adapter-discord library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bootdesk / chat-sdk-adapter-discord example snippets


use BootDesk\ChatSDK\Discord\DiscordAdapter;

$adapter = new DiscordAdapter(
    botToken: env('DISCORD_BOT_TOKEN'),
    httpClient: new \GuzzleHttp\Client,
    publicKey: env('DISCORD_PUBLIC_KEY'),
    applicationId: env('DISCORD_APPLICATION_ID'),
);

'discord' => [
    'bot_token'      => env('DISCORD_BOT_TOKEN'),
    'public_key'     => env('DISCORD_PUBLIC_KEY'),
    'application_id' => env('DISCORD_APPLICATION_ID'),
],

// Post a message to a Discord channel
$adapter->postMessage('discord:1234567890', 'Hello from laravel-bootdesk!');

// Reply to a specific message
$adapter->postMessage('discord:1234567890:9876543210', 'Thread reply');