Add a !neutral command for karma, it does nothing.
This commit is contained in:
parent
eddd005d34
commit
c1b8394e1b
4 changed files with 56 additions and 0 deletions
|
@ -116,6 +116,47 @@ namespace Geekbot.Bot.Commands.User
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Command("neutral", RunMode = RunMode.Async)]
|
||||||
|
[Summary("Do nothing to someones karma")]
|
||||||
|
public async Task Neutral([Summary("@someone")] IUser user)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var actor = await GetUser(Context.User.Id);
|
||||||
|
if (user.Id == Context.User.Id)
|
||||||
|
{
|
||||||
|
await ReplyAsync(string.Format(Localization.Karma.CannotChangeOwnDown, Context.User.Username));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TimeoutFinished(actor.TimeOut))
|
||||||
|
{
|
||||||
|
var formatedWaitTime = DateLocalization.FormatDateTimeAsRemaining(actor.TimeOut.AddMinutes(3));
|
||||||
|
await ReplyAsync(string.Format(Localization.Karma.WaitUntill, Context.User.Username, formatedWaitTime));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var target = await GetUser(user.Id);
|
||||||
|
|
||||||
|
var eb = new EmbedBuilder();
|
||||||
|
eb.WithAuthor(new EmbedAuthorBuilder()
|
||||||
|
.WithIconUrl(user.GetAvatarUrl())
|
||||||
|
.WithName(user.Username));
|
||||||
|
|
||||||
|
eb.WithColor(new Color(138, 219, 146));
|
||||||
|
eb.Title = Localization.Karma.Neutral;
|
||||||
|
eb.AddInlineField(Localization.Karma.By, Context.User.Username);
|
||||||
|
eb.AddInlineField(Localization.Karma.Amount, "0");
|
||||||
|
eb.AddInlineField(Localization.Karma.Current, target.Karma);
|
||||||
|
await ReplyAsync("", false, eb.Build());
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
await ErrorHandler.HandleCommandException(e, Context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private bool TimeoutFinished(DateTimeOffset lastKarma)
|
private bool TimeoutFinished(DateTimeOffset lastKarma)
|
||||||
{
|
{
|
||||||
return lastKarma.AddMinutes(3) > DateTimeOffset.Now;
|
return lastKarma.AddMinutes(3) > DateTimeOffset.Now;
|
||||||
|
|
9
src/Bot/Localization/Karma.Designer.cs
generated
9
src/Bot/Localization/Karma.Designer.cs
generated
|
@ -123,6 +123,15 @@ namespace Geekbot.Bot.Localization {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Neutral Karma.
|
||||||
|
/// </summary>
|
||||||
|
internal static string Neutral {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Neutral", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Sorry {0}, but you have to wait {1} before you can give karma again....
|
/// Looks up a localized string similar to Sorry {0}, but you have to wait {1} before you can give karma again....
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -35,4 +35,7 @@
|
||||||
<data name="Decreased" xml:space="preserve">
|
<data name="Decreased" xml:space="preserve">
|
||||||
<value>Karma gsenkt</value>
|
<value>Karma gsenkt</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Neutral" xml:space="preserve">
|
||||||
|
<value>Neutral Karma</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -42,4 +42,7 @@
|
||||||
<data name="Decreased" xml:space="preserve">
|
<data name="Decreased" xml:space="preserve">
|
||||||
<value>Karma lowered</value>
|
<value>Karma lowered</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Neutral" xml:space="preserve">
|
||||||
|
<value>Neutral Karma</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
Loading…
Reference in a new issue