Coder Social home page Coder Social logo

discordbot's Introduction

DiscordBot

DiscordBot is not a plugin that provides anything for players/users, this plugin provides Developers with an extensive API to interact with a Discord Bot via DiscordPHP

Here are a list of plugins that provide user functionality:

  • Chat Bridge | Bi-directional chat between Discord and Minecraft
  • Discord Account | Link your Discord account to your Minecraft account
  • More to be listed (If you use this plugin open a PR to add your plugin here)

Developers, see API.md for more information on how to use the DiscordBot API
Advanced Developers, see Network_API.md for more information on the network protocol / external bots.

Requirements


Name Version Included in releases
PHP ^ 8.1
PocketMine-MP ^ 5.0
DiscordPHP 10.0.0-RC6
Promise 2.10

Installation


PocketMine-MP

All Releases v2.0.0 onwards have been tested and released on Poggit, you can download the latest release from Poggit or from GitHub

GitHub release being slightly more optimised, useless files are not included.

Composer

This plugin is also available via composer to use as a dev-dependency when using PHPStan, PHPUnit, or similar.

You can install it simply with composer require --dev jaxkdev/discordbot

To see more information about the project via composer/packagist please see here.

Please note the package name is jaxkdev/discordbot and not discordbot-pmmp/discordbot

Source

No support is given for users or developers running from source, I myself build the plugin into a phar before testing.

If you do become an active contributor to the plugin I will help you set up efficient workflows to ease testing.

Credits


Contributors

Libraries

And many more sub-dependencies that allow the above to function.

discordbot's People

Contributors

d1veer avatar jaxkdev avatar laith98dev avatar shelly7w7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

discordbot's Issues

Error

[15:19:33] [BotThread thread/CRITICAL]: Client failed to login/connect within 30 seconds, See log file for details.
[15:19:34] [Server thread/INFO]: Disabling DiscordBot v1.0.0

activity err

[2021-12-12T00:56:55.121001+00:00] DiscordThread.CRITICAL: AssertionError: "Invalid url 'https://www.twitch.tv/dextroiter'." (EXCEPTION) in "phar:///home/container/plugins/DiscordBot.phar/src/Models/Activity.php" at line 162 [] []
[2021-12-12T00:56:55.121398+00:00] DiscordThread.CRITICAL: #0 /home/container/plugins/DiscordBot.phar/src/Models/Activity(104): JaxkDev\DiscordBot\Models\Activity->setUrl(string[32] https://www.twitch.tv/dextroiter) [] []
[2021-12-12T00:56:55.121444+00:00] DiscordThread.CRITICAL: #1 /home/container/plugins/DiscordBot.phar/src/Bot/ModelConverter(93): JaxkDev\DiscordBot\Models\Activity->__construct(string[6] Twitch, integer 1, integer 1639270614998, string[32] https://www.twitch.tv/dextroiter, NULL , NULL , NULL , string[14] Minezin de lei, string[9] Minecraft, NULL , NULL , NULL , NULL , string[17] twitch:dextroiter, NULL , NULL , NULL , NULL , NULL ) [] []
[2021-12-12T00:56:55.121481+00:00] DiscordThread.CRITICAL: #2 /home/container/plugins/DiscordBot.phar/src/Bot/Handlers/DiscordEventHandler(324): JaxkDev\DiscordBot\Bot\ModelConverter::genModelActivity(object Discord\Parts\User\Activity#2477) [] []
[2021-12-12T00:56:55.121533+00:00] DiscordThread.CRITICAL: #3 /home/container/plugins/DiscordBot.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait(123): JaxkDev\DiscordBot\Bot\Handlers\DiscordEventHandler->onPresenceUpdate(object Discord\Parts\WebSockets\PresenceUpdate#7300, object JaxkDev\DiscordBot\Bot\Discord#12, object Discord\Parts\WebSockets\PresenceUpdate#2714) [] []
[2021-12-12T00:56:55.121568+00:00] DiscordThread.CRITICAL: #4 /home/container/plugins/DiscordBot.phar/vendor/team-reflex/discord-php/src/Discord/Discord(697): Discord\Discord->emit(string[15] PRESENCE_UPDATE, array[3]) [] []
[2021-12-12T00:56:55.121600+00:00] DiscordThread.CRITICAL: #5 /home/container/plugins/DiscordBot.phar/vendor/react/promise/src/FulfilledPromise(42): Discord\Discord->Discord\{closure}(array[2]) [] []
[2021-12-12T00:56:55.121631+00:00] DiscordThread.CRITICAL: #6 /home/container/plugins/DiscordBot.phar/vendor/react/promise/src/Promise(66): React\Promise\FulfilledPromise->done(object Closure#6541, object Closure#2801) [] []
[2021-12-12T00:56:55.121662+00:00] DiscordThread.CRITICAL: #7 /home/container/plugins/DiscordBot.phar/vendor/react/promise/src/Promise(168): React\Promise\Promise::React\Promise\{closure}(object React\Promise\FulfilledPromise#873) [] []
[2021-12-12T00:56:55.121694+00:00] DiscordThread.CRITICAL: #8 /home/container/plugins/DiscordBot.phar/vendor/react/promise/src/Promise(231): React\Promise\Promise->settle(object React\Promise\FulfilledPromise#873) [] []
[2021-12-12T00:56:55.121739+00:00] DiscordThread.CRITICAL: #9 /home/container/plugins/DiscordBot.phar/vendor/react/promise/src/Deferred(36): React\Promise\Promise::React\Promise\{closure}(array[2]) [] []
[2021-12-12T00:56:55.121772+00:00] DiscordThread.CRITICAL: #10 /home/container/plugins/DiscordBot.phar/vendor/team-reflex/discord-php/src/Discord/WebSockets/Events/PresenceUpdate(37): React\Promise\Deferred->resolve(array[2]) [] []
[2021-12-12T00:56:55.121831+00:00] DiscordThread.CRITICAL: #11 /home/container/plugins/DiscordBot.phar/vendor/team-reflex/discord-php/src/Discord/Discord(721): Discord\WebSockets\Events\PresenceUpdate->handle(object Discord\Helpers\Deferred#6600, object stdClass#900) [] []
[2021-12-12T00:56:55.121868+00:00] DiscordThread.CRITICAL: #12 /home/container/plugins/DiscordBot.phar/vendor/team-reflex/discord-php/src/Discord/Discord(594): Discord\Discord->handleDispatch(object stdClass#811) [] []
[2021-12-12T00:56:55.121898+00:00] DiscordThread.CRITICAL: #13 /home/container/plugins/DiscordBot.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait(123): Discord\Discord->handleWsMessage(object Ratchet\RFC6455\Messaging\Message#2439, object Ratchet\Client\WebSocket#126) [] []
[2021-12-12T00:56:55.121929+00:00] DiscordThread.CRITICAL: #14 /home/container/plugins/DiscordBot.phar/vendor/ratchet/pawl/src/WebSocket(72): Ratchet\Client\WebSocket->emit(string[7] message, array[2]) [] []
[2021-12-12T00:56:55.121959+00:00] DiscordThread.CRITICAL: #15 /home/container/plugins/DiscordBot.phar/vendor/ratchet/rfc6455/src/Messaging/MessageBuffer(248): Ratchet\Client\WebSocket->Ratchet\Client\{closure}(object Ratchet\RFC6455\Messaging\Message#2439, object Ratchet\RFC6455\Messaging\MessageBuffer#98) [] []
[2021-12-12T00:56:55.121989+00:00] DiscordThread.CRITICAL: #16 /home/container/plugins/DiscordBot.phar/vendor/ratchet/rfc6455/src/Messaging/MessageBuffer(194): Ratchet\RFC6455\Messaging\MessageBuffer->processData(string[648] .~..{"t":"PRESENCE_UPDATE","s":1233,"op":0,"d":{"user":{"id":"752973359481880787) [] []
[2021-12-12T00:56:55.122019+00:00] DiscordThread.CRITICAL: #17 /home/container/plugins/DiscordBot.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait(123): Ratchet\RFC6455\Messaging\MessageBuffer->onData(string[648] .~..{"t":"PRESENCE_UPDATE","s":1233,"op":0,"d":{"user":{"id":"752973359481880787) [] []
[2021-12-12T00:56:55.122049+00:00] DiscordThread.CRITICAL: #18 /home/container/plugins/DiscordBot.phar/vendor/react/stream/src/Util(71): Evenement\EventEmitter->emit(string[4] data, array[1]) [] []
[2021-12-12T00:56:55.122078+00:00] DiscordThread.CRITICAL: #19 /home/container/plugins/DiscordBot.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait(123): React\Stream\Util::React\Stream\{closure}(string[648] .~..{"t":"PRESENCE_UPDATE","s":1233,"op":0,"d":{"user":{"id":"752973359481880787) [] []
[2021-12-12T00:56:55.122108+00:00] DiscordThread.CRITICAL: #20 /home/container/plugins/DiscordBot.phar/vendor/react/stream/src/DuplexResourceStream(196): Evenement\EventEmitter->emit(string[4] data, array[1]) [] []
[2021-12-12T00:56:55.122138+00:00] DiscordThread.CRITICAL: #21 /home/container/plugins/DiscordBot.phar/vendor/react/event-loop/src/StreamSelectLoop(245): React\Stream\DuplexResourceStream->handleData(resource Resource id #325) [] []
[2021-12-12T00:56:55.122193+00:00] DiscordThread.CRITICAL: #22 /home/container/plugins/DiscordBot.phar/vendor/react/event-loop/src/StreamSelectLoop(212): React\EventLoop\StreamSelectLoop->waitForStreamActivity(integer 50000) [] []
[2021-12-12T00:56:55.122227+00:00] DiscordThread.CRITICAL: #23 /home/container/plugins/DiscordBot.phar/vendor/team-reflex/discord-php/src/Discord/Discord(1368): React\EventLoop\StreamSelectLoop->run() [] []
[2021-12-12T00:56:55.122266+00:00] DiscordThread.CRITICAL: #24 /home/container/plugins/DiscordBot.phar/src/Bot/Client(111): Discord\Discord->run() [] []
[2021-12-12T00:56:55.122314+00:00] DiscordThread.CRITICAL: #25 /home/container/plugins/DiscordBot.phar/src/Communication/BotThread(50): JaxkDev\DiscordBot\Bot\Client->__construct(object JaxkDev\DiscordBot\Communication\BotThread#1, array[4]) [] []
[2021-12-12T00:56:55.122360+00:00] DiscordThread.CRITICAL: #26 (): JaxkDev\DiscordBot\Communication\BotThread->run() [] []
[2021-12-12T00:56:55.122500+00:00] DiscordThread.INFO: discord closed [] []
[2021-12-12T00:56:55.122549+00:00] DiscordThread.NOTICE: Discord thread closed. [] []

