ikarusbot/bot.php

61 lines
1.7 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' => false
],
[
'name' => 'numarparc',
'description' => 'Numarul de parc al vehicului',
'type' => 4,
'required' => false
]
]
]);
$discord->application->commands->save($infoVehiculCommand);
$discord->application->commands->save($pozitieCommand);
});
require("./commands/infovehicul.php");
require("./commands/pozitie.php");
$discord->run();