+<?php
+
+namespace App\Console\Commands;
+
+use Discord\Discord;
+use Illuminate\Console\Command;
+use Monolog\Handler\StreamHandler;
+use Monolog\Logger;
+use React\EventLoop\Loop;
+
+class DiscordBotCommand extends Command
+{
+ /**
+ * The name and signature of the console command.
+ *
+ * @var string
+ */
+ protected $signature = 'discord:bot';
+
+ /**
+ * The console command description.
+ *
+ * @var string
+ */
+ protected $description = 'Runs the discord bot';
+
+ /**
+ * Execute the console command.
+ *
+ * @return int
+ */
+ public function handle()
+ {
+ $logger = new Logger('DiscordBot');
+ $logger->pushHandler(new StreamHandler('php://stdout', Logger::INFO));
+ $discord = new Discord([
+ 'logger' => $logger,
+ 'token' => config('discord.token'),
+ ]);
+ $discord->on('ready', function (Discord $discord) {
+ });
+ $discord->getLoop()->addSignal(SIGINT, function() use ($discord) {
+ $discord->close();
+ });
+ $discord->run();
+ return 0;
+ }
+}