1
|
|
|
<?php |
2
|
|
|
namespace Sovereign\Service; |
3
|
|
|
|
4
|
|
|
use League\Container\ServiceProvider\AbstractServiceProvider; |
5
|
|
|
use League\Container\ServiceProvider\BootableServiceProviderInterface; |
6
|
|
|
|
7
|
|
|
class SystemPluginServiceProvider extends AbstractServiceProvider implements BootableServiceProviderInterface |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* The provides array is a way to let the container |
11
|
|
|
* know that a service is provided by this service |
12
|
|
|
* provider. Every service that is registered via |
13
|
|
|
* this service provider must have an alias added |
14
|
|
|
* to this array or it will be ignored. |
15
|
|
|
* |
16
|
|
|
* @var array |
17
|
|
|
*/ |
18
|
|
|
protected $provides = []; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* In much the same way, this method has access to the container |
22
|
|
|
* itself and can interact with it however you wish, the difference |
23
|
|
|
* is that the boot method is invoked as soon as you register |
24
|
|
|
* the service provider with the container meaning that everything |
25
|
|
|
* in this method is eagerly loaded. |
26
|
|
|
* |
27
|
|
|
* If you wish to apply inflectors or register further service providers |
28
|
|
|
* from this one, it must be from a bootable service provider like |
29
|
|
|
* this one, otherwise they will be ignored. |
30
|
|
|
*/ |
31
|
|
|
public function boot() |
32
|
|
|
{ |
33
|
|
|
$app = $this->getContainer()->get('app'); |
34
|
|
|
|
35
|
|
|
// onMessage plugins |
36
|
|
|
$app->addPlugin('onMessage', 'about', "\\Sovereign\\Plugins\\onMessage\\about", 1, "Shows information about the bot and it's creator", '', null); |
37
|
|
|
$app->addPlugin('onMessage', 'auth', "\\Sovereign\\Plugins\\onMessage\\auth", 1, 'Authenticates you against a login with certain restrictions', '<authCode>', null); |
38
|
|
|
$app->addPlugin('onMessage', 'char', "\\Sovereign\\Plugins\\onMessage\\char", 1, 'Fetches data from EVE-KILL about a character', '<characterName>', null); |
39
|
|
|
$app->addPlugin('onMessage', 'coinflip', "\\Sovereign\\Plugins\\onMessage\\coinflip", 1, 'Flips a coin, and gives you the results', '', null); |
40
|
|
|
$app->addPlugin('onMessage', 'config', "\\Sovereign\\Plugins\\onMessage\\config", 1, "Lets you configure parts of the bot, but only if you're admin", '', null); |
41
|
|
|
$app->addPlugin('onMessage', 'corp', "\\Sovereign\\Plugins\\onMessage\\corp", 1, 'Fetches data from EVE-KILL about a corporation', '<corporationName>', null); |
42
|
|
|
$app->addPlugin('onMessage', 'eightball', "\\Sovereign\\Plugins\\onMessage\\eightball", 1, 'Shakes the eight ball, and gives you a reply', '', null); |
43
|
|
|
$app->addPlugin('onMessage', 'eb', "\\Sovereign\\Plugins\\onMessage\\eightball", 1, 'Shakes the eight ball, and gives you a reply', '', null); |
44
|
|
|
$app->addPlugin('onMessage', 'guilds', "\\Sovereign\\Plugins\\onMessage\\guilds", 1, 'Tells you what guilds (Server) the bot is on', '', null); |
45
|
|
|
$app->addPlugin('onMessage', 'item', "\\Sovereign\\Plugins\\onMessage\\item", 1, 'Shows you all the information available in the database, for an item', '<itemName>', null); |
46
|
|
|
$app->addPlugin('onMessage', 'join', "\\Sovereign\\Plugins\\onMessage\\join", 1, 'Tells you the oauth invite link', '', null); |
47
|
|
|
$app->addPlugin('onMessage', 'meme', "\\Sovereign\\Plugins\\onMessage\\meme", 1, 'Dank memes!', '', null); |
48
|
|
|
$app->addPlugin('onMessage', 'pc', "\\Sovereign\\Plugins\\onMessage\\pc", 1, 'Lets you check prices of items in EVE. (Global)', '<itemName>', null); |
49
|
|
|
$app->addPlugin('onMessage', 'amarr', "\\Sovereign\\Plugins\\onMessage\\pc", 1, 'Lets you check prices of items in EVE. (Amarr)', '<itemName>', null); |
50
|
|
|
$app->addPlugin('onMessage', 'jita', "\\Sovereign\\Plugins\\onMessage\\pc", 1, 'Lets you check prices of items in EVE. (Jita)', '<itemName>', null); |
51
|
|
|
$app->addPlugin('onMessage', 'dodixie', "\\Sovereign\\Plugins\\onMessage\\pc", 1, 'Lets you check prices of items in EVE. (Dodixie)', '<itemName>', null); |
52
|
|
|
$app->addPlugin('onMessage', 'hek', "\\Sovereign\\Plugins\\onMessage\\pc", 1, 'Lets you check prices of items in EVE. (Hek)', '<itemName>', null); |
53
|
|
|
$app->addPlugin('onMessage', 'rens', "\\Sovereign\\Plugins\\onMessage\\pc", 1, 'Lets you check prices of items in EVE. (Rens)', '<itemName>', null); |
54
|
|
|
$app->addPlugin('onMessage', 'porn', "\\Sovereign\\Plugins\\onMessage\\porn", 1, 'Returns a picture/gif from one of many Imgur categories', '<category>', null); |
55
|
|
|
$app->addPlugin('onMessage', 'time', "\\Sovereign\\Plugins\\onMessage\\time", 1, 'Tells you the current EVE Time and time in various other timezones', '', null); |
56
|
|
|
$app->addPlugin('onMessage', 'tq', "\\Sovereign\\Plugins\\onMessage\\tq", 1, 'Tells you the current status of Tranquility', '', null); |
57
|
|
|
$app->addPlugin('onMessage', 'user', "\\Sovereign\\Plugins\\onMessage\\user", 1, 'Tells you discord information on a user. Including when the bot last saw them, saw them speak, and what they were last playing', '<discordName>', null); |
58
|
|
|
$app->addPlugin('onMessage', 'wolf', "\\Sovereign\\Plugins\\onMessage\\wolf", 1, 'Asks wolframAlpha a question, and returns the result', '<question>', null); |
59
|
|
|
$app->addPlugin('onMessage', 'help', "\\Sovereign\\Plugins\\onMessage\\help", 1, 'Shows helpful information about all the plugins available', null, null); |
60
|
|
|
$app->addPlugin('onMessage', 'memory', "\\Sovereign\\Plugins\\onMessage\\memory", 3, 'Triggers garbage collection', null, null); |
61
|
|
|
|
62
|
|
|
// onTimer plugins |
63
|
|
|
$app->addPlugin('onTimer', 'memory', "\\Sovereign\\Plugins\\onTimer\\memory", 1, '', '', 1800); |
64
|
|
|
$app->addPlugin('onTimer', 'jabberPingsTheCulture', "\\Sovereign\\Plugins\\onTimer\\jabberPingsTheCulture", 1, '', '', 5); |
65
|
|
|
$app->addPlugin('onTimer', 'kills', "\\Sovereign\\Plugins\\onTimer\\kills", 1, '', '', 15); |
66
|
|
|
|
67
|
|
|
// onVoice plugins |
68
|
|
|
$app->addPlugin('onVoice', 'reapers', "\\Sovereign\\Plugins\\onVoice\\reapers", 1, 'Plays a random quote from Sovereign', '', null); |
69
|
|
|
$app->addPlugin('onVoice', 'horn', "\\Sovereign\\Plugins\\onVoice\\horn", 1, 'Horns. Just horns..', '', null); |
70
|
|
|
$app->addPlugin('onVoice', 'warnings', "\\Sovereign\\Plugins\\onVoice\\warnings", 1, 'Plays a random warning sound from EVE-Online', '', null); |
71
|
|
|
$app->addPlugin('onVoice', 'unleashthe90s', "\\Sovereign\\Plugins\\onVoice\\unleashthe90s", 1, 'Plays a random 90s song', '', null); |
72
|
|
|
$app->addPlugin('onVoice', 'radio90s', "\\Sovereign\\Plugins\\onVoice\\radio90s", 1, 'Keeps on playing 90s songs, till you go !stop', '', null); |
73
|
|
|
$app->addPlugin('onVoice', 'radio', "\\Sovereign\\Plugins\\onVoice\\radio", 1, 'Keeps on playing a Radio station, till you go !stop', '', null); |
74
|
|
|
|
75
|
|
|
// Attempt to register any configured service providers |
76
|
|
|
$config = $this->getContainer()->get('config'); |
77
|
|
|
$providers = $config->getAll('serviceproviders'); |
78
|
|
|
if (!empty($providers)) { |
79
|
|
|
foreach ($providers as $class) { |
80
|
|
|
$this->getContainer()->addServiceProvider($class); |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* This is where the magic happens, within the method you can |
87
|
|
|
* access the container and register or retrieve anything |
88
|
|
|
* that you need to, but remember, every alias registered |
89
|
|
|
* within this method must be declared in the `$provides` array. |
90
|
|
|
*/ |
91
|
|
|
public function register() { } |
92
|
|
|
} |
93
|
|
|
|