[Incorrect Assertion] Message reactions removed

When a member reacts to a message and leaves the server, if the bot then restarts/starts after the member leave they won't be in the bots local storage and so when the member ID is provided the member wont be in storage.

This is incorrect to assume it will always be a user in the server, they may have left etc.

throw new \AssertionError("Member '{$packet->getMemberId()}' does not exist in storage.");

May change event to member ID instead of member instance, however this is a BC break :(

References:

[Internal Issue] Heartbeat can get ‘dumped’

If discord server is large enough it’s possible to cause an overload of data going inbound to the plugin, however if the bots heartbeat is in the mass amount of data it can get dumped when plugin checks if data is backlogged further then 5000.
If the heartbeat gets lost 5x in a row it will shutdown as its thought to be dead, although this is OK for now as that would mean the plugin is receiving 25000 events in 5 seconds, this shouldn’t happen even in a ‘large’ discord server.

However ‘priority’ events like Heartbeat needs to be prioritised to be read first, possibly a new queue / volatile array for priority events ?

Next error please help :(

Fatal error: Uncaught BadMethodCallException: unable to create temporary file in /home/SkyBlock/plugins/DiscordBot-1.0.0/BUILD.php:114
Stack trace:
#0 /home/SkyBlock/plugins/DiscordBot-1.0.0/BUILD.php(114): Phar->compressFiles(4096)
#1 /home/SkyBlock/plugins/DiscordBot-1.0.0/BUILD.php(37): buildPhar('/home/SkyBlock/...', '/home/SkyBlock/...', Array, Array, Array, '<?php __HALT_CO...')
#2 {main}
thrown in /home/SkyBlock/plugins/DiscordBot-1.0.0/BUILD.php on line 114

Can't get member's nickname

class JaxkDev\DiscordBot\Plugin\Storage can't get member's nickname. I use getMembersByServer(), it give this

  [0]=>
  object(JaxkDev\DiscordBot\Models\Member)#95286 (11) {
    ["user_id":"JaxkDev\DiscordBot\Models\Member":private]=>
    string(18) "234395307759108106"
    ["nickname":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
    ["status":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
    ["client_status":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
    ["join_timestamp":"JaxkDev\DiscordBot\Models\Member":private]=>
    int(1627128251)
    ["boost_timestamp":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
    ["permissions":"JaxkDev\DiscordBot\Models\Member":private]=>
    object(JaxkDev\DiscordBot\Models\Permissions\RolePermissions)#95285 (2) {
      ["bitwise":"JaxkDev\DiscordBot\Models\Permissions\Permissions":private]=>
      int(104320577)
      ["permissions":"JaxkDev\DiscordBot\Models\Permissions\Permissions":private]=>
      array(0) {
      }
    }
    ["roles":"JaxkDev\DiscordBot\Models\Member":private]=>
    array(0) {
    }
    ["server_id":"JaxkDev\DiscordBot\Models\Member":private]=>
    string(18) "821596134819627028"
    ["activities":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
    ["voice_state":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
  }
  [1]=>
  object(JaxkDev\DiscordBot\Models\Member)#95287 (11) {
    ["user_id":"JaxkDev\DiscordBot\Models\Member":private]=>
    string(18) "686364124510421107"
    ["nickname":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
    ["status":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
    ["client_status":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
    ["join_timestamp":"JaxkDev\DiscordBot\Models\Member":private]=>
    int(1623403926)
    ["boost_timestamp":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
    ["permissions":"JaxkDev\DiscordBot\Models\Member":private]=>
    object(JaxkDev\DiscordBot\Models\Permissions\RolePermissions)#95284 (2) {
      ["bitwise":"JaxkDev\DiscordBot\Models\Permissions\Permissions":private]=>
      int(2147483647)
      ["permissions":"JaxkDev\DiscordBot\Models\Permissions\Permissions":private]=>
      array(0) {
      }
    }
    ["roles":"JaxkDev\DiscordBot\Models\Member":private]=>
    array(1) {
      [0]=>
      string(18) "861576370114789376"
    }
    ["server_id":"JaxkDev\DiscordBot\Models\Member":private]=>
    string(18) "821596134819627028"
    ["activities":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
    ["voice_state":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
  }
  [2]=>
  object(JaxkDev\DiscordBot\Models\Member)#95271 (11) {
    ["user_id":"JaxkDev\DiscordBot\Models\Member":private]=>
    string(18) "771904270639169547"
    ["nickname":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
    ["status":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
    ["client_status":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
    ["join_timestamp":"JaxkDev\DiscordBot\Models\Member":private]=>
    int(1615954183)
    ["boost_timestamp":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
    ["permissions":"JaxkDev\DiscordBot\Models\Member":private]=>
    object(JaxkDev\DiscordBot\Models\Permissions\RolePermissions)#95276 (2) {
      ["bitwise":"JaxkDev\DiscordBot\Models\Permissions\Permissions":private]=>
      int(2147483647)
      ["permissions":"JaxkDev\DiscordBot\Models\Permissions\Permissions":private]=>
      array(0) {
      }
    }
    ["roles":"JaxkDev\DiscordBot\Models\Member":private]=>
    array(1) {
      [0]=>
      string(18) "861576370114789376"
    }
    ["server_id":"JaxkDev\DiscordBot\Models\Member":private]=>
    string(18) "821596134819627028"
    ["activities":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
    ["voice_state":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
  }
  [3]=>
  object(JaxkDev\DiscordBot\Models\Member)#95280 (11) {
    ["user_id":"JaxkDev\DiscordBot\Models\Member":private]=>
    string(18) "781120375643701258"
    ["nickname":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
    ["status":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
    ["client_status":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
    ["join_timestamp":"JaxkDev\DiscordBot\Models\Member":private]=>
    int(1616759932)
    ["boost_timestamp":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
    ["permissions":"JaxkDev\DiscordBot\Models\Member":private]=>
    object(JaxkDev\DiscordBot\Models\Permissions\RolePermissions)#95279 (2) {
      ["bitwise":"JaxkDev\DiscordBot\Models\Permissions\Permissions":private]=>
      int(2147483647)
      ["permissions":"JaxkDev\DiscordBot\Models\Permissions\Permissions":private]=>
      array(0) {
      }
    }
    ["roles":"JaxkDev\DiscordBot\Models\Member":private]=>
    array(1) {
      [0]=>
      string(18) "824975691401003069"
    }
    ["server_id":"JaxkDev\DiscordBot\Models\Member":private]=>
    string(18) "821596134819627028"
    ["activities":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
    ["voice_state":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
  }
  [4]=>
  object(JaxkDev\DiscordBot\Models\Member)#95281 (11) {
    ["user_id":"JaxkDev\DiscordBot\Models\Member":private]=>
    string(18) "892692276873134080"
    ["nickname":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
    ["status":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
    ["client_status":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
    ["join_timestamp":"JaxkDev\DiscordBot\Models\Member":private]=>
    int(1632905693)
    ["boost_timestamp":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
    ["permissions":"JaxkDev\DiscordBot\Models\Member":private]=>
    object(JaxkDev\DiscordBot\Models\Permissions\RolePermissions)#95278 (2) {
      ["bitwise":"JaxkDev\DiscordBot\Models\Permissions\Permissions":private]=>
      int(2147483647)
      ["permissions":"JaxkDev\DiscordBot\Models\Permissions\Permissions":private]=>
      array(0) {
      }
    }
    ["roles":"JaxkDev\DiscordBot\Models\Member":private]=>
    array(3) {
      [0]=>
      string(18) "861576370114789376"
      [1]=>
      string(18) "892695924114096129"
      [2]=>
      string(18) "894185880770736139"
    }
    ["server_id":"JaxkDev\DiscordBot\Models\Member":private]=>
    string(18) "821596134819627028"
    ["activities":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
    ["voice_state":"JaxkDev\DiscordBot\Models\Member":private]=>
    NULL
  }
}

PocketMine-MP not working too

[Server thread/ERROR]: Could not load '/home/PocketMine-MP/plugins/DiscordBot_v1_0_0.phar' in folder '/home/PocketMine-MP/plugins/': in phar "/home/PocketMine-MP/plugins/DiscordBot_v1_0_0.phar", manifest claims to have zero entries. Phars must have at least 1 entry
[09:32:24] [Server thread/CRITICAL]: UnexpectedValueException: "in phar "/home/PocketMine-MP/plugins/DiscordBot_v1_0_0.phar", manifest claims to have zero entries. Phars must have at least 1 entry" (EXCEPTION) in "pmsrc/src/pocketmine/plugin/PharPluginLoader" at line 58
[09:32:24] [Server thread/CRITICAL]: #0 pmsrc/src/pocketmine/plugin/PharPluginLoader(58): Phar->__construct(string[50] /home/PocketMine-MP/plugins/DiscordBot_v1_0_0.phar)
[09:32:24] [Server thread/CRITICAL]: #1 pmsrc/src/pocketmine/plugin/PluginManager(238): pocketmine\plugin\PharPluginLoader->getPluginDescription(string[50] /home/PocketMine-MP/plugins/DiscordBot_v1_0_0.phar)
[09:32:24] [Server thread/CRITICAL]: #2 pmsrc/src/pocketmine/Server(1530): pocketmine\plugin\PluginManager->loadPlugins(string[28] /home/PocketMine-MP/plugins/)
[09:32:24] [Server thread/CRITICAL]: #3 pmsrc/src/pocketmine/PocketMine(272): pocketmine\Server->__construct(object BaseClassLoader, object pocketmine\utils\MainLogger, string[20] /home/PocketMine-MP/, string[28] /home/PocketMine-MP/plugins/)
[09:32:24] [Server thread/CRITICAL]: #4 pmsrc/src/pocketmine/PocketMine(302): pocketmine\server()
[09:32:24] [Server thread/CRITICAL]: #5 pmsrc(11): require(string[72] phar:///home/PocketMine-MP/pocketmine.phar/src/pocketmine/PocketMine.php)

connection break after 1-2days

hi
i have the problem that the bot lost the connection after 1-2days, no error.
after a server restart it works again.

[RFC] Discord Bot Permissions

Currently in the wiki I have a pre set list of permissions to avoid giving the bot more permissions then absolutely required to function as of v1.0.0

However after a very long time implementing much more API functionality almost every permission is required to take full advantage of all methods created in the API, the only disadvantage of inviting/listing all permissions as required is the security risk, As previously discussed its a waste of time to try and 'hide' the bot 'secret' used to login as the bot via discords gateway so to maximise security the permissions were pre-set if following the wiki as mentioned at the beginning.

There are sort of three options I see right now.

  1. Inviting the bot as (/giving bot) administrator to allow all API functions to work without permission problems (Except the unavoidable eg trying to ban server owner will never work due to lack of permissions)
    As mentioned this is not very secure 'if' the bot secret was leaked the most damage would be banning every user that was non-admin or spam pinging everyone or similar.

  2. TO BE FINISHED, SUBMITTED ISSUE AS DRAFTING NOT POSSIBLE TO SAVE.

Bug

[2021-02-28T23:30:05.732149+00:00] DiscordPHP.HTTP.DEBUG: REQ GET https://discord.com/api/v6/gateway/bot queued [] []
[2021-02-28T23:30:05.864618+00:00] DiscordPHP.HTTP.WARNING: REQ GET https://discord.com/api/v6/gateway/bot failed: Connection to discord.com:443 failed during TLS handshake: Unable to complete TLS handshake: SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed [] []
[2021-02-28T23:30:05.864718+00:00] DiscordPHP.WARNING: could not retrieve gateway, using default [] []
[2021-02-28T23:30:05.864762+00:00] DiscordPHP.INFO: gateway retrieved and set {"gateway":"wss://gateway.discord.gg/?v=6&encoding=json","session":{"total":1000,"remaining":1000,"reset_after":0,"max_concurrency":1}} []
[2021-02-28T23:30:05.864832+00:00] DiscordPHP.INFO: starting connection to websocket {"gateway":"wss://gateway.discord.gg/?v=6&encoding=json"} []
[2021-02-28T23:30:05.968570+00:00] DiscordPHP.ERROR: websocket error {"e":"Connection to gateway.discord.gg:443 failed during TLS handshake: Unable to complete TLS handshake: SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed"} []

Token Security Suggestion

Many server owners give console access to their hired developers. I’ve seen many cases where these developers either scam, get fired, or try to mess up the server. When this happens, and this plugin is installed, these developers will get access to the bot token. With this token in hand, these developers can do some nasty things.

I’m suggesting that tokens be setup some other way to improve security. For example, it can be setup in game (/token ), then saved to the config or another file encoded.

In the end, this is an awesome plugin, good job!

Bug

BotThread thread/CRITICAL Client failed to login/connect within 30 seconds, See log file for details.

I saw that you closed the other issue regarding this (#22) so I am just wondering if fixed or plugin is not ready yet. Sorry if it is and I am just not able to find it...

error

hello, help me please, I can’t do point 3

Installing dependencies, Removing any dev-dependencies & Optimising Autoloader...
sh: 1: composer: not found
Building plugin...
PHP Fatal error: Uncaught Error: Call to undefined function yaml_parse_file() in /home/non/plugins/DiscordBot-master/BUILD.php:135
Stack trace:
#0 /home/non/plugins/DiscordBot-master/BUILD.php(29): generatePluginMetadataFromYml()
#1 {main}
thrown in /home/non/plugins/DiscordBot-master/BUILD.php on line 135
root@v611218:/home/non/plugins/DiscordBot-master#

[Feature request] Different leave message if player leaves via transferserver

I personally use this plugin for my lobby. Having the ability to see where players transfer to would be very helpful, and I believe I'm not the only one who would use this feature.

Would also be cool if you could also specify a different message for any specific address and port.

Eg. If the player is transferred to my.domain.com:19135 the bot will say {USERNAME} transferred to Factions but if they transfer to my.domain.com:19133 it says {USERNAME} transferred to SMP. Any other transfer, and it will say the normal leave server message.

All editable in the config file, of course.

[03:35:11] [BotThread thread/CRITICAL]: Client failed to login/connect within 30 seconds, See log file for details.

Here's the Log

DiscordPHP.INFO: starting connection to websocket {"gateway":"wss://gateway.discord.gg/?v=6&encoding=json"} []
[2021-03-06T03:34:41.742302+00:00] DiscordPHP.ERROR: websocket error {"e":"Connection to gateway.discord.gg:443 failed during TLS handshake: Unable to complete TLS handshake: SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed"} []

"Plugin Disabled"

Fatal error: Uncaught AssertionError: Invalid message data received. in phar:///home/container/plugins/DiscordBot_v1_0_0.phar/src/JaxkDev/DiscordBot/Utils.php:27
Stack trace:
#0 phar:///home/container/plugins/DiscordBot_v1_0_0.phar/src/JaxkDev/DiscordBot/Bot/Handlers/PluginCommunicationHandler.php(57): JaxkDev\DiscordBot\Utils::assert(false, 'Invalid message...')
#1 phar:///home/container/plugins/DiscordBot_v1_0_0.phar/src/JaxkDev/DiscordBot/Bot/Handlers/PluginCommunicationHandler.php(45): JaxkDev\DiscordBot\Bot\Handlers\PluginCommunicationHandler->handleSendMessage(Array)
#2 phar:///home/container/plugins/DiscordBot_v1_0_0.phar/src/JaxkDev/DiscordBot/Bot/Client.php(171): JaxkDev\DiscordBot\Bot\Handlers\PluginCommunicationHandler->handle(Array)
#3 phar:///home/container/plugins/DiscordBot_v1_0_0.phar/src/JaxkDev/DiscordBot/Bot/Client.php(143): JaxkDev\DiscordBot\Bot\Client->tick()
#4 phar:///home/container/plugins/DiscordBot_v1_0_0.phar/vendor/react/event-loop/src/Timer/Timers.php(96): JaxkDev\DiscordBot\Bot\Client->JaxkD in phar:///home/container/plugins/DiscordBot_v1_0_0.phar/src/JaxkDev/DiscordBot/Utils.php on line 27

Unable to complete TLS handshake: SSL operation failed with code 1

Bot does not come online. Checking logs, this error appears: Unable to complete TLS handshake: SSL operation failed with code 1.

Full error below.

[2020-12-16T20:23:08.860126+00:00] DiscordPHP.HTTP.DEBUG: REQ GET https://discord.com/api/v6/gateway/bot queued [] []
[2020-12-16T20:23:08.869674+00:00] DiscordPHP.HTTP.WARNING: REQ GET https://discord.com/api/v6/gateway/bot failed: Connection to discord.com:443 failed during TLS handshake: Unable to complete TLS handshake: SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed [] []
[2020-12-16T20:23:08.869719+00:00] DiscordPHP.WARNING: could not retrieve gateway, using default [] []
[2020-12-16T20:23:08.869742+00:00] DiscordPHP.INFO: gateway retrieved and set {"gateway":"wss://gateway.discord.gg/?v=6&encoding=json","session":{"total":1000,"remaining":1000,"reset_after":0,"max_concurrency":1}} []
[2020-12-16T20:23:08.869762+00:00] DiscordPHP.INFO: starting connection to websocket {"gateway":"wss://gateway.discord.gg/?v=6&encoding=json"} []
[2020-12-16T20:23:08.876393+00:00] DiscordPHP.ERROR: websocket error {"e":"Connection to gateway.discord.gg:443 failed during TLS handshake: Unable to complete TLS handshake: SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed"} []

[DiscordPHP Issue] SSL Options not possible

Continuation from discord’s notes, if a server host has not setup TSL handshake, SSL verification correctly discordPHP will fall through and fail to connect.
Options need to be set for the clients HTTP Connector and the WS Connector however these constructors are not publicly custom so right now it’s only possible to edit the source in vendor/ and then build, this is not production behaviour and needs to be addressed.

Because this disables TLS verify_peer & verify_peer_name this option should only be enabled in extreme cases where it’s impossible to setup the correct ca file.

Low Priority - DiscordPHP Issue not DiscordBot.

API and events

So hey. I have my own bot on discord with this plugin, and I was wondering - Do the events like MessageSent Event, work with bots too? For example, if the bot types smth in chat, like a command, etc, would it fire the MessageSent Event?

Call to undefined function yaml_parse_file()

Fatal error: Uncaught Error: Call to undefined function yaml_parse_file() in C:\DIR2folder\BUILD.php:134
Stack trace:
#0 C:\DIR2folder\BUILD.php(28): generatePluginMetadataFromYml('C:\Users\night\...')
#1 {main}
thrown in C:\DIR2folder\BUILD.php on line 134

Blank Voice Channel - VoiceStateUpdate packet assertion

2021-12-03 [18:18:30] [Server thread/CRITICAL]: AssertionError: "Voice Channel '' not found in storage." (EXCEPTION) in "plugins/DiscordBot_v2_0_4.phar/src/JaxkDev/DiscordBot/Plugin/BotCommunicationHandler" at line 153

2021-12-03 [18:18:30] [Server thread/CRITICAL]: #0 plugins/DiscordBot_v2_0_4.phar/src/JaxkDev/DiscordBot/Plugin/BotCommunicationHandler(104): JaxkDev\DiscordBot\Plugin\BotCommunicationHandler->handleVoiceStateUpdate(object JaxkDev\DiscordBot\Communication\Packets\Discord\VoiceStateUpdate)
2021-12-03 [18:18:30] [Server thread/CRITICAL]: #1 plugins/DiscordBot_v2_0_4.phar/src/JaxkDev/DiscordBot/Plugin/Main(254): JaxkDev\DiscordBot\Plugin\BotCommunicationHandler->handle(object JaxkDev\DiscordBot\Communication\Packets\Discord\VoiceStateUpdate)
2021-12-03 [18:18:30] [Server thread/CRITICAL]: #2 plugins/DiscordBot_v2_0_4.phar/src/JaxkDev/DiscordBot/Plugin/Main(112): JaxkDev\DiscordBot\Plugin\Main->tick(integer 34978)
2021-12-03 [18:18:30] [Server thread/CRITICAL]: #3 pmsrc/src/pocketmine/scheduler/ClosureTask(61): JaxkDev\DiscordBot\Plugin\Main->JaxkDev\DiscordBot\Plugin\{closure}(integer 34978)
2021-12-03 [18:18:30] [Server thread/CRITICAL]: #4 pmsrc/src/pocketmine/scheduler/TaskHandler(137): pocketmine\scheduler\ClosureTask->onRun(integer 34978)
2021-12-03 [18:18:30] [Server thread/CRITICAL]: #5 pmsrc/src/pocketmine/scheduler/TaskScheduler(179): pocketmine\scheduler\TaskHandler->run(integer 34978)
2021-12-03 [18:18:30] [Server thread/CRITICAL]: #6 pmsrc/src/pocketmine/plugin/PluginManager(654): pocketmine\scheduler\TaskScheduler->mainThreadHeartbeat(integer 34978)
2021-12-03 [18:18:30] [Server thread/CRITICAL]: #7 pmsrc/src/pocketmine/Server(2389): pocketmine\plugin\PluginManager->tickSchedulers(integer 34978)
2021-12-03 [18:18:30] [Server thread/CRITICAL]: #8 pmsrc/src/pocketmine/Server(2152): pocketmine\Server->tick()
2021-12-03 [18:18:30] [Server thread/CRITICAL]: #9 pmsrc/src/pocketmine/Server(1992): pocketmine\Server->tickProcessor()
2021-12-03 [18:18:30] [Server thread/CRITICAL]: #10 pmsrc/src/pocketmine/Server(1586): pocketmine\Server->start()
2021-12-03 [18:18:30] [Server thread/CRITICAL]: #11 pmsrc/src/pocketmine/PocketMine(330): pocketmine\Server->__construct(object BaseClassLoader, object pocketmine\utils\MainLogger, string[10] /root/SDT/, string[18] /root/SDT/plugins/)
2021-12-03 [18:18:30] [Server thread/CRITICAL]: #12 pmsrc/src/pocketmine/PocketMine(360): pocketmine\server()```

[Internal Suggestion] Filtering channels & events

Following on from #1 where we can see a massive spike in events / data from discord or even PocketMine this is mainly due to the fact we’re listening for every single event no matter if it’s handled or even wanted.
If the bot/plugin sends a request to allow certain channels/events this can cut down the load on bigger servers.

Add new protocol info for AddDiscordEventListener (Plugin emitted), [const ID, [const EventID, string(18) serverID, string(18) channelID]]

And potentially RemoveEventListener, TBD.

Debug message

why the debug message will show out, I set debug to false and pocketmine.yml also same but after few second, it will show out again. But when I disabled your plugin, It didn't show debug message, but when I enabled, it show's up again. Here have a video
https://youtu.be/69tDwD3542Q

Error loading the plugin

Server Log

[06:28:44] [Server thread/INFO]: Enabling DiscordBot v2.0.0
[06:28:44] [Server thread/INFO]: Enabling LightningDeath v1.2.4
[06:28:44] [Server thread/INFO]: Enabling AddNetherite-HiroTeam v2.0.0

Warning: require_once(phar:///home/container/plugins/DiscordBot.phar/vendor/autoload.php): failed to open stream: phar error: "vendor/autoload.php" is not a file in phar "/home/container/plugins/DiscordBot.phar" in phar:///home/container/plugins/DiscordBot.phar/src/JaxkDev/DiscordBot/Communication/BotThread.php on line 54

Fatal error: require_once(): Failed opening required 'phar:///home/container/plugins/DiscordBot.phar/vendor/autoload.php' (include_path='.:') in phar:///home/container/plugins/DiscordBot.phar/src/JaxkDev/DiscordBot/Communication/BotThread.php on line 54

Referenced reply message assertion

DiscordThread.CRITICAL: AssertionError: "No referenced message on a REPLY message." (EXCEPTION) in "phar:///home/container/plugins/DiscordBot.phar/src/Bot/ModelConverter.php" at line 253 [] [] [2021-12-04T16:07:22.685582+00:00] DiscordThread.CRITICAL: #0 /home/container/plugins/DiscordBot.phar/src/Bot/Handlers/DiscordEventHandler(334): JaxkDev\DiscordBot\Bot\ModelConverter::genModelMessage(object Discord\Parts\Channel\Message#1301) [] [] [2021-12-04T16:07:22.685648+00:00] DiscordThread.CRITICAL: #1 /home/container/plugins/DiscordBot.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait(123): JaxkDev\DiscordBot\Bot\Handlers\DiscordEventHandler->onMessageCreate(object Discord\Parts\Channel\Message#1301, object JaxkDev\DiscordBot\Bot\Discord#12, NULL ) [] [] [2021-12-04T16:07:22.685729+00:00] DiscordThread.CRITICAL: #2 /home/container/plugins/DiscordBot.phar/vendor/team-reflex/discord-php/src/Discord/Discord(697): Discord\Discord->emit(string[14] MESSAGE_CREATE, array[3]) [] [] [2021-12-04T16:07:22.685781+00:00] DiscordThread.CRITICAL: #3 /home/container/plugins/DiscordBot.phar/vendor/react/promise/src/FulfilledPromise(42): Discord\Discord->Discord\{closure}(object Discord\Parts\Channel\Message#1301) [] [] [2021-12-04T16:07:22.685831+00:00] DiscordThread.CRITICAL: #4 /home/container/plugins/DiscordBot.phar/vendor/react/promise/src/Promise(66): React\Promise\FulfilledPromise->done(object Closure#106, object Closure#2313) [] [] [2021-12-04T16:07:22.685879+00:00] DiscordThread.CRITICAL: #5 /home/container/plugins/DiscordBot.phar/vendor/react/promise/src/Promise(168): React\Promise\Promise::React\Promise\{closure}(object React\Promise\FulfilledPromise#1232) [] [] [2021-12-04T16:07:22.685925+00:00] DiscordThread.CRITICAL: #6 /home/container/plugins/DiscordBot.phar/vendor/react/promise/src/Promise(231): React\Promise\Promise->settle(object React\Promise\FulfilledPromise#1232) [] [] [2021-12-04T16:07:22.685972+00:00] DiscordThread.CRITICAL: #7 /home/container/plugins/DiscordBot.phar/vendor/react/promise/src/Deferred(36): React\Promise\Promise::React\Promise\{closure}(object Discord\Parts\Channel\Message#1301) [] [] [2021-12-04T16:07:22.686021+00:00] DiscordThread.CRITICAL: #8 /home/container/plugins/DiscordBot.phar/vendor/team-reflex/discord-php/src/Discord/WebSockets/Events/MessageCreate(51): React\Promise\Deferred->resolve(object Discord\Parts\Channel\Message#1301) [] [] [2021-12-04T16:07:22.686067+00:00] DiscordThread.CRITICAL: #9 /home/container/plugins/DiscordBot.phar/vendor/team-reflex/discord-php/src/Discord/Discord(721): Discord\WebSockets\Events\MessageCreate->handle(object Discord\Helpers\Deferred#1393, object stdClass#2398) [] [] [2021-12-04T16:07:22.686114+00:00] DiscordThread.CRITICAL: #10 /home/container/plugins/DiscordBot.phar/vendor/team-reflex/discord-php/src/Discord/Discord(594): Discord\Discord->handleDispatch(object stdClass#1561) [] [] [2021-12-04T16:07:22.686160+00:00] DiscordThread.CRITICAL: #11 /home/container/plugins/DiscordBot.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait(123): Discord\Discord->handleWsMessage(object Ratchet\RFC6455\Messaging\Message#646, object Ratchet\Client\WebSocket#1873) [] [] [2021-12-04T16:07:22.686207+00:00] DiscordThread.CRITICAL: #12 /home/container/plugins/DiscordBot.phar/vendor/ratchet/pawl/src/WebSocket(72): Ratchet\Client\WebSocket->emit(string[7] message, array[2]) [] [] [2021-12-04T16:07:22.686254+00:00] DiscordThread.CRITICAL: #13 /home/container/plugins/DiscordBot.phar/vendor/ratchet/rfc6455/src/Messaging/MessageBuffer(248): Ratchet\Client\WebSocket->Ratchet\Client\{closure}(object Ratchet\RFC6455\Messaging\Message#646, object Ratchet\RFC6455\Messaging\MessageBuffer#1773) [] [] [2021-12-04T16:07:22.686301+00:00] DiscordThread.CRITICAL: #14 /home/container/plugins/DiscordBot.phar/vendor/ratchet/rfc6455/src/Messaging/MessageBuffer(194): Ratchet\RFC6455\Messaging\MessageBuffer->processData(string[969] .~..{"t":"MESSAGE_CREATE","s":15204,"op":0,"d":{"webhook_id":"605542616540381184) [] [] [2021-12-04T16:07:22.686347+00:00] DiscordThread.CRITICAL: #15 /home/container/plugins/DiscordBot.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait(123): Ratchet\RFC6455\Messaging\MessageBuffer->onData(string[969] .~..{"t":"MESSAGE_CREATE","s":15204,"op":0,"d":{"webhook_id":"605542616540381184) [] [] [2021-12-04T16:07:22.686393+00:00] DiscordThread.CRITICAL: #16 /home/container/plugins/DiscordBot.phar/vendor/react/stream/src/Util(71): Evenement\EventEmitter->emit(string[4] data, array[1]) [] [] [2021-12-04T16:07:22.686440+00:00] DiscordThread.CRITICAL: #17 /home/container/plugins/DiscordBot.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait(123): React\Stream\Util::React\Stream\{closure}(string[969] .~..{"t":"MESSAGE_CREATE","s":15204,"op":0,"d":{"webhook_id":"605542616540381184) [] [] [2021-12-04T16:07:22.686497+00:00] DiscordThread.CRITICAL: #18 /home/container/plugins/DiscordBot.phar/vendor/react/stream/src/DuplexResourceStream(196): Evenement\EventEmitter->emit(string[4] data, array[1]) [] [] [2021-12-04T16:07:22.686546+00:00] DiscordThread.CRITICAL: #19 /home/container/plugins/DiscordBot.phar/vendor/react/event-loop/src/StreamSelectLoop(245): React\Stream\DuplexResourceStream->handleData(resource Resource id #715) [] [] [2021-12-04T16:07:22.686592+00:00] DiscordThread.CRITICAL: #20 /home/container/plugins/DiscordBot.phar/vendor/react/event-loop/src/StreamSelectLoop(212): React\EventLoop\StreamSelectLoop->waitForStreamActivity(integer 49999) [] [] [2021-12-04T16:07:22.686638+00:00] DiscordThread.CRITICAL: #21 /home/container/plugins/DiscordBot.phar/vendor/team-reflex/discord-php/src/Discord/Discord(1368): React\EventLoop\StreamSelectLoop->run() [] [] [2021-12-04T16:07:22.686685+00:00] DiscordThread.CRITICAL: #22 /home/container/plugins/DiscordBot.phar/src/Bot/Client(111): Discord\Discord->run() [] [] [2021-12-04T16:07:22.686731+00:00] DiscordThread.CRITICAL: #23 /home/container/plugins/DiscordBot.phar/src/Communication/BotThread(50): JaxkDev\DiscordBot\Bot\Client->__construct(object JaxkDev\DiscordBot\Communication\BotThread#1, array[4]) [] [] [2021-12-04T16:07:22.686778+00:00] DiscordThread.CRITICAL: #24 (): JaxkDev\DiscordBot\Communication\BotThread->run() [] [] [2021-12-04T16:07:22.686961+00:00] DiscordThread.INFO: discord closed [] [] [2021-12-04T16:07:22.687021+00:00] DiscordThread.NOTICE: Discord thread closed. [] []

Debug messages always showing

After this message came out "[Server thread/DEBUG]: [DiscordBot] Handled data dump (1633150437) (39)" the other plugin's will report their debug message on console, pocketmine.yml debug was set at 1.
But after I disable DiscordBot plugin, it went back normal
image

not working

it tells me the Preferences file is messed up or corroded and I don't know how to fix it. (my webhook for discord is valid)

Better description

I cant understand what this plugin do it is a lib or something else? I dont think it is lib since it has token in resources but idk what this plugin do and how do we use this pls we need a better description to understand.

Voice channel room assertion

sometimes it giving this error

Plugin version: 2.1.2
Server version: 4.2.4
PHP version: 8.0.16
Operating system: linux

Error:

 [Server thread/CRITICAL]: AssertionError: "Channel '964259918184079370' shouldn't have room for this member." (EXCEPTION) in "plugins/DiscordBot.phar/src/Plugin/BotCommunicationHandler" at line 182
--- Stack trace ---
  #0 plugins/DiscordBot.phar/src/Plugin/BotCommunicationHandler(105): JaxkDev\DiscordBot\Plugin\BotCommunicationHandler->handleVoiceStateUpdate(object JaxkDev\DiscordBot\Communication\Packets\Discord\VoiceStateUpdate#43870)
  #1 plugins/DiscordBot.phar/src/Plugin/Main(253): JaxkDev\DiscordBot\Plugin\BotCommunicationHandler->handle(object JaxkDev\DiscordBot\Communication\Packets\Discord\VoiceStateUpdate#43870)
  #2 plugins/DiscordBot.phar/src/Plugin/Main(107): JaxkDev\DiscordBot\Plugin\Main->tick(integer 9587)
  #3 pmsrc/src/scheduler/ClosureTask(63): JaxkDev\DiscordBot\Plugin\Main->JaxkDev\DiscordBot\Plugin\{closure}()
  #4 pmsrc/src/scheduler/TaskHandler(117): pocketmine\scheduler\ClosureTask->onRun()
  #5 pmsrc/src/scheduler/TaskScheduler(144): pocketmine\scheduler\TaskHandler->run()
  #6 pmsrc/src/plugin/PluginManager(467): pocketmine\scheduler\TaskScheduler->mainThreadHeartbeat(integer 9587)
  #7 pmsrc/src/Server(1768): pocketmine\plugin\PluginManager->tickSchedulers(integer 9587)
  #8 pmsrc/src/Server(1657): pocketmine\Server->tick()
  #9 pmsrc/src/Server(1046): pocketmine\Server->tickProcessor()
  #10 pmsrc/src/PocketMine(304): pocketmine\Server->__construct(object BaseClassLoader#3, object pocketmine\utils\MainLogger#2, string[9] /root/pk/, string[17] /root/pk/plugins/)
  #11 pmsrc/src/PocketMine(327): pocketmine\server()
  #12 pmsrc(11): require(string[53] phar:///root/pk/PocketMine-MP.phar/src/PocketMine.php)
--- End of exception information ---
[20:41:35.030] [Server thread/EMERGENCY]: An unrecoverable error has occurred and the server has crashed. Creating a crash dump
[20:41:35.045] [Server thread/EMERGENCY]: Please upload the "/root/pk/crashdumps/Thu_Apr_14-20.41.35-UTC_2022.log" file to the Crash Archive and submit the link to the Bug Reporting page. Give as much info as you can.
[20:41:35.411] [Server thread/EMERGENCY]: The crash dump has been automatically submitted to the Crash Archive. You can view it on https://crash.pmmp.io/view/6435441 or use the ID #6435441.
[20:41:35.413] [Server thread/EMERGENCY]: Forcing server shutdown
[20:41:35.413] [Server thread/INFO]: Disabling DiscordBot v2.1.2
[20:41:35.414] [Server thread/INFO]: [DiscordBot] Stopping discord thread gracefully, waiting for discord thread to stop...
[20:41:35.431] [Server thread/INFO]: [DiscordBot] Thread stopped.

crash_dump file
Thu_Apr_14-20.41.35-UTC_2022.log

[PHP8-Crash | Mac] ReactPHP/Promise Timer\Timeout

Only reproducible so far with certain things happening, unsure why / how they link if at all hard to confirm.

could only reproduce on reload's via /reload.

use React\Promise\Timer;
$d = Timer\timeout($this->test("discord.com"), 5/*, $this->client->getLoop()*/)->then(null, null);
private function test(string $uri): \React\Promise\PromiseInterface{
  var_dump("d.test");
  /*$da = ["discord", "com", ""];
  $d = \array_map(
	  'stripcslashes',
	  $da
  );
  
  var_dump("d.i2");
  var_dump($d);
  var_dump("not repro'd");*/
  return new \React\Promise\Promise(function(){});
}

Update seems like its the Timer\timeout() which makes a lot more sense in terms of reproducibility.

Unable to repro on windows where all my debug tools/binaries are so I can't do much just hope someone finds a cause, reports it and it gets fixed.

Note it does not crash the Discord Thread but the entire process/server.

[Issue] Silent disconnect

[09:23:39] [BotThread thread/DEBUG]: [GC] Claimed 5780kb and 4 cycles.
[2021-02-09T09:23:57.769163+00:00] DiscordPHP.DEBUG: sending heartbeat {"seq":196} []
[2021-02-09T09:24:19.413914+00:00] DiscordPHP.WARNING: websocket closed {"op":1006,"reason":"Underlying connection closed"} []
[2021-02-09T09:24:19.414297+00:00] DiscordPHP.WARNING: reconnecting in 2 seconds [] []
[2021-02-09T09:24:21.424781+00:00] DiscordPHP.INFO: starting reconnect {"reconnect_count":1} []
[2021-02-09T09:24:21.436883+00:00] DiscordPHP.HTTP.DEBUG: REQ GET https://discord.com/api/v6/gateway/bot queued [] []
[2021-02-09T09:24:36.479967+00:00] DiscordPHP.HTTP.WARNING: REQ GET https://discord.com/api/v6/gateway/bot failed: Connection to discord.com:443 failed during DNS looku
p: DNS query for discord.com failed: too many retries [] []
[2021-02-09T09:24:36.480436+00:00] DiscordPHP.WARNING: could not retrieve gateway, using default [] []
[2021-02-09T09:24:36.480808+00:00] DiscordPHP.INFO: gateway retrieved and set {"gateway":"wss://gateway.discord.gg/?v=6&encoding=json","session":{"total":1000,"remainin
g":1000,"reset_after":0,"max_concurrency":1}} []
[2021-02-09T09:24:36.481212+00:00] DiscordPHP.INFO: starting connection to websocket {"gateway":"wss://gateway.discord.gg/?v=6&encoding=json"} []
[2021-02-09T09:24:51.519904+00:00] DiscordPHP.ERROR: websocket error {"e":"Connection to gateway.discord.gg:443 failed during DNS lookup: DNS query for gateway.discord.
gg failed: too many retries"} []

And then that's it, no more retries, discord doesn't close its just silent. (No events emitted eg ChannelCreate.)

However the bot can still send messages....

[Improvement] TLS/SSL - cacert.pem

RE: #1

Currently the way around this issue (#8) Is to simply disable the ssl verify options in discords http connector however Its come to light that there is a more secure option this is to ship a valid cacert.pem that can be used instead of disabling the ssl options in the event the current cacert.pem being used (if any) does not have discords gateway cert.

Or more specifically just this extract from cacert.pem (Based on discord.com's cert not the gateway.)

Baltimore CyberTrust Root
=========================
-----BEGIN CERTIFICATE-----
MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
-----END CERTIFICATE-----

Client failed to login/connect within 30 seconds, See log file for details.

Log

DiscordPHP.INFO: starting connection to websocket {"gateway":"wss://gateway.discord.gg/?v=6&encoding=json"} []
[2021-03-06T03:34:41.742302+00:00] DiscordPHP.ERROR: websocket error {"e":"Connection to gateway.discord.gg:443 failed during TLS handshake: Unable to complete TLS handshake: SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed"} []

PHP FD_SETSIZE Size error

Help

[2022-04-10T03:17:56.831031+00:00] DiscordThread.DEBUG: resetting payload count {"count":7} []
[2022-04-10T03:18:19.332043+00:00] DiscordThread.DEBUG: sending heartbeat {"seq":16} []
[2022-04-10T03:18:19.370049+00:00] DiscordThread.DEBUG: received heartbeat ack {"response_time":37.78195381164551} []
[2022-04-10T03:18:56.831128+00:00] DiscordThread.DEBUG: resetting payload count {"count":2} []
[2022-04-10T03:19:00.582114+00:00] DiscordThread.DEBUG: sending heartbeat {"seq":21} []
[2022-04-10T03:19:00.624547+00:00] DiscordThread.DEBUG: received heartbeat ack {"response_time":42.21701622009277} []
[2022-04-10T03:19:41.832229+00:00] DiscordThread.DEBUG: sending heartbeat {"seq":23} []
[2022-04-10T03:19:41.868159+00:00] DiscordThread.DEBUG: received heartbeat ack {"response_time":35.691022872924805} []
[2022-04-10T03:19:56.831242+00:00] DiscordThread.DEBUG: resetting payload count {"count":2} []
[2022-04-10T03:20:23.082494+00:00] DiscordThread.DEBUG: sending heartbeat {"seq":24} []
[2022-04-10T03:20:23.118790+00:00] DiscordThread.DEBUG: received heartbeat ack {"response_time":35.70389747619629} []
[2022-04-10T03:20:56.831379+00:00] DiscordThread.DEBUG: resetting payload count {"count":2} []
[2022-04-10T03:21:04.332425+00:00] DiscordThread.DEBUG: sending heartbeat {"seq":27} []
[2022-04-10T03:21:04.364593+00:00] DiscordThread.DEBUG: received heartbeat ack {"response_time":31.93187713623047} []
[2022-04-10T03:21:45.582615+00:00] DiscordThread.DEBUG: sending heartbeat {"seq":28} []
[2022-04-10T03:21:45.614928+00:00] DiscordThread.DEBUG: received heartbeat ack {"response_time":32.01699256896973} []
[2022-04-10T03:21:56.831567+00:00] DiscordThread.DEBUG: resetting payload count {"count":2} []
[2022-04-10T03:22:26.832636+00:00] DiscordThread.DEBUG: sending heartbeat {"seq":29} []
[2022-04-10T03:22:26.865726+00:00] DiscordThread.DEBUG: received heartbeat ack {"response_time":32.807111740112305} []
[2022-04-10T03:22:56.831773+00:00] DiscordThread.DEBUG: resetting payload count {"count":2} []
[2022-04-10T03:23:08.082711+00:00] DiscordThread.DEBUG: sending heartbeat {"seq":32} []
[2022-04-10T03:23:08.116331+00:00] DiscordThread.DEBUG: received heartbeat ack {"response_time":33.40411186218262} []
[2022-04-10T03:23:49.332937+00:00] DiscordThread.DEBUG: sending heartbeat {"seq":33} []
[2022-04-10T03:23:49.367921+00:00] DiscordThread.DEBUG: received heartbeat ack {"response_time":34.750938415527344} []
[2022-04-10T03:23:56.831939+00:00] DiscordThread.DEBUG: resetting payload count {"count":2} []
[2022-04-10T03:24:30.583028+00:00] DiscordThread.DEBUG: sending heartbeat {"seq":33} []
[2022-04-10T03:24:30.619132+00:00] DiscordThread.DEBUG: received heartbeat ack {"response_time":35.83216667175293} []
[2022-04-10T03:24:56.832447+00:00] DiscordThread.DEBUG: resetting payload count {"count":1} []
[2022-04-10T03:25:11.833099+00:00] DiscordThread.DEBUG: sending heartbeat {"seq":34} []
[2022-04-10T03:25:11.865663+00:00] DiscordThread.DEBUG: received heartbeat ack {"response_time":32.29212760925293} []

Intents help

what do i have to change?
image

[2022-04-17T15:14:52.346257+00:00] DiscordThread.DEBUG: TLS cafile set to '/home/container/plugin_data/DiscordBot/cacert.pem' [] []
[2022-04-17T15:14:52.379739+00:00] DiscordThread.DEBUG: BUCKET getoauth2/applications/@me queued REQ GET oauth2/applications/@me [] []
[2022-04-17T15:14:52.387497+00:00] DiscordThread.DEBUG: BUCKET getgateway/bot queued REQ GET gateway/bot [] []
[2022-04-17T15:14:52.480940+00:00] DiscordThread.DEBUG: [GC] Claimed 544kb and 0 cycles. [] []
[2022-04-17T15:14:52.729659+00:00] DiscordThread.DEBUG: REQ GET oauth2/applications/@me successful [] []
[2022-04-17T15:14:52.729735+00:00] DiscordThread.DEBUG: http not checking {"waiting":1,"empty":true} []
[2022-04-17T15:14:52.729777+00:00] DiscordThread.DEBUG: BUCKET getoauth2/applications/@me queue empty [] []
[2022-04-17T15:14:52.752559+00:00] DiscordThread.DEBUG: REQ GET gateway/bot successful [] []
[2022-04-17T15:14:52.752617+00:00] DiscordThread.DEBUG: http not checking {"waiting":0,"empty":true} []
[2022-04-17T15:14:52.752661+00:00] DiscordThread.DEBUG: BUCKET getgateway/bot queue empty [] []
[2022-04-17T15:14:52.752709+00:00] DiscordThread.INFO: gateway retrieved and set {"gateway":"wss://gateway.discord.gg/?v=8&encoding=json","session":{"total":1000,"remaining":1000,"reset_after":0,"max_concurrency":1}} []
[2022-04-17T15:14:52.752740+00:00] DiscordThread.INFO: starting connection to websocket {"gateway":"wss://gateway.discord.gg/?v=8&encoding=json"} []
[2022-04-17T15:14:53.012939+00:00] DiscordThread.INFO: websocket connection has been created [] []
[2022-04-17T15:14:53.013963+00:00] DiscordThread.INFO: received hello [] []
[2022-04-17T15:14:53.014008+00:00] DiscordThread.DEBUG: sending heartbeat {"seq":null} []
[2022-04-17T15:14:53.014064+00:00] DiscordThread.INFO: heartbeat timer initilized {"interval":41250.0} []
[2022-04-17T15:14:53.014090+00:00] DiscordThread.INFO: identifying {"payload":{"op":2,"d":{"token":"xxxxxx","properties":{"$os":"Linux","$browser":"DiscordBot (https://github.com/discord-php/DiscordPHP-HTTP, v8.1.2)","$device":"DiscordBot (https://github.com/discord-php/DiscordPHP-HTTP, v8.1.2)","$referrer":"https://github.com/discord-php/DiscordPHP","$referring_domain":"https://github.com/discord-php/DiscordPHP"},"compress":true,"intents":32767}}} []
[2022-04-17T15:14:53.249912+00:00] DiscordThread.DEBUG: received heartbeat ack {"response_time":235.83197593688965} []
[2022-04-17T15:14:53.439304+00:00] DiscordThread.EMERGENCY: Disallowed intents detected, Please follow the wiki provided (https://github.com/DiscordBot-PMMP/DiscordBot/wiki/Creating-your-discord-bot) and ensure both privileged intents are enabled. [] []
[2022-04-17T15:14:53.439467+00:00] DiscordThread.INFO: discord closed [] []
[2022-04-17T15:14:53.439518+00:00] DiscordThread.NOTICE: Discord thread closed. [] []
image

Invite Problem

I believe this to be an issue with servers that have vanity/custom invite codes, as there is no specified "inviter" or creator of the invite.
I might be wrong, however it is the only conclusion I have, as other Discord servers without such features loaded as expected.

The issue is seen here: https://www.toptal.com/developers/hastebin/luneyibepo.yaml

idk what this is

Warning: require_once(/home/SkyBlock/plugins/DiscordBot-master/DiscordBot/vendor/autoload.php): failed to open stream: No such file or directory in /home/SkyBlock/plugins/DiscordBot-master/src/JaxkDev/DiscordBot/Communication/BotThread.php on line 50

Fatal error: require_once(): Failed opening required '/home/SkyBlock/plugins/DiscordBot-master/DiscordBot/vendor/autoload.php' (include_path='.:') in /home/SkyBlock/plugins/DiscordBot-master/src/JaxkDev/DiscordBot/Communication/BotThread.php on line 50

When a user leaves a voice channel with someone else.

Version: DiscordBot 2.1.1

2022-02-11 [00:08:56.873] [Server thread/CRITICAL]: AssertionError: "Voice Channel for leaving member '472325129330753536.346938303683231744' not found in storage." (EXCEPTION) in "plugins/DiscordBot_2.1.1.phar/src/Plugin/BotCommunicationHandler" at line 154
--- Stack trace ---
  #0 plugins/DiscordBot_2.1.1.phar/src/Plugin/BotCommunicationHandler(105): JaxkDev\DiscordBot\Plugin\BotCommunicationHandler->handleVoiceStateUpdate(object JaxkDev\DiscordBot\Communication\Packets\Discord\VoiceStateUpdate#123380)
  #1 plugins/DiscordBot_2.1.1.phar/src/Plugin/Main(249): JaxkDev\DiscordBot\Plugin\BotCommunicationHandler->handle(object JaxkDev\DiscordBot\Communication\Packets\Discord\VoiceStateUpdate#123380)
  #2 plugins/DiscordBot_2.1.1.phar/src/Plugin/Main(107): JaxkDev\DiscordBot\Plugin\Main->tick(integer 920)
  #3 pmsrc/src/scheduler/ClosureTask(63): JaxkDev\DiscordBot\Plugin\Main->JaxkDev\DiscordBot\Plugin\{closure}()
  #4 pmsrc/src/scheduler/TaskHandler(117): pocketmine\scheduler\ClosureTask->onRun()
  #5 pmsrc/src/scheduler/TaskScheduler(141): pocketmine\scheduler\TaskHandler->run()
  #6 pmsrc/src/plugin/PluginManager(466): pocketmine\scheduler\TaskScheduler->mainThreadHeartbeat(integer 920)
  #7 pmsrc/src/Server(1768): pocketmine\plugin\PluginManager->tickSchedulers(integer 920)
  #8 pmsrc/src/Server(1657): pocketmine\Server->tick()
  #9 pmsrc/src/Server(1046): pocketmine\Server->tickProcessor()
  #10 pmsrc/src/PocketMine(304): pocketmine\Server->__construct(object BaseClassLoader#3, object pocketmine\utils\MainLogger#2, string[45] /home/edwinyoo44/MinecraftBEServer/pmmp_test/, string[53] /home/edwinyoo44/MinecraftBEServer/pmmp_test/plugins/)
  #11 pmsrc/src/PocketMine(327): pocketmine\server()
  #12 pmsrc(11): require(string[95] phar:///home/edwinyoo44/MinecraftBEServer/pmmp_test/PocketMine-MP_4.2.0.phar/src)
--- End of exception information ---

setup and join error

hi i have an error if i join

Server|CRITICAL > ErrorException: "Undefined offset: 1" (EXCEPTION) in "plugins/DiscordBot_v1_0_0.phar/src/JaxkDev/DiscordBot/Plugin/Handlers/PocketMineEventHandler" at line 46

i setup the bot in discord dev then i save the token in config and the channel id in events.

with https://botghost.com/dashboard/ i make the bot online

can you help me plz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.