Download the PHP package skinnybot/skinny without Composer
On this page you can find all versions of the php package skinnybot/skinny. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download skinnybot/skinny
More information about skinnybot/skinny
Files in skinnybot/skinny
Package skinny
Short Description A framework to create discord bot in PHP.
License MIT
Homepage https://github.com/SkinnyBot/Skinny
Informations about the package skinny
Skinny Bot
Travis | Coverage | Codacy | StyleCI | Stable Version | Downloads | License |
---|---|---|---|---|---|---|
A framework to create discord bot in PHP using DiscordPHP.
Note
This is the core of the Bot. The skeleton of the application can be found there.
Installation
If you just want to use and/or develop your own bot, you should use the Skinny Skeleton as a base for your project. Installation steps can be found there.
Requirements
- :package: Composer
Documentation
Summary
- Core
- Creating news Modules
- The variable
$message
- The object
$wrapper
- The Module System
- Plugins
- Creating a Plugin with composer
- Creating a Plugin without composer
- Others
- Core plugins list
Core
Creating news Modules
The bot come with a Module system and a Module manager that allow you to create Modules for your custom commands. Your module must implement the Skinny\Module\ModuleInterface
.
Here is the default template for a module, named Basic
for example :
src/Module/Modules/Basic.php
With these 3 functions you can handle every messages on discord :
- Command Message : A normal message in a channel WITH a valid command.
- Private Message : A private message.
- Channel Message : A normal message in a channel WITHOUT a valid command.
For example if we want to do a !say [text]
command, we could do that in the onCommandMessage
function :
Then we need to add this command in the config/commands.php
file :
That's all, you did a !say
command.
The variable $message
This variable is created by the class Skinny\Message\Message and is an array.
For example with the phrase !dev param1 param2 param3 etc
, we will have the following array :
The object $wrapper
The object is an instance of the class Skinny\Network\Wrapper and is used as a wrapper to split all the Discord's classes for a better accessibility and clarity when developing modules.
For example, doing a debug()
on this object would generate the following output :
The Module System
As i said before, this bot implement a Module system. The Module system work like that in debug mode only :
The Module system load the file's contents first, then use preg_replace()
to replace the original class-name with a random one. After that, its create a copy and include it.
When a message is triggered, the module system will do some tests on it to ensure it's a valid message, then it will dispath it into all the loaded modules.
Plugins
Yes, you can create plugins for this bot. While i recommend to create a plugin using composer you can also create a plugin without using composer, it can be usefull when you develop a plugin. You can find the demo plugin named Basic
here.
Creating a Plugin with composer
Creating a plugin with composer is easy. First you must create a composer.json
file like this :
Note : The type
of the composer file must be skinny-plugin
, else your plugin won't work. The hierarchical structure of the files will be like this :
When you have finished to code your plugin, you must of course publish it on Packagist.
Creating a Plugin without composer
When you create a plugin without composer, your plugins must be in the plugins
folder. Let's create the same Basic plugin without composer, the hierarchical structure of the files will be like this :
After you have created your plugin, you must tell to composer to do the dumpautoload
event, so the plugin will be registered in the vendor/skinny-plugins.php
file and it will update your autoloader :
After that, you will need to load the plugin in the config/bootstrap.php
file in your application :
Others
Core plugins list
- Module Plugin The Module plugin is a module that allow you to manage modules with commands. Installed by default in the Skinny Skeleton.
- Basic Plugin This plugin is primary used to show how to create plugin and for testing purpose. Installed by default in the Skinny Skeleton.
Contribute
Follow this guide to contribute
Special Thanks
- Thanks to the CakePHP team and their awesome CakePHP Core classes used to create the plugin system.
All versions of skinny with dependencies
skinnybot/plugin-installer Version ~2.0
charlottedunois/yasmin Version ^0.6.2
envms/fluentpdo Version ^2.1.0
cakephp/chronos Version ^1.2