Colors added - Now it MUST work
parent
0b419dfdb9
commit
3b1b7f94d6
|
|
@ -56,15 +56,20 @@ class Toadling
|
|||
if($messageWords[1] !== 'color') {
|
||||
return false;
|
||||
}
|
||||
$color = strtoupper($messageWords[2]);
|
||||
if(preg_match('/^#[0-9A-F]{6}$/', $color) !== 1) {
|
||||
return false;
|
||||
$color = strtolower($messageWords[2]);
|
||||
$colorInt = intval(substr($color, 1), 16);
|
||||
if(preg_match('/^#[0-9a-f]{6}$/', $color) !== 1) {
|
||||
$color = strtolower($color);
|
||||
if(!array_key_exists($color, \Discord\COLORTABLE)) {
|
||||
return false;
|
||||
}
|
||||
$colorInt = \Discord\COLORTABLE[$color];
|
||||
$color = '#'.dechex($colorInt);
|
||||
}
|
||||
$guild = $discord->guilds->get('id', '902654364685074522');
|
||||
$colorRole = $guild->roles->find(function (Role $role) use ($color) {
|
||||
return $role->name === $color;
|
||||
});
|
||||
$colorInt = intval(substr($color, 1), 16);
|
||||
if(null !== $colorRole) {
|
||||
$message->member->addRole($colorRole);
|
||||
$message->delete();
|
||||
|
|
|
|||
Loading…
Reference in New Issue