55 lines
1.5 KiB
PHP
55 lines
1.5 KiB
PHP
<?php
|
|
include __DIR__.'/vendor/autoload.php';
|
|
|
|
use Discord\Discord;
|
|
use Discord\Parts\Channel\Message;
|
|
use Discord\WebSockets\Intents;
|
|
use Discord\WebSockets\Event;
|
|
use Discord\Parts\Interactions\Command\Command;
|
|
use Discord\Parts\Interactions\Interaction;
|
|
use Discord\Builders\MessageBuilder;
|
|
|
|
$tokenf = fopen("./token.txt", "r") or die("PULAAAAAAAAAAAAA");
|
|
$token = trim(stream_get_contents($tokenf));
|
|
fclose($tokenf);
|
|
|
|
$discord = new Discord([
|
|
'token' => $token,
|
|
'intents' => Intents::getDefaultIntents()
|
|
]);
|
|
|
|
$discord->on('init', function (Discord $discord) {
|
|
$infoVehiculCommand = new Command($discord, [
|
|
'name' => 'infovehicul',
|
|
'description' => 'Informatii despre vehicule cu sistem APC',
|
|
'options' => [
|
|
[
|
|
'name' => 'numarparc',
|
|
'description' => 'Numarul de parc al vehicului',
|
|
'type' => 4,
|
|
'required' => true
|
|
]
|
|
]
|
|
]);
|
|
$pozitieCommand = new Command($discord, [
|
|
'name' => 'pozitie',
|
|
'description' => 'Pozitia unui vehicul.',
|
|
'options' => [
|
|
[
|
|
'name' => 'inmatriculare',
|
|
'description' => 'Numarul de inmatriculare',
|
|
'type' => 3,
|
|
'required' => true
|
|
]
|
|
]
|
|
]);
|
|
$discord->application->commands->save($infoVehiculCommand);
|
|
$discord->application->commands->save($pozitieCommand);
|
|
|
|
});
|
|
|
|
require("./commands/infovehicul.php");
|
|
require("./commands/pozitie.php");
|
|
|
|
$discord->run();
|