diff --git a/src/Toadling.php b/src/Toadling.php index 794137f..e5bf1fe 100644 --- a/src/Toadling.php +++ b/src/Toadling.php @@ -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();