From f3f47c5a59f946de57c4e60aeb7acc161ae6ef5a Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Wed, 13 Apr 2022 14:48:18 +0200 Subject: [PATCH] empty discord bot --- .env.example | 8 + app/Console/Commands/DiscortBotCommand.php | 43 ++ composer.json | 3 +- composer.lock | 649 ++++++++++++++++++++- config/discord.php | 5 + 5 files changed, 705 insertions(+), 3 deletions(-) create mode 100644 app/Console/Commands/DiscortBotCommand.php create mode 100644 config/discord.php diff --git a/.env.example b/.env.example index 9bb1bd7..ac57b8a 100644 --- a/.env.example +++ b/.env.example @@ -50,3 +50,11 @@ PUSHER_APP_CLUSTER=mt1 MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" + +LARASCORD_CLIENT_ID= +LARASCORD_CLIENT_SECRET= +LARASCORD_GRANT_TYPE=authorization_code +LARASCORD_PREFIX=larascord +LARASCORD_SCOPE=identify + +DISCORD_BOT_TOKEN= diff --git a/app/Console/Commands/DiscortBotCommand.php b/app/Console/Commands/DiscortBotCommand.php new file mode 100644 index 0000000..f400baa --- /dev/null +++ b/app/Console/Commands/DiscortBotCommand.php @@ -0,0 +1,43 @@ + config('discord.token'), + ]); + $discord->on('ready', function (Discord $discord) { + }); + $discord->getLoop()->addSignal(SIGINT, function() use ($discord) { + $discord->close(); + }); + $discord->run(); + return 0; + } +} diff --git a/composer.json b/composer.json index ea2935f..490fb47 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,8 @@ "laravel/framework": "^9.2", "laravel/sanctum": "^2.14.1", "laravel/tinker": "^2.7", - "laravel/ui": "^3.4" + "laravel/ui": "^3.4", + "team-reflex/discord-php": "^7.0" }, "require-dev": { "fakerphp/faker": "^1.9.1", diff --git a/composer.lock b/composer.lock index 817950a..4c2c2f1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "18c06e191221e588fd030ccbe8b5e654", + "content-hash": "7ae17dd5730b055eb0b260e5b8ee41d5", "packages": [ { "name": "beyondcode/laravel-websockets", @@ -286,6 +286,102 @@ }, "time": "2021-08-13T13:06:58+00:00" }, + { + "name": "discord-php/http", + "version": "v9.0.10", + "source": { + "type": "git", + "url": "https://github.com/discord-php/DiscordPHP-Http.git", + "reference": "5d58a017152295c5769adad7510ec6d88bf2f60f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/discord-php/DiscordPHP-Http/zipball/5d58a017152295c5769adad7510ec6d88bf2f60f", + "reference": "5d58a017152295c5769adad7510ec6d88bf2f60f", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0", + "psr/log": "^1.1 || ^2.0 || ^3.0", + "react/http": "^1.2" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.17", + "monolog/monolog": "^2.2", + "psy/psysh": "^0.10.6" + }, + "type": "library", + "autoload": { + "psr-4": { + "Discord\\Http\\": "src/Discord" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "David Cole", + "email": "david.cole1340@gmail.com" + } + ], + "description": "Handles HTTP requests to Discord servers", + "support": { + "issues": "https://github.com/discord-php/DiscordPHP-Http/issues", + "source": "https://github.com/discord-php/DiscordPHP-Http/tree/v9.0.10" + }, + "time": "2022-02-16T15:10:31+00:00" + }, + { + "name": "discord/interactions", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/discord/discord-interactions-php.git", + "reference": "a6fc0c877b75cf5ff5811f2ea69c5cc4ad6ac457" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/discord/discord-interactions-php/zipball/a6fc0c877b75cf5ff5811f2ea69c5cc4ad6ac457", + "reference": "a6fc0c877b75cf5ff5811f2ea69c5cc4ad6ac457", + "shasum": "" + }, + "conflict": { + "simplito/elliptic-php": "<1.0,>=1.1" + }, + "require-dev": { + "simplito/elliptic-php": "^1.0" + }, + "suggest": { + "simplito/elliptic-php": "Required to validate interaction signatures." + }, + "type": "library", + "autoload": { + "psr-4": { + "Discord\\": "discord" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ian Webster", + "email": "ianw_php@ianww.com" + } + ], + "description": "Utils for implementing the Discord Interactions API", + "keywords": [ + "discord" + ], + "support": { + "issues": "https://github.com/discord/discord-interactions-php/issues", + "source": "https://github.com/discord/discord-interactions-php/tree/2.2.0" + }, + "time": "2022-02-09T17:58:51+00:00" + }, { "name": "doctrine/cache", "version": "2.1.1", @@ -2411,6 +2507,53 @@ ], "time": "2021-11-21T11:48:40+00:00" }, + { + "name": "mollie/polyfill-libsodium", + "version": "v1.1.1", + "source": { + "type": "git", + "url": "https://github.com/mollie/polyfill-libsodium.git", + "reference": "60351707e048080a2218a97296f88733f050f183" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mollie/polyfill-libsodium/zipball/60351707e048080a2218a97296f88733f050f183", + "reference": "60351707e048080a2218a97296f88733f050f183", + "shasum": "" + }, + "require": { + "php": ">=7.0.0" + }, + "suggest": { + "ext-sodium": "The new sodium php extension" + }, + "type": "library", + "autoload": { + "files": [ + "./bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Martijn Smit", + "email": "smit@mollie.com" + }, + { + "name": "Willem Stuursma-Ruwen", + "email": "willem@mollie.com" + } + ], + "description": "A polyfill package to transition from the libsodium php extension to the sodium extension. Which is included in PHP 7.2", + "support": { + "issues": "https://github.com/mollie/polyfill-libsodium/issues", + "source": "https://github.com/mollie/polyfill-libsodium/tree/master" + }, + "time": "2018-01-22T16:27:22+00:00" + }, { "name": "monolog/monolog", "version": "2.3.5", @@ -3789,6 +3932,60 @@ ], "time": "2021-09-25T23:10:38+00:00" }, + { + "name": "ratchet/pawl", + "version": "v0.4.1", + "source": { + "type": "git", + "url": "https://github.com/ratchetphp/Pawl.git", + "reference": "af70198bab77a582b31169d3cc3982bed25c161f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ratchetphp/Pawl/zipball/af70198bab77a582b31169d3cc3982bed25c161f", + "reference": "af70198bab77a582b31169d3cc3982bed25c161f", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0", + "guzzlehttp/psr7": "^2.0 || ^1.7", + "php": ">=5.4", + "ratchet/rfc6455": "^0.3.1", + "react/socket": "^1.9" + }, + "require-dev": { + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8" + }, + "suggest": { + "reactivex/rxphp": "~2.0" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "Ratchet\\Client\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Asynchronous WebSocket client", + "keywords": [ + "Ratchet", + "async", + "client", + "websocket", + "websocket client" + ], + "support": { + "issues": "https://github.com/ratchetphp/Pawl/issues", + "source": "https://github.com/ratchetphp/Pawl/tree/v0.4.1" + }, + "time": "2021-12-10T14:32:34+00:00" + }, { "name": "ratchet/rfc6455", "version": "v0.3.1", @@ -3922,6 +4119,144 @@ ], "time": "2021-02-02T06:47:52+00:00" }, + { + "name": "react/child-process", + "version": "v0.6.4", + "source": { + "type": "git", + "url": "https://github.com/reactphp/child-process.git", + "reference": "a778f3fb828d68caf8a9ab6567fd8342a86f12fe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/child-process/zipball/a778f3fb828d68caf8a9ab6567fd8342a86f12fe", + "reference": "a778f3fb828d68caf8a9ab6567fd8342a86f12fe", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/event-loop": "^1.2", + "react/stream": "^1.2" + }, + "require-dev": { + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35", + "react/socket": "^1.8", + "sebastian/environment": "^5.0 || ^3.0 || ^2.0 || ^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\ChildProcess\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Event-driven library for executing child processes with ReactPHP.", + "keywords": [ + "event-driven", + "process", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/child-process/issues", + "source": "https://github.com/reactphp/child-process/tree/v0.6.4" + }, + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2021-10-12T10:37:07+00:00" + }, + { + "name": "react/datagram", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/datagram.git", + "reference": "e4c5bf8daf44630f0a938f40fe2104b2b76ad2ff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/datagram/zipball/e4c5bf8daf44630f0a938f40fe2104b2b76ad2ff", + "reference": "e4c5bf8daf44630f0a938f40fe2104b2b76ad2ff", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3", + "react/dns": "^1.0 || ^0.4.13", + "react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3", + "react/promise": "~2.1|~1.2" + }, + "require-dev": { + "clue/block-react": "~1.0", + "phpunit/phpunit": "^5.0 || ^4.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Datagram\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@lueck.tv" + } + ], + "description": "Event-driven UDP datagram socket client and server for ReactPHP", + "homepage": "https://github.com/reactphp/datagram", + "keywords": [ + "Socket", + "async", + "client", + "datagram", + "dgram", + "reactphp", + "server", + "udp" + ], + "support": { + "issues": "https://github.com/reactphp/datagram/issues", + "source": "https://github.com/reactphp/datagram/tree/v1.5.0" + }, + "time": "2019-07-10T10:04:15+00:00" + }, { "name": "react/dns", "version": "v1.9.0", @@ -4175,6 +4510,50 @@ ], "time": "2022-02-03T13:17:37+00:00" }, + { + "name": "react/partial", + "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/friends-of-reactphp/partial.git", + "reference": "e06f034747561977670607888e0a99fd282308ab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/friends-of-reactphp/partial/zipball/e06f034747561977670607888e0a99fd282308ab", + "reference": "e06f034747561977670607888e0a99fd282308ab", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "^5.7" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "React\\Partial\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Partial function application.", + "keywords": [ + "functional-programming", + "partial" + ], + "support": { + "issues": "https://github.com/friends-of-reactphp/partial/issues", + "source": "https://github.com/friends-of-reactphp/partial/tree/v3.0.0" + }, + "time": "2017-10-01T13:27:11+00:00" + }, { "name": "react/promise", "version": "v2.9.0", @@ -5504,6 +5883,75 @@ ], "time": "2022-01-02T09:55:41+00:00" }, + { + "name": "symfony/options-resolver", + "version": "v5.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/options-resolver.git", + "reference": "cc1147cb11af1b43f503ac18f31aa3bec213aba8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/cc1147cb11af1b43f503ac18f31aa3bec213aba8", + "reference": "cc1147cb11af1b43f503ac18f31aa3bec213aba8", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php73": "~1.0", + "symfony/polyfill-php80": "^1.16" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an improved replacement for the array_replace PHP function", + "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], + "support": { + "source": "https://github.com/symfony/options-resolver/tree/v5.4.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-01-02T09:53:40+00:00" + }, { "name": "symfony/polyfill-ctype", "version": "v1.25.0", @@ -5997,6 +6445,85 @@ ], "time": "2021-05-27T09:17:38+00:00" }, + { + "name": "symfony/polyfill-php73", + "version": "v1.25.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/cc5db0e22b3cb4111010e48785a97f670b350ca5", + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php73/tree/v1.25.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-06-05T21:20:04+00:00" + }, { "name": "symfony/polyfill-php80", "version": "v1.25.0", @@ -6824,6 +7351,76 @@ ], "time": "2022-03-02T12:58:14+00:00" }, + { + "name": "team-reflex/discord-php", + "version": "v7.0.9", + "source": { + "type": "git", + "url": "https://github.com/discord-php/DiscordPHP.git", + "reference": "78a71eed34fc4bd640a046d270270de97bc2f864" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/discord-php/DiscordPHP/zipball/78a71eed34fc4bd640a046d270270de97bc2f864", + "reference": "78a71eed34fc4bd640a046d270270de97bc2f864", + "shasum": "" + }, + "require": { + "discord-php/http": "^9.0.10", + "discord/interactions": "^2.2", + "ext-json": "*", + "ext-zlib": "*", + "mollie/polyfill-libsodium": "^1.1", + "monolog/monolog": "^2.1", + "nesbot/carbon": "^2.38", + "php": "^7.4|^8.0", + "ratchet/pawl": "^0.4.1", + "react/child-process": "^0.6.2", + "react/datagram": "1.5.*", + "react/http": "^1.1", + "react/partial": "^3.0", + "symfony/options-resolver": "^5.1.3", + "trafficcophp/bytebuffer": "^0.3" + }, + "require-dev": { + "davidcole1340/reactsh": "dev-master", + "friendsofphp/php-cs-fixer": "^3", + "phpunit/phpunit": "^9.4", + "symfony/var-dumper": "*" + }, + "suggest": { + "ext-event": "For a faster, and more performant loop.", + "ext-gmp": "For Permissions and 64 bit calculations on x86 (32 bit) PHP.", + "ext-libev": "For a faster, and more performant loop.", + "ext-mbstring": "For accurate calculations of string length when handling non-english characters.", + "ext-uv": "For a faster, and more performant loop. Preferred." + }, + "type": "library", + "autoload": { + "files": [ + "src/Discord/functions.php" + ], + "psr-4": { + "Discord\\": "src/Discord" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "David Cole", + "email": "david.cole1340@gmail.com" + } + ], + "description": "An unofficial API to interact with the voice and text service Discord.", + "support": { + "issues": "https://github.com/discord-php/DiscordPHP/issues", + "source": "https://github.com/discord-php/DiscordPHP/tree/v7.0.9" + }, + "time": "2022-04-01T09:43:29+00:00" + }, { "name": "tijsverkoyen/css-to-inline-styles", "version": "2.2.4", @@ -6877,6 +7474,54 @@ }, "time": "2021-12-08T09:12:39+00:00" }, + { + "name": "trafficcophp/bytebuffer", + "version": "v0.3", + "source": { + "type": "git", + "url": "https://github.com/nesQuick/ByteBuffer.git", + "reference": "e94e5c87c41bc79c0f738b0fa89bad11d27ae0b4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nesQuick/ByteBuffer/zipball/e94e5c87c41bc79c0f738b0fa89bad11d27ae0b4", + "reference": "e94e5c87c41bc79c0f738b0fa89bad11d27ae0b4", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-0": { + "TrafficCophp": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ole 'nesQuick' Michaelis", + "email": "ole.michaelis@googlemail.com", + "homepage": "http://www.codestars.eu" + } + ], + "description": "Node.js inspired byte stream buffer for PHP.", + "keywords": [ + "Buffer", + "Bytehandling", + "Socket", + "binary data", + "library", + "pack", + "stream", + "wrapper" + ], + "support": { + "issues": "https://github.com/nesQuick/ByteBuffer/issues", + "source": "https://github.com/nesQuick/ByteBuffer/tree/master" + }, + "time": "2016-01-13T22:50:58+00:00" + }, { "name": "vlucas/phpdotenv", "version": "v5.4.1", @@ -9695,5 +10340,5 @@ "php": "^8.0.2" }, "platform-dev": [], - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.0.0" } diff --git a/config/discord.php b/config/discord.php new file mode 100644 index 0000000..a4068bd --- /dev/null +++ b/config/discord.php @@ -0,0 +1,5 @@ + env('DISCORD_BOT_TOKEN', ''), +]; -- 2.39.2