PHP code example of eurobertics / nebucord

1. Go to this page and download the library: Download eurobertics/nebucord 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/ */

    

eurobertics / nebucord example snippets





Nebucord\Nebucord;

$nebucord = new Nebucord(['token' => 'your_bot_token', 'ctrlusr' => ['controluser-snowflake1', 'controluser-snowflake2']]);
$nebucord->bootstrap()->run();



Nebucord\Nebucord;

class MessageInterceptorClass {
    public function onMessageReceive($evt) {
        // $evt is a model with all data from the gateway if a message create
        // event is received
        
        echo $evt->content; // returns the message
    }
}

$nebucordEventTable = \Nebucord\Events\EventTable::create();
$nebucordEventTable->addEvent(new MessageInterceptorClass, "onMessageReceive", \Nebucord\Base\StatusList::GWEVT_MESSAGE_CREATE);

$nebucord = new Nebucord(['token' => 'your_bot_token', 'ctrlusr' => ['controluser-snowflake1', 'controluser-snowflake2']]);
$nebucord->bootstrap()
    ->setEventTable($nebucordEventTable)
    ->run();


Nebucord\NebucordREST;

$nebucordREST = new NebucordREST(['token' => 'your_bot_token']);
$message_model = $nebucordREST->createRESTExecutor()->createRESTActionFromArray(
    \Nebucord\REST\Base\RestStatusList::REST_CREATE_MESSAGE,
    [
        'channel_id' => 123123123123,
        'content' => "message"
    ]
);


Nebucord\NebucordREST;

$nebucordREST = new NebucordREST(['token' => 'your_bot_token']);
$channels = $nebucordREST->createRESTExecutor()->createRESTActionFromArray(
    \Nebucord\REST\Base\RestStatusList::REST_GET_GUILD_CHANNELS,
    [
        'guild_id' => 123123123123123,
    ]
);

user@linux:~# php -f <your_php_file>.php