CommandFormatException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
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
namespace CharlotteDunois\Livia\Exceptions;
11
12
/**
13
 * Has a descriptive message for a command not having proper format.
14
 */
15
class CommandFormatException extends FriendlyException {
16
    /**
17
     * @param \CharlotteDunois\Livia\Commands\Context  $context
18
     * @internal
19
     */
20
    function __construct(\CharlotteDunois\Livia\Commands\Context $context) {
21
        $prefix = $context->client->getGuildPrefix($context->message->guild);
22
        
23
        parent::__construct('Invalid command usage. The `'.$context->command->name.'` command\'s accepted format is: '.
24
        $context->command->usage($context->command->format, $prefix).'. Use '.\CharlotteDunois\Livia\Commands\Command::anyUsage('help '.$context->command->name, $prefix).' for more information.');
25
    }
26
}
27