Пример #1
0
        public Task <ActionResult> RoleColorAsync([Remainder] SocketRole role)
        {
            if (!role.HasColor())
            {
                return(BadRequest("Role does not have a color."));
            }

            return(None(async() =>
            {
                await using var stream = new Rgba32(role.Color.R, role.Color.G, role.Color.B).CreateColorImage();
                await stream.SendFileToAsync(Context.Channel, "role.png", "", false, new EmbedBuilder()
                                             .WithColor(role.Color)
                                             .WithTitle("Role Color")
                                             .WithDescription(new StringBuilder()
                                                              .AppendLine($"**Hex:** {role.Color.ToString().ToUpper()}")
                                                              .AppendLine($"**RGB:** {role.Color.R}, {role.Color.G}, {role.Color.B}")
                                                              .ToString())
                                             .WithImageUrl("attachment://role.png")
                                             .WithCurrentTimestamp()
                                             .Build());
            }));
        }