Download the PHP package eurobertics/nebucord without Composer
On this page you can find all versions of the php package eurobertics/nebucord. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download eurobertics/nebucord
More information about eurobertics/nebucord
Files in eurobertics/nebucord
Package nebucord
Short Description A full featured Discord WebSocket and REST API.
License GPL-3.0-or-later
Informations about the package nebucord
Nebucord - Discord WebSocket and REST API
This is another implementation of the Discord API. It implements an HTTP WebSocket client
as well as a REST API.
An actual in use sample can be found on our Discord server: Nebulatien
If you need help or have questions, don't hestiate to contact Me. Best done if you join the above mentioned Discord server or (if you found something) create an issue in Github. Also pull request for fixes of course are welcome.
Of course not fully finished is it still able to do the most important things. This includes:
-
Nebucord WebSocket API
- Setup and run bot(s)
- Set status for bots
- Simple control commands
- Callback classes to intercept Discord gateway events
- Changing default internal command behaviours
- Setting user id's for bot controlling
- Configurable by parameter or by .ini file
- Customable gateway intents
- Application and interactions API
-
Nebucord REST API
- Model oriented interface on data receiving
- Application and interactions API
- Followup Messages for interactions
- Complete Discord REST API
- Configurable by parameter or by .ini file
- What's missing
- Many error checking
- Way more better logging and debugging options
- Multithreading (if applicable, thanks to bitnykk for the idea)
Default and available parameters
Parameter | Config name | INI config name | Default value |
---|---|---|---|
Bot token | token | bottoken | (string)empty |
ACL user snowflakes | ctrluser | acl | (array)[] |
WS connection retries | wsretries | websocket.retries | (integer)3 |
Default GW intent bitmask* | intents | intents.* | (integer)3276541 / (boolean)true* |
DM on failures | dmonfailures | websocket.dmonfailures | (boolean)true |
*Note:
The intent bitmask defaults to be everything is true except GUILD_MEMBERS
, GUILD_PRESENCES
,
GUILD_MESSAGES
and MESSAGE_CONTENT
.
These four options has to be manual set to true
and they have to be activated in the Bot
preferences on the Discord application management webpage.
The bitmask is 3276799
if everything set to true or for config as parameter.
Note:
Configuration by parameter has priority to configuration by .ini file.
Requirements
Additional Composer packages are required in order to run Nebucord.
Of course these can also be installed without Composer, but you have
to include the SPL autoloader of the packages as well.
The recommended way is to use Composer.
Package informations:
Install
By composer:
By Docker (more information can be found on Nebucord Docker Hub):
By GitHub Packages (more information can be found on GitHub Pulling container images):
Note:
If you want use .ini configuration, you have to put your .ini File (nebucord.ini
i. e.) in the mounted
directory for your Docker instance and set the path to the path of the docker working directory.
You can find more information about this on the Nebucord Docker Hub Page.
By GIT:
Simple clone this repository and use the native autoloader file in ./src Directory.
Note: If you use the library without composer, you just can include the native autoloader:
Note: You have to include the native autoloader of the dependencie packages as well. See package dependencies above.
Example usage - WebSocket API
The WebSocket API is designed to run as a PHP CLI program.
Usage websocket API, minimalistic example:
'your_bot_token': The auth token of your bot (from the Discord Dev-Portal)
'controluser-snowflake': The snowflake of Discord user(s) who can issue control commands such like 'shutdown' to the bot.
Of course this only starts the bot and this one sits there and does nothing.
A more complex example:
The above example prints out every message which was seen by the bot (based on the bot roles on the Discord guild). "Seen" means all CREATE_MESSAGE events from the Discord gateway.
Now on a console:
Example usage - REST API
Basic usage for sending a message:
"$message_model" is an object with the answer from the REST gateway.
Basic usage for receiving guild channels:
"$channels" is an array of channel models for processing.
createRESTExecutor()
returns an object which can be re-used for creating REST request.
It is also possible to create a REST request with createRESTAction(string Nebucord_RESTStatus::REST_*, ModelREST $restmodel)
instead of createRESTActionFromArray(string Nebucord_RESTStatus::REST_*, array $restparams)
and pass a predefined ModelREST
object with all params for the REST gateway.
More info
For more information see: Discord Developer Portal