Translate !stats
This commit is contained in:
parent
33829e91bc
commit
60e36daaec
5 changed files with 240 additions and 13 deletions
|
@ -81,6 +81,10 @@
|
|||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Role.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Localization\Stats.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Stats.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="Localization\Ship.Designer.cs">
|
||||
|
@ -136,5 +140,10 @@
|
|||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Role.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Localization\Stats.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Stats.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -3,24 +3,24 @@ using System.Linq;
|
|||
using System.Threading.Tasks;
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Geekbot.Core;
|
||||
using Geekbot.Core.CommandPreconditions;
|
||||
using Geekbot.Core.Database;
|
||||
using Geekbot.Core.ErrorHandling;
|
||||
using Geekbot.Core.Extensions;
|
||||
using Geekbot.Core.GuildSettingsManager;
|
||||
using Geekbot.Core.Levels;
|
||||
|
||||
namespace Geekbot.Bot.Commands.User
|
||||
{
|
||||
public class Stats : ModuleBase
|
||||
public class Stats : GeekbotCommandBase
|
||||
{
|
||||
private readonly IErrorHandler _errorHandler;
|
||||
private readonly ILevelCalc _levelCalc;
|
||||
private readonly DatabaseContext _database;
|
||||
|
||||
public Stats(DatabaseContext database, IErrorHandler errorHandler, ILevelCalc levelCalc)
|
||||
public Stats(DatabaseContext database, IErrorHandler errorHandler, ILevelCalc levelCalc, IGuildSettingsManager guildSettingsManager) : base(errorHandler, guildSettingsManager)
|
||||
{
|
||||
_database = database;
|
||||
_errorHandler = errorHandler;
|
||||
_levelCalc = levelCalc;
|
||||
}
|
||||
|
||||
|
@ -67,23 +67,23 @@ namespace Geekbot.Bot.Commands.User
|
|||
e.GuildId.Equals(Context.Guild.Id.AsLong()) &&
|
||||
e.UserId.Equals(userInfo.Id.AsLong()));
|
||||
|
||||
eb.AddInlineField("Discordian Since",
|
||||
eb.AddInlineField(Localization.Stats.OnDiscordSince,
|
||||
$"{createdAt.Day}.{createdAt.Month}.{createdAt.Year} ({age} days)")
|
||||
.AddInlineField("Joined Server",
|
||||
.AddInlineField(Localization.Stats.JoinedServer,
|
||||
$"{joinedAt.Day}.{joinedAt.Month}.{joinedAt.Year} ({joinedDayAgo} days)")
|
||||
.AddInlineField("Karma", karma?.Karma ?? 0)
|
||||
.AddInlineField("Level", level)
|
||||
.AddInlineField("Messages Sent", messages)
|
||||
.AddInlineField("Server Total", $"{percent}%");
|
||||
.AddInlineField(Localization.Stats.Karma, karma?.Karma ?? 0)
|
||||
.AddInlineField(Localization.Stats.Level, level)
|
||||
.AddInlineField(Localization.Stats.MessagesSent, messages)
|
||||
.AddInlineField(Localization.Stats.ServerTotal, $"{percent}%");
|
||||
|
||||
if (correctRolls != null) eb.AddInlineField("Guessed Rolls", correctRolls.Rolls);
|
||||
if (cookies > 0) eb.AddInlineField("Cookies", cookies);
|
||||
if (correctRolls != null) eb.AddInlineField(Localization.Stats.GuessedRolls, correctRolls.Rolls);
|
||||
if (cookies > 0) eb.AddInlineField(Localization.Stats.Cookies, cookies);
|
||||
|
||||
await ReplyAsync("", false, eb.Build());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
await _errorHandler.HandleCommandException(e, Context);
|
||||
await ErrorHandler.HandleCommandException(e, Context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
135
src/Bot/Localization/Stats.Designer.cs
generated
Normal file
135
src/Bot/Localization/Stats.Designer.cs
generated
Normal file
|
@ -0,0 +1,135 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Geekbot.Bot.Localization {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Stats {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Stats() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Geekbot.Bot.Localization.Stats", typeof(Stats).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Cookies.
|
||||
/// </summary>
|
||||
internal static string Cookies {
|
||||
get {
|
||||
return ResourceManager.GetString("Cookies", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Guessed Rolls.
|
||||
/// </summary>
|
||||
internal static string GuessedRolls {
|
||||
get {
|
||||
return ResourceManager.GetString("GuessedRolls", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Joined Server.
|
||||
/// </summary>
|
||||
internal static string JoinedServer {
|
||||
get {
|
||||
return ResourceManager.GetString("JoinedServer", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Karma.
|
||||
/// </summary>
|
||||
internal static string Karma {
|
||||
get {
|
||||
return ResourceManager.GetString("Karma", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Level.
|
||||
/// </summary>
|
||||
internal static string Level {
|
||||
get {
|
||||
return ResourceManager.GetString("Level", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Messages Sent.
|
||||
/// </summary>
|
||||
internal static string MessagesSent {
|
||||
get {
|
||||
return ResourceManager.GetString("MessagesSent", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to On Discord Since.
|
||||
/// </summary>
|
||||
internal static string OnDiscordSince {
|
||||
get {
|
||||
return ResourceManager.GetString("OnDiscordSince", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Server Total.
|
||||
/// </summary>
|
||||
internal static string ServerTotal {
|
||||
get {
|
||||
return ResourceManager.GetString("ServerTotal", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
38
src/Bot/Localization/Stats.de-ch.resx
Normal file
38
src/Bot/Localization/Stats.de-ch.resx
Normal file
|
@ -0,0 +1,38 @@
|
|||
<root>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="ServerTotal" xml:space="preserve">
|
||||
<value>Server Total</value>
|
||||
</data>
|
||||
<data name="OnDiscordSince" xml:space="preserve">
|
||||
<value>Uf Discord siit</value>
|
||||
</data>
|
||||
<data name="MessagesSent" xml:space="preserve">
|
||||
<value>Nachrichte versendet</value>
|
||||
</data>
|
||||
<data name="Level" xml:space="preserve">
|
||||
<value>Level</value>
|
||||
</data>
|
||||
<data name="Karma" xml:space="preserve">
|
||||
<value>Karma</value>
|
||||
</data>
|
||||
<data name="JoinedServer" xml:space="preserve">
|
||||
<value>Server Bitrette</value>
|
||||
</data>
|
||||
<data name="GuessedRolls" xml:space="preserve">
|
||||
<value>Grateni Rolls</value>
|
||||
</data>
|
||||
<data name="Cookies" xml:space="preserve">
|
||||
<value>Guetzli</value>
|
||||
</data>
|
||||
</root>
|
45
src/Bot/Localization/Stats.resx
Normal file
45
src/Bot/Localization/Stats.resx
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="OnDiscordSince" xml:space="preserve">
|
||||
<value>On Discord Since</value>
|
||||
</data>
|
||||
<data name="JoinedServer" xml:space="preserve">
|
||||
<value>Joined Server</value>
|
||||
</data>
|
||||
<data name="Karma" xml:space="preserve">
|
||||
<value>Karma</value>
|
||||
</data>
|
||||
<data name="Level" xml:space="preserve">
|
||||
<value>Level</value>
|
||||
</data>
|
||||
<data name="MessagesSent" xml:space="preserve">
|
||||
<value>Messages Sent</value>
|
||||
</data>
|
||||
<data name="ServerTotal" xml:space="preserve">
|
||||
<value>Server Total</value>
|
||||
</data>
|
||||
<data name="GuessedRolls" xml:space="preserve">
|
||||
<value>Guessed Rolls</value>
|
||||
</data>
|
||||
<data name="Cookies" xml:space="preserve">
|
||||
<value>Cookies</value>
|
||||
</data>
|
||||
</root>
|
Loading…
Reference in a new issue