anonymous//src/Commands/commands/unload.php$0   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 25
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A unload.php$0 ➔ run() 0 3 1
A unload.php$0 ➔ __construct() 0 18 1
1
<?php
2
/**
3
 * Livia
4
 * Copyright 2017-2019 Charlotte Dunois, All Rights Reserved
5
 *
6
 * Website: https://charuru.moe
7
 * License: https://github.com/CharlotteDunois/Livia/blob/master/LICENSE
8
*/
9
10
return function ($client) {
11
    return (new class($client) extends \CharlotteDunois\Livia\Commands\Command {
12
        function __construct(\CharlotteDunois\Livia\Client $client) {
13
            parent::__construct($client, array(
14
                'name' => 'unload',
15
                'aliases' => array('unload-command'),
16
                'group' => 'commands',
17
                'description' => 'Unloads a command.',
18
                'details' => 'The argument must be the name/ID (partial or whole) of a command. Only the bot owner may use this command.',
19
                'examples' => array('enable utils'),
20
                'guildOnly' => false,
21
                'ownerOnly' => true,
22
                'args' => array(
23
                    array(
24
                        'key' => 'command',
25
                        'prompt' => 'Which command would you like to unload?',
26
                        'type' => 'command'
27
                    )
28
                ),
29
                'guarded' => true
30
            ));
31
        }
32
        
33
        function run(\CharlotteDunois\Livia\Commands\Context $context, \ArrayObject $args, bool $fromPattern) {
34
            $args['command']->unload();
35
            return $context->reply('Unloaded the command `'.$args['command']->name.'`.');
36
        }
37
    });
38
};
39