By continuing to use this site, you agree to the Terms of Service of this website, including usage of cookies.

OK, Don't show this again

A central API plugin to bring discord features to pocketmine plugins!
version 3.0.2
Approved
Direct Download How to install?
Switch version
167 Downloads / 4318 Total
5 Reviews
Plugin Description §

About

DiscordBot is a pocketmine plugin that provides an extensive API for plugin developers to interact with discord creating endless possibilities.

Please note that this plugin offers no standalone features, It is a central API plugin for external plugins to use/depend on.

such as https://poggit.pmmp.io/p/ChatBridge

API Documentation

Unfortunately its formatting is very weird on poggit please visit https://github.com/DiscordBot-PMMP/DiscordBot/blob/3.0.1/API.md for API documentation

Plugin Structure

This is a very complicated plugin when looked at but its essentially broken down into 4 parts.

Part 1, The plugin

The plugin interacts directly with the pocketmine server and sets up a child thread to start the connection to discord, its also the section responsible for handling API requests from other plugins and emitting events, providing data etc to other plugins.

Part 2, The thread

This 'discord thread' is responsible for keeping a live connection to discords gateway so we can receive and pass on events back to the plugin base. We also execute API requests sent from the plugin base here and return a result in the near future when discord sends a response to our API request.

Technical note, The thread is completely independent of the Main thread and pocketmine so collisions between my composer dependencies and anything else is impossible.

Part 3, The composer libs

This part is the biggest part of the plugin that works in the background inside the discord thread, It's a collection of third part libraries including DiscordPHP, React libraries, Monolog and much more.

Note you should NEVER be using or even looking at these libraries, they are not registered in the BaseClassLoader.

Part 4, Promise API

The 'face' of the plugin, using a shaded library (https://github.com/reactphp/promise/tree/v2.9.0) the plugin provides a 'promise' API which means plugins can make requests to do certain things like sendMessage or createRole and the plugin will send back a promise.

A promise is sent back because we can't return instantly whether it was a success or not because we have to send it to the Discord Thread which then sends it to discords gateway(/api for some api methods) and then we have to wait for a response then return the response to the plugin/main thread and THEN we can tell you if it was a success or not.

So you can essentially attach functions to the promise to run when we come back quite a few ticks later with a response.

Hard to explain, go read the API tab if your still interested...

What's new §
  • Network version bumped to 2
  • Fix Modal Text response conversion (#104)
  • Fix TextInput serialization (#103)
  • Fix the activity buttons on presence update event #99
  • Fix the logic error of isThread() on ChannelUpdateEvent (#98, @Laith98Dev)

Major rewrite, please see CHANGELOG.md for more details.

TLDR:

  • Discord Gateway v10 (all new features, including buttons, interactions and popups)
  • PocketMine 5.x support
  • PHP 8.1+ support
  • Fixed composer PHP constraint being 8.1+
  • Resolved #78 - Attachment limits have been adjusted to allow for 'empty' files.
  • Resolved #79 / #80 - Application command replies/messages not being handled, for now handle them as normal messages without reference to command.
  • Fixed #75 - New PMMP PHP binaries not working.
    • Allowed xdebug to be enabled, strong warning is still shown and still not advised though.
  • Adjusted discord snowflake check.
    • Length can be 19 now.
  • /debugdata is now async.
  • Fixed #55 where Message attachment content_type can be null.
  • Addressed #59 where Admins(TBC)/Owner can join a full voice channel.
  • Storage::setTimestamp throws Invalid Argument Exception instead of crashing when timestamp is negative.
  • Fixed #52 (Invites with no inviter would crash the plugin)
  • reactphp/promise finally updated (v2.9.0 includes the PHP8 deprecation Fix)
    • DiscordBot-PMMP/promise is now archived as no longer used in future versions.
  • Fixed #49 (Blank voice channel ID assertion firing)
  • Fixed #50 (Removed assertion for reply messages not having a reference message ID)
  • Fixed #51 (Changed Activity models URL check, discord does not actually check this...)
  • Updated team-reflex/discord-php to v6.0.3
  • PocketMine 4.0 Support
  • getServers() + getUsers() added.
  • getServerBans() deprecated in favour of getBansByServer() (matching other server mapped getters)
  • Removed logging.debug field in config.

PPEyt
Outdated
using v2.1.4
27 Aug 22
BeeAZ-pm-pl
Outdated
using v2.1.2
07 Apr 22
ErikPDev
Outdated
using v2.1.2
07 Apr 22
I. Love. This.
mukeenanyafiq
Outdated
using v2.1.0
09 Dec 21
How do I use this plugin?
SOF3
Staff
09 Dec 21
> Please note that this plugin offers no standalone features, It is a central API plugin for external plugins to use/depend on.
NhanAZ
Outdated
using v2.1.0
08 Dec 21
GGLVXD
Outdated
using v2.0.4
10 Oct 21
add that u can change bot status or idk maybe there is already or im just blind
JaxkDev
Staff
10 Oct 21
API::updateBotPresence Would be what your looking for :)
DidntPot
Outdated
using v2.0.4
03 Oct 21
Very complication for an average person. /shrug
JaxkDev
Staff
03 Oct 21
Good thing it’s not for the average person, it’s for developers to use. While it doesn’t follow a plugins generic sync API, it’s not that different.
HorlandoSR
Outdated
using v2.0.3
06 Sep 21
Nice Work

Reply to review by :

/ 5
Supported API versions
5.0.0
->
5.16.0
Requirements & Enhancements
API token Requirement DiscordBot Token, https://github.com/DiscordBot-PMMP/DiscordBot/wiki/Creating-your-discord-bot
Producers §
  • Collaborators:
    • @JaxkDev
  • Contributors:
    • @D1veer
    • @Laith98Dev
    • @Shelly7w7
License §
Categories:
Developer Tools
General
Miscellaneous
Permissions
Commands
External Internet clients
Asynchronous tasks
Custom threading

You can leave one review per plugin release, and delete or update your review at any time

/ 5
Loading...