Move the error embed from /karma into the embad class as a static method so it can be used by other commands as well
This commit is contained in:
parent
3fa8fac867
commit
193a651495
2 changed files with 12 additions and 12 deletions
|
@ -34,7 +34,7 @@ public class Karma
|
|||
KarmaChange.Down => Localization.Karma.CannotChangeOwnDown,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(change), change, null)
|
||||
};
|
||||
return CreateErrorEmbed(string.Format(message, author.Username));
|
||||
return Embed.ErrorEmbed(string.Format(message, author.Username));
|
||||
}
|
||||
|
||||
var timeoutMinutes = 3;
|
||||
|
@ -42,7 +42,7 @@ public class Karma
|
|||
{
|
||||
var remaining = authorRecord.TimeOut.AddMinutes(timeoutMinutes) - DateTimeOffset.Now.ToUniversalTime();
|
||||
var formatedWaitTime = DateLocalization.FormatDateTimeAsRemaining(remaining);
|
||||
return CreateErrorEmbed(string.Format(Localization.Karma.WaitUntill, author.Username, formatedWaitTime));
|
||||
return Embed.ErrorEmbed(string.Format(Localization.Karma.WaitUntill, author.Username, formatedWaitTime));
|
||||
}
|
||||
|
||||
// Get the values for the change direction
|
||||
|
@ -80,16 +80,6 @@ public class Karma
|
|||
eb.AddInlineField(Localization.Karma.Current, targetUserRecord.Karma.ToString());
|
||||
return eb;
|
||||
}
|
||||
|
||||
private Embed CreateErrorEmbed(string errorMessage)
|
||||
{
|
||||
var eb = new Embed()
|
||||
{
|
||||
Description = errorMessage
|
||||
};
|
||||
eb.SetColor(Color.Red);
|
||||
return eb;
|
||||
}
|
||||
|
||||
private async Task<KarmaModel> GetUser(long userId)
|
||||
{
|
||||
|
|
|
@ -124,5 +124,15 @@ namespace Geekbot.Interactions.Embed
|
|||
|
||||
return eb;
|
||||
}
|
||||
|
||||
public static Embed ErrorEmbed(string errorMessage)
|
||||
{
|
||||
var eb = new Embed()
|
||||
{
|
||||
Description = errorMessage
|
||||
};
|
||||
eb.SetColor(System.Drawing.Color.Red);
|
||||
return eb;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue