phpcord
Default page for phpcord, a simple discord bot library written in php
General
First of all, please don't mind me for having only sync tRaSh cOdE (if you find any worse mistakes in code which has nothing to do about multithreading, you're welcome to open an Issue telling me how bad I am, but don't tell me it has to be multithreaded, since this library should stay simple).
If you keep getting an error that is similar to PHP Warning: fwrite(): SSL operation failed with code 1. OpenSSL Error messages: error:1420C0CF:SSL routines:ssl_write_internal:protocol is shutdown
You either have to check if you're passing a correct token & intent sum or you might also haven't activated two important toggles on your bot you would have to turn them on:
Go to the Discord Developer Portal select your bot, go to the Bot category and toggle the two buttons below:

Installation
This can be done with or without composer, you can simply download it from github if you don't want to use composer and it's autoloading features.
Composer installation
Just require it by using composer require himmelkreis4865\phpcord
First of all, please don't mind me for having only sync tRaSh cOdE (if you find any worse mistakes in code which has nothing to do about multithreading, you're welcome to open an Issue telling me how bad I am).
Once you downloaded it and extracted the files, drop your files in a folder you like.
Your index (or main bot file) should be place in the same folder as ``src`` to be sure the autoloader's going to do his job. (The default file location is valid)
First steps
In your main file, start with initialising a bot file such as the following example
And that's your first Discord instance! Some explanations:
require_once will add the file to the project, you only have to add Discord.php, it will load the others too.
new Discord(); Here you're creating a Discord instance by passing the SSL options you see above
Additional options (Don't pass them inside of the "ssl" Array:
debug_mode => true will debug most important information when it comes to error tracking
save-log => true will save the logged messages (probably no errors) [INSTABLE]
Login to your bot (...and the gateway)
Once you got a token (after creating an application at Discord Developer Portal) simply login to you bot with the following code
Pass the real token instead of YOUR_TOKEN_HERE please :)
Continuing
For a better instruction, check out the other files, you can do so much cool stuff!
This instruction is still incomplete, more is coming soon....
Last updated