invalid hex error
This commit is contained in:
parent
06693b9b34
commit
4e7b7a6ee5
@ -637,9 +637,21 @@ namespace NadekoBot.Modules.Searches
|
||||
color = color?.Trim().Replace("#", "");
|
||||
if (string.IsNullOrWhiteSpace(color))
|
||||
return;
|
||||
ImageSharp.Color clr;
|
||||
try
|
||||
{
|
||||
clr = ImageSharp.Color.FromHex(color);
|
||||
}
|
||||
catch
|
||||
{
|
||||
await ReplyErrorLocalized("hex_invalid").ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var img = new ImageSharp.Image(50, 50);
|
||||
|
||||
img.BackgroundColor(ImageSharp.Color.FromHex(color));
|
||||
img.BackgroundColor(clr);
|
||||
|
||||
await Context.Channel.SendFileAsync(img.ToStream(), $"{color}.png").ConfigureAwait(false);
|
||||
}
|
||||
|
@ -93,16 +93,11 @@ namespace NadekoBot.Services.Administration
|
||||
var beforeRoleName = GetRoleName(beforeVch);
|
||||
var beforeRole = guild.Roles.FirstOrDefault(x => x.Name == beforeRoleName);
|
||||
if (beforeRole != null)
|
||||
try
|
||||
{
|
||||
_log.Info("Removing role " + beforeRoleName + " from user " + user.Username);
|
||||
await user.RemoveRoleAsync(beforeRole).ConfigureAwait(false);
|
||||
await Task.Delay(200).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.Warn(ex);
|
||||
}
|
||||
}
|
||||
var afterVch = after.VoiceChannel;
|
||||
if (afterVch != null && guild.AFKChannel?.Id != afterVch.Id)
|
||||
@ -130,7 +125,7 @@ namespace NadekoBot.Services.Administration
|
||||
.ConfigureAwait(false);
|
||||
await Task.Delay(50).ConfigureAwait(false);
|
||||
}
|
||||
_log.Warn("Adding role " + roleToAdd.Name + " to user " + user.Username);
|
||||
_log.Info("Adding role " + roleToAdd.Name + " to user " + user.Username);
|
||||
await user.AddRoleAsync(roleToAdd).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
@ -534,6 +534,7 @@
|
||||
"searches_hashtag_error": "Failed finding a definition for that tag.",
|
||||
"searches_height_weight": "Height/Weight",
|
||||
"searches_height_weight_val": "{0}m/{1}kg",
|
||||
"searches_hex_invalid": "Invalid color specified.",
|
||||
"searches_humidity": "Humidity",
|
||||
"searches_image_search_for": "Image search for:",
|
||||
"searches_imdb_fail": "Failed to find that movie.",
|
||||
|
Loading…
Reference in New Issue
Block a user