Add total quotes of a user to !stats
This commit is contained in:
parent
8bd8efa66a
commit
5a50ba5820
4 changed files with 35 additions and 2 deletions
|
@ -54,6 +54,8 @@ namespace Geekbot.Bot.Commands.User
|
|||
?.FirstOrDefault(e => e.GuildId.Equals(Context.Guild.Id.AsLong()) && e.UserId.Equals(userInfo.Id.AsLong()))
|
||||
?.Cookies ?? 0;
|
||||
|
||||
var quotes = _database.Quotes.Count(e => e.GuildId.Equals(Context.Guild.Id.AsLong()) && e.UserId.Equals(userInfo.Id.AsLong()));
|
||||
|
||||
var eb = new EmbedBuilder();
|
||||
eb.WithAuthor(new EmbedAuthorBuilder()
|
||||
.WithIconUrl(userInfo.GetAvatarUrl())
|
||||
|
@ -68,9 +70,9 @@ namespace Geekbot.Bot.Commands.User
|
|||
e.UserId.Equals(userInfo.Id.AsLong()));
|
||||
|
||||
eb.AddInlineField(Localization.Stats.OnDiscordSince,
|
||||
$"{createdAt.Day}.{createdAt.Month}.{createdAt.Year} ({age} days)")
|
||||
$"{createdAt.Day}.{createdAt.Month}.{createdAt.Year} ({age} {Localization.Stats.Days})")
|
||||
.AddInlineField(Localization.Stats.JoinedServer,
|
||||
$"{joinedAt.Day}.{joinedAt.Month}.{joinedAt.Year} ({joinedDayAgo} days)")
|
||||
$"{joinedAt.Day}.{joinedAt.Month}.{joinedAt.Year} ({joinedDayAgo} {Localization.Stats.Days})")
|
||||
.AddInlineField(Localization.Stats.Karma, karma?.Karma ?? 0)
|
||||
.AddInlineField(Localization.Stats.Level, level)
|
||||
.AddInlineField(Localization.Stats.MessagesSent, messages)
|
||||
|
@ -78,6 +80,7 @@ namespace Geekbot.Bot.Commands.User
|
|||
|
||||
if (correctRolls != null) eb.AddInlineField(Localization.Stats.GuessedRolls, correctRolls.Rolls);
|
||||
if (cookies > 0) eb.AddInlineField(Localization.Stats.Cookies, cookies);
|
||||
if (quotes > 0) eb.AddInlineField(Localization.Stats.Quotes, quotes);
|
||||
|
||||
await ReplyAsync("", false, eb.Build());
|
||||
}
|
||||
|
|
18
src/Bot/Localization/Stats.Designer.cs
generated
18
src/Bot/Localization/Stats.Designer.cs
generated
|
@ -69,6 +69,15 @@ namespace Geekbot.Bot.Localization {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Days.
|
||||
/// </summary>
|
||||
internal static string Days {
|
||||
get {
|
||||
return ResourceManager.GetString("Days", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Guessed Rolls.
|
||||
/// </summary>
|
||||
|
@ -123,6 +132,15 @@ namespace Geekbot.Bot.Localization {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Quotes.
|
||||
/// </summary>
|
||||
internal static string Quotes {
|
||||
get {
|
||||
return ResourceManager.GetString("Quotes", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Server Total.
|
||||
/// </summary>
|
||||
|
|
|
@ -35,4 +35,10 @@
|
|||
<data name="Cookies" xml:space="preserve">
|
||||
<value>Guetzli</value>
|
||||
</data>
|
||||
<data name="Days" xml:space="preserve">
|
||||
<value>Täg</value>
|
||||
</data>
|
||||
<data name="Quotes" xml:space="preserve">
|
||||
<value>Quotes</value>
|
||||
</data>
|
||||
</root>
|
|
@ -42,4 +42,10 @@
|
|||
<data name="Cookies" xml:space="preserve">
|
||||
<value>Cookies</value>
|
||||
</data>
|
||||
<data name="Days" xml:space="preserve">
|
||||
<value>Days</value>
|
||||
</data>
|
||||
<data name="Quotes" xml:space="preserve">
|
||||
<value>Quotes</value>
|
||||
</data>
|
||||
</root>
|
Loading…
Reference in a new issue