Merge branch 'rework-localization' into 'master'

Rework Localization

See merge request dbgit/open/geekbot!18
This commit is contained in:
Daan Boerlage 2020-08-14 21:47:44 +00:00
commit 79fb7dece6
57 changed files with 2562 additions and 932 deletions

View file

@ -40,4 +40,110 @@
<ProjectReference Include="..\Core\Core.csproj" />
<ProjectReference Include="..\Web\Web.csproj" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Localization\Ship.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Ship.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Localization\Rank.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Rank.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Localization\Karma.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Karma.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Localization\Internal.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Internal.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Localization\Cookies.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Cookies.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Localization\Roll.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Roll.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Localization\Choose.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Choose.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Localization\Admin.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Admin.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Localization\Quote.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Quote.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Localization\Role.resx">
<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">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>ship.resx</DependentUpon>
</Compile>
<Compile Update="Localization\Rank.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Rank.resx</DependentUpon>
</Compile>
<Compile Update="Localization\Ship.Designer.cs">
<DependentUpon>Ship.resx</DependentUpon>
</Compile>
<Compile Update="Localization\Karma.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Karma.resx</DependentUpon>
</Compile>
<Compile Update="Localization\Internal.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Internal.resx</DependentUpon>
</Compile>
<Compile Update="Localization\Cookies.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Cookies.resx</DependentUpon>
</Compile>
<Compile Update="Localization\Roll.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Roll.resx</DependentUpon>
</Compile>
<Compile Update="Localization\Choose.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Choose.resx</DependentUpon>
</Compile>
<Compile Update="Localization\Admin.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Admin.resx</DependentUpon>
</Compile>
<Compile Update="Localization\Quote.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Quote.resx</DependentUpon>
</Compile>
<Compile Update="Localization\Role.Designer.cs">
<DesignTime>True</DesignTime>
<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>

View file

@ -1,42 +1,40 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Resources;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Discord;
using Discord.Commands;
using Discord.WebSocket;
using Geekbot.Core;
using Geekbot.Core.CommandPreconditions;
using Geekbot.Core.ErrorHandling;
using Geekbot.Core.Extensions;
using Geekbot.Core.GuildSettingsManager;
using Geekbot.Core.Localization;
namespace Geekbot.Bot.Commands.Admin
{
[Group("admin")]
[RequireUserPermission(GuildPermission.Administrator)]
[DisableInDirectMessage]
public class Admin : ModuleBase
public class Admin : GeekbotCommandBase
{
private readonly DiscordSocketClient _client;
private readonly IErrorHandler _errorHandler;
private readonly IGuildSettingsManager _guildSettingsManager;
private readonly ITranslationHandler _translation;
public Admin(DiscordSocketClient client, IErrorHandler errorHandler, IGuildSettingsManager guildSettingsManager, ITranslationHandler translationHandler)
public Admin(DiscordSocketClient client, IErrorHandler errorHandler, IGuildSettingsManager guildSettingsManager) : base(errorHandler, guildSettingsManager)
{
_client = client;
_errorHandler = errorHandler;
_guildSettingsManager = guildSettingsManager;
_translation = translationHandler;
}
[Command("welcome", RunMode = RunMode.Async)]
[Summary("Set a Welcome Message (use '$user' to mention the new joined user).")]
public async Task SetWelcomeMessage([Remainder, Summary("message")] string welcomeMessage)
{
var guild = _guildSettingsManager.GetSettings(Context.Guild.Id);
guild.WelcomeMessage = welcomeMessage;
await _guildSettingsManager.UpdateSettings(guild);
GuildSettings.WelcomeMessage = welcomeMessage;
await GuildSettingsManager.UpdateSettings(GuildSettings);
var formatedMessage = welcomeMessage.Replace("$user", Context.User.Mention);
await ReplyAsync($"Welcome message has been changed\r\nHere is an example of how it would look:\r\n{formatedMessage}");
@ -50,9 +48,8 @@ namespace Geekbot.Bot.Commands.Admin
{
var m = await channel.SendMessageAsync("...");
var guild = _guildSettingsManager.GetSettings(Context.Guild.Id);
guild.WelcomeChannel = channel.Id.AsLong();
await _guildSettingsManager.UpdateSettings(guild);
GuildSettings.WelcomeChannel = channel.Id.AsLong();
await GuildSettingsManager.UpdateSettings(GuildSettings);
await m.DeleteAsync();
@ -60,7 +57,7 @@ namespace Geekbot.Bot.Commands.Admin
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context, "That channel doesn't seem to exist or i don't have write permissions");
await ErrorHandler.HandleCommandException(e, Context, "That channel doesn't seem to exist or i don't have write permissions");
}
}
@ -72,9 +69,8 @@ namespace Geekbot.Bot.Commands.Admin
{
var m = await channel.SendMessageAsync("verifying...");
var guild = _guildSettingsManager.GetSettings(Context.Guild.Id);
guild.ModChannel = channel.Id.AsLong();
await _guildSettingsManager.UpdateSettings(guild);
GuildSettings.ModChannel = channel.Id.AsLong();
await GuildSettingsManager.UpdateSettings(GuildSettings);
var sb = new StringBuilder();
sb.AppendLine("Successfully saved mod channel, you can now do the following");
@ -84,7 +80,7 @@ namespace Geekbot.Bot.Commands.Admin
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context, "That channel doesn't seem to exist or i don't have write permissions");
await ErrorHandler.HandleCommandException(e, Context, "That channel doesn't seem to exist or i don't have write permissions");
}
}
@ -94,20 +90,19 @@ namespace Geekbot.Bot.Commands.Admin
{
try
{
var guild = _guildSettingsManager.GetSettings(Context.Guild.Id);
var modChannel = await GetModChannel(guild.ModChannel.AsUlong());
var modChannel = await GetModChannel(GuildSettings.ModChannel.AsUlong());
if (modChannel == null) return;
guild.ShowLeave = !guild.ShowLeave;
await _guildSettingsManager.UpdateSettings(guild);
await modChannel.SendMessageAsync(guild.ShowLeave
GuildSettings.ShowLeave = !GuildSettings.ShowLeave;
await GuildSettingsManager.UpdateSettings(GuildSettings);
await modChannel.SendMessageAsync(GuildSettings.ShowLeave
? "Saved - now sending messages here when someone leaves"
: "Saved - stopping sending messages here when someone leaves"
);
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
await ErrorHandler.HandleCommandException(e, Context);
}
}
@ -117,48 +112,47 @@ namespace Geekbot.Bot.Commands.Admin
{
try
{
var guild = _guildSettingsManager.GetSettings(Context.Guild.Id);
var modChannel = await GetModChannel(guild.ModChannel.AsUlong());
var modChannel = await GetModChannel(GuildSettings.ModChannel.AsUlong());
if (modChannel == null) return;
guild.ShowDelete = !guild.ShowDelete;
await _guildSettingsManager.UpdateSettings(guild);
await modChannel.SendMessageAsync(guild.ShowDelete
GuildSettings.ShowDelete = !GuildSettings.ShowDelete;
await GuildSettingsManager.UpdateSettings(GuildSettings);
await modChannel.SendMessageAsync(GuildSettings.ShowDelete
? "Saved - now sending messages here when someone deletes a message"
: "Saved - stopping sending messages here when someone deletes a message"
);
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
await ErrorHandler.HandleCommandException(e, Context);
}
}
[Command("setlang", RunMode = RunMode.Async)]
[Summary("Change the bots language")]
public async Task SetLanguage([Summary("language")] string languageRaw)
public async Task SetLanguage([Summary("language")] string language)
{
try
{
var language = languageRaw.ToUpper();
var success = await _translation.SetLanguage(Context.Guild.Id, language);
if (success)
var availableLanguages = new List<string>();
availableLanguages.Add("en-GB"); // default
availableLanguages.AddRange(GetAvailableCultures().Select(culture => culture.Name));
if (availableLanguages.Contains(language))
{
var guild = _guildSettingsManager.GetSettings(Context.Guild.Id);
guild.Language = language;
await _guildSettingsManager.UpdateSettings(guild);
GuildSettings.Language = language;
await GuildSettingsManager.UpdateSettings(GuildSettings);
var transContext = await _translation.GetGuildContext(Context);
await ReplyAsync(transContext.GetString("NewLanguageSet"));
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(language.ToLower() == "chde" ? "de-CH" : language);
await ReplyAsync(Localization.Admin.NewLanguageSet);
return;
}
await ReplyAsync(
$"That doesn't seem to be a supported language\r\nSupported Languages are {string.Join(", ", _translation.SupportedLanguages)}");
await ReplyAsync($"That doesn't seem to be a supported language\nSupported Languages are {string.Join(", ", availableLanguages)}");
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
await ErrorHandler.HandleCommandException(e, Context);
}
}
@ -169,15 +163,14 @@ namespace Geekbot.Bot.Commands.Admin
try
{
var language = languageRaw.ToLower();
var guild = _guildSettingsManager.GetSettings(Context.Guild.Id);
guild.WikiLang = language;
await _guildSettingsManager.UpdateSettings(guild);
GuildSettings.WikiLang = language;
await GuildSettingsManager.UpdateSettings(GuildSettings);
await ReplyAsync($"Now using the {language} wikipedia");
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
await ErrorHandler.HandleCommandException(e, Context);
}
}
@ -187,14 +180,14 @@ namespace Geekbot.Bot.Commands.Admin
{
try
{
var guild = _guildSettingsManager.GetSettings(Context.Guild.Id);
guild.Ping = !guild.Ping;
await _guildSettingsManager.UpdateSettings(guild);
await ReplyAsync(guild.Ping ? "i will reply to ping now" : "No more pongs...");
// var guild = _guildSettingsManager.GetSettings(Context.Guild.Id);
GuildSettings.Ping = !GuildSettings.Ping;
await GuildSettingsManager.UpdateSettings(GuildSettings);
await ReplyAsync(GuildSettings.Ping ? "i will reply to ping now" : "No more pongs...");
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
await ErrorHandler.HandleCommandException(e, Context);
}
}
@ -204,14 +197,14 @@ namespace Geekbot.Bot.Commands.Admin
{
try
{
var guild = _guildSettingsManager.GetSettings(Context.Guild.Id);
guild.Hui = !guild.Hui;
await _guildSettingsManager.UpdateSettings(guild);
await ReplyAsync(guild.Hui ? "i will reply to hui now" : "No more hui's...");
// var guild = _guildSettingsManager.GetSettings(Context.Guild.Id);
GuildSettings.Hui = !GuildSettings.Hui;
await GuildSettingsManager.UpdateSettings(GuildSettings);
await ReplyAsync(GuildSettings.Hui ? "i will reply to hui now" : "No more hui's...");
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
await ErrorHandler.HandleCommandException(e, Context);
}
}
@ -230,5 +223,30 @@ namespace Geekbot.Bot.Commands.Admin
return null;
}
}
private IEnumerable<CultureInfo> GetAvailableCultures()
{
var result = new List<CultureInfo>();
var rm = new ResourceManager(typeof(Localization.Admin));
var cultures = CultureInfo.GetCultures(CultureTypes.AllCultures);
foreach (var culture in cultures)
{
try
{
if (culture.Equals(CultureInfo.InvariantCulture)) continue; //do not use "==", won't work
var rs = rm.GetResourceSet(culture, true, false);
if (rs != null)
{
result.Add(culture);
}
}
catch (CultureNotFoundException)
{
//NOP
}
}
return result;
}
}
}

View file

@ -3,8 +3,10 @@ using System.Threading.Tasks;
using Discord;
using Discord.Commands;
using Discord.WebSocket;
using Geekbot.Core;
using Geekbot.Core.ErrorHandling;
using Geekbot.Core.GlobalSettings;
using Geekbot.Core.GuildSettingsManager;
using Geekbot.Core.Logger;
using Geekbot.Core.UserRepository;
@ -12,20 +14,19 @@ namespace Geekbot.Bot.Commands.Admin.Owner
{
[Group("owner")]
[RequireOwner]
public class Owner : ModuleBase
public class Owner : GeekbotCommandBase
{
private readonly DiscordSocketClient _client;
private readonly IErrorHandler _errorHandler;
private readonly IGlobalSettings _globalSettings;
private readonly IGeekbotLogger _logger;
private readonly IUserRepository _userRepository;
public Owner(DiscordSocketClient client, IGeekbotLogger logger, IUserRepository userRepositry, IErrorHandler errorHandler, IGlobalSettings globalSettings)
public Owner(DiscordSocketClient client, IGeekbotLogger logger, IUserRepository userRepositry, IErrorHandler errorHandler, IGlobalSettings globalSettings,
IGuildSettingsManager guildSettingsManager) : base(errorHandler, guildSettingsManager)
{
_client = client;
_logger = logger;
_userRepository = userRepositry;
_errorHandler = errorHandler;
_globalSettings = globalSettings;
}
@ -73,7 +74,7 @@ namespace Geekbot.Bot.Commands.Admin.Owner
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context,
await ErrorHandler.HandleCommandException(e, Context,
"Couldn't complete User Repository, see console for more info");
}
}
@ -89,7 +90,7 @@ namespace Geekbot.Bot.Commands.Admin.Owner
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
await ErrorHandler.HandleCommandException(e, Context);
}
}
@ -105,7 +106,7 @@ namespace Geekbot.Bot.Commands.Admin.Owner
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
await ErrorHandler.HandleCommandException(e, Context);
}
}
@ -119,7 +120,7 @@ namespace Geekbot.Bot.Commands.Admin.Owner
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
await ErrorHandler.HandleCommandException(e, Context);
}
}
}

View file

@ -1,35 +1,33 @@
using System;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using Discord;
using Discord.Commands;
using Discord.Net;
using Geekbot.Core;
using Geekbot.Core.CommandPreconditions;
using Geekbot.Core.Database;
using Geekbot.Core.Database.Models;
using Geekbot.Core.ErrorHandling;
using Geekbot.Core.Extensions;
using Geekbot.Core.Localization;
using Geekbot.Core.GuildSettingsManager;
using Geekbot.Core.ReactionListener;
namespace Geekbot.Bot.Commands.Admin
{
[Group("role")]
[DisableInDirectMessage]
public class Role : ModuleBase
public class Role : GeekbotCommandBase
{
private readonly DatabaseContext _database;
private readonly IErrorHandler _errorHandler;
private readonly IReactionListener _reactionListener;
private readonly ITranslationHandler _translationHandler;
public Role(DatabaseContext database, IErrorHandler errorHandler, IReactionListener reactionListener, ITranslationHandler translationHandler)
public Role(DatabaseContext database, IErrorHandler errorHandler, IReactionListener reactionListener, IGuildSettingsManager guildSettingsManager) : base(errorHandler, guildSettingsManager)
{
_database = database;
_errorHandler = errorHandler;
_reactionListener = reactionListener;
_translationHandler = translationHandler;
}
[Command(RunMode = RunMode.Async)]
@ -38,23 +36,22 @@ namespace Geekbot.Bot.Commands.Admin
{
try
{
var transContext = await _translationHandler.GetGuildContext(Context);
var roles = _database.RoleSelfService.Where(g => g.GuildId.Equals(Context.Guild.Id.AsLong())).ToList();
if (roles.Count == 0)
{
await ReplyAsync(transContext.GetString("NoRolesConfigured"));
await ReplyAsync(Localization.Role.NoRolesConfigured);
return;
}
var sb = new StringBuilder();
sb.AppendLine(transContext.GetString("ListHeader", Context.Guild.Name));
sb.AppendLine(transContext.GetString("ListInstruction"));
sb.AppendLine(string.Format(Localization.Role.ListHeader, Context.Guild.Name));
sb.AppendLine(Localization.Role.ListInstruction);
foreach (var role in roles) sb.AppendLine($"- {role.WhiteListName}");
await ReplyAsync(sb.ToString());
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
await ErrorHandler.HandleCommandException(e, Context);
}
}
@ -64,7 +61,6 @@ namespace Geekbot.Bot.Commands.Admin
{
try
{
var transContext = await _translationHandler.GetGuildContext(Context);
var roleName = roleNameRaw.ToLower();
var roleFromDb = _database.RoleSelfService.FirstOrDefault(e =>
e.GuildId.Equals(Context.Guild.Id.AsLong()) && e.WhiteListName.Equals(roleName));
@ -74,31 +70,38 @@ namespace Geekbot.Bot.Commands.Admin
var role = Context.Guild.Roles.First(r => r.Id == roleFromDb.RoleId.AsUlong());
if (role == null)
{
await ReplyAsync(transContext.GetString("RoleNotFound"));
await ReplyAsync(Localization.Role.RoleNotFound);
return;
}
if (guildUser.RoleIds.Contains(role.Id))
{
await guildUser.RemoveRoleAsync(role);
await ReplyAsync(transContext.GetString("RemovedUserFromRole", role.Name));
await ReplyAsync(string.Format(Localization.Role.RemovedUserFromRole, role.Name));
return;
}
await guildUser.AddRoleAsync(role);
await ReplyAsync(transContext.GetString("AddedUserFromRole", role.Name));
await ReplyAsync(string.Format(Localization.Role.AddedUserFromRole, role.Name));
return;
}
await ReplyAsync(transContext.GetString("RoleNotFound"));
await ReplyAsync(Localization.Role.RoleNotFound);
}
catch (HttpException e)
{
await _errorHandler.HandleHttpException(e, Context);
if (e.HttpCode == HttpStatusCode.Forbidden)
{
await ReplyAsync(Localization.Internal.Http403);
}
else
{
await ErrorHandler.HandleCommandException(e, Context);
}
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
await ErrorHandler.HandleCommandException(e, Context);
}
}
@ -109,10 +112,9 @@ namespace Geekbot.Bot.Commands.Admin
{
try
{
var transContext = await _translationHandler.GetGuildContext(Context);
if (role.IsManaged)
{
await ReplyAsync(transContext.GetString("CannotAddManagedRole"));
await ReplyAsync(Localization.Role.CannotAddManagedRole);
return;
}
@ -122,7 +124,7 @@ namespace Geekbot.Bot.Commands.Admin
|| role.Permissions.BanMembers
|| role.Permissions.KickMembers)
{
await ReplyAsync(transContext.GetString("CannotAddDangerousRole"));
await ReplyAsync(Localization.Role.CannotAddDangerousRole);
return;
}
@ -133,11 +135,11 @@ namespace Geekbot.Bot.Commands.Admin
WhiteListName = roleName
});
await _database.SaveChangesAsync();
await ReplyAsync(transContext.GetString("AddedRoleToWhitelist", role.Name));
await ReplyAsync(string.Format(Localization.Role.AddedRoleToWhitelist, role.Name));
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
await ErrorHandler.HandleCommandException(e, Context);
}
}
@ -148,22 +150,21 @@ namespace Geekbot.Bot.Commands.Admin
{
try
{
var transContext = await _translationHandler.GetGuildContext(Context);
var roleFromDb = _database.RoleSelfService.FirstOrDefault(e =>
e.GuildId.Equals(Context.Guild.Id.AsLong()) && e.WhiteListName.Equals(roleName));
if (roleFromDb != null)
{
_database.RoleSelfService.Remove(roleFromDb);
await _database.SaveChangesAsync();
await ReplyAsync(transContext.GetString("RemovedRoleFromWhitelist", roleName));
await ReplyAsync(string.Format(Localization.Role.RemovedRoleFromWhitelist, roleName));
return;
}
await ReplyAsync(transContext.GetString("RoleNotFound"));
await ReplyAsync(Localization.Role.RoleNotFound);
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
await ErrorHandler.HandleCommandException(e, Context);
}
}
@ -182,14 +183,13 @@ namespace Geekbot.Bot.Commands.Admin
await _reactionListener.AddRoleToListener(messageId, Context.Guild.Id, emoji, role);
await Context.Message.DeleteAsync();
}
catch (HttpException e)
catch (HttpException)
{
await Context.Channel.SendMessageAsync("Custom emojis from other servers are not supported");
Console.WriteLine(e);
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
await ErrorHandler.HandleCommandException(e, Context);
}
}
}

View file

@ -2,31 +2,30 @@
using System.Linq;
using System.Threading.Tasks;
using Discord.Commands;
using Geekbot.Bot.Utils;
using Geekbot.Core;
using Geekbot.Core.Database;
using Geekbot.Core.Database.Models;
using Geekbot.Core.ErrorHandling;
using Geekbot.Core.Extensions;
using Geekbot.Core.GuildSettingsManager;
using Geekbot.Core.KvInMemoryStore;
using Geekbot.Core.Localization;
using Geekbot.Core.RandomNumberGenerator;
namespace Geekbot.Bot.Commands.Games.Roll
{
public class Roll : ModuleBase
public class Roll : GeekbotCommandBase
{
private readonly IErrorHandler _errorHandler;
private readonly IKvInMemoryStore _kvInMemoryStore;
private readonly ITranslationHandler _translation;
private readonly DatabaseContext _database;
private readonly IRandomNumberGenerator _randomNumberGenerator;
public Roll(IKvInMemoryStore kvInMemoryStore,IErrorHandler errorHandler, ITranslationHandler translation, DatabaseContext database, IRandomNumberGenerator randomNumberGenerator)
public Roll(IKvInMemoryStore kvInMemoryStore, IErrorHandler errorHandler, DatabaseContext database, IRandomNumberGenerator randomNumberGenerator, IGuildSettingsManager guildSettingsManager)
: base(errorHandler, guildSettingsManager)
{
_kvInMemoryStore = kvInMemoryStore;
_translation = translation;
_database = database;
_randomNumberGenerator = randomNumberGenerator;
_errorHandler = errorHandler;
}
[Command("roll", RunMode = RunMode.Async)]
@ -37,28 +36,27 @@ namespace Geekbot.Bot.Commands.Games.Roll
{
var number = _randomNumberGenerator.Next(1, 100);
int.TryParse(stuff, out var guess);
var transContext = await _translation.GetGuildContext(Context);
if (guess <= 100 && guess > 0)
{
var kvKey = $"{Context.Guild.Id}:{Context.User.Id}:RollsPrevious";
var kvKey = $"{Context?.Guild?.Id ?? 0}:{Context.User.Id}:RollsPrevious";
var prevRoll = _kvInMemoryStore.Get<RollTimeout>(kvKey);
if (prevRoll?.LastGuess == guess && prevRoll?.GuessedOn.AddDays(1) > DateTime.Now)
{
await ReplyAsync(transContext.GetString(
"NoPrevGuess",
await ReplyAsync(string.Format(
Localization.Roll.NoPrevGuess,
Context.Message.Author.Mention,
transContext.FormatDateTimeAsRemaining(prevRoll.GuessedOn.AddDays(1))));
DateLocalization.FormatDateTimeAsRemaining(prevRoll.GuessedOn.AddDays(1))));
return;
}
_kvInMemoryStore.Set(kvKey, new RollTimeout { LastGuess = guess, GuessedOn = DateTime.Now });
_kvInMemoryStore.Set(kvKey, new RollTimeout {LastGuess = guess, GuessedOn = DateTime.Now});
await ReplyAsync(transContext.GetString("Rolled", Context.Message.Author.Mention, number, guess));
await ReplyAsync(string.Format(Localization.Roll.Rolled, Context.Message.Author.Mention, number, guess));
if (guess == number)
{
await ReplyAsync(transContext.GetString("Gratz", Context.Message.Author));
await ReplyAsync(string.Format(Localization.Roll.Gratz, Context.Message.Author));
var user = await GetUser(Context.User.Id);
user.Rolls += 1;
_database.Rolls.Update(user);
@ -67,18 +65,18 @@ namespace Geekbot.Bot.Commands.Games.Roll
}
else
{
await ReplyAsync(transContext.GetString("RolledNoGuess", Context.Message.Author.Mention, number));
await ReplyAsync(string.Format(Localization.Roll.RolledNoGuess, Context.Message.Author.Mention, number));
}
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
await ErrorHandler.HandleCommandException(e, Context);
}
}
private async Task<RollsModel> GetUser(ulong userId)
{
var user = _database.Rolls.FirstOrDefault(u =>u.GuildId.Equals(Context.Guild.Id.AsLong()) && u.UserId.Equals(userId.AsLong())) ?? await CreateNewRow(userId);
var user = _database.Rolls.FirstOrDefault(u => u.GuildId.Equals(Context.Guild.Id.AsLong()) && u.UserId.Equals(userId.AsLong())) ?? await CreateNewRow(userId);
return user;
}

View file

@ -3,28 +3,25 @@ using System.Linq;
using System.Threading.Tasks;
using Discord;
using Discord.Commands;
using Geekbot.Core;
using Geekbot.Core.Database;
using Geekbot.Core.Database.Models;
using Geekbot.Core.ErrorHandling;
using Geekbot.Core.Extensions;
using Geekbot.Core.Localization;
using Geekbot.Core.GuildSettingsManager;
using Geekbot.Core.RandomNumberGenerator;
namespace Geekbot.Bot.Commands.Randomness
{
public class Ship : ModuleBase
public class Ship : GeekbotCommandBase
{
private readonly IErrorHandler _errorHandler;
private readonly IRandomNumberGenerator _randomNumberGenerator;
private readonly ITranslationHandler _translation;
private readonly DatabaseContext _database;
public Ship(DatabaseContext database, IErrorHandler errorHandler, IRandomNumberGenerator randomNumberGenerator, ITranslationHandler translation)
public Ship(DatabaseContext database, IErrorHandler errorHandler, IRandomNumberGenerator randomNumberGenerator, IGuildSettingsManager guildSettingsManager) : base(errorHandler, guildSettingsManager)
{
_database = database;
_errorHandler = errorHandler;
_randomNumberGenerator = randomNumberGenerator;
_translation = translation;
}
[Command("Ship", RunMode = RunMode.Async)]
@ -58,28 +55,26 @@ namespace Geekbot.Bot.Commands.Randomness
shippingRate = dbval.Strength;
}
var transContext = await _translation.GetGuildContext(Context);
var reply = $":heartpulse: **{transContext.GetString("Matchmaking")}** :heartpulse:\r\n";
var reply = $":heartpulse: **{Localization.Ship.Matchmaking}** :heartpulse:\r\n";
reply += $":two_hearts: {user1.Mention} :heart: {user2.Mention} :two_hearts:\r\n";
reply += $"0% [{BlockCounter(shippingRate)}] 100% - {DeterminateSuccess(shippingRate, transContext)}";
reply += $"0% [{BlockCounter(shippingRate)}] 100% - {DeterminateSuccess(shippingRate)}";
await ReplyAsync(reply);
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
await ErrorHandler.HandleCommandException(e, Context);
}
}
private string DeterminateSuccess(int rate, TranslationGuildContext transContext)
private string DeterminateSuccess(int rate)
{
return (rate / 20) switch
{
0 => transContext.GetString("NotGonnaToHappen"),
1 => transContext.GetString("NotSuchAGoodIdea"),
2 => transContext.GetString("ThereMightBeAChance"),
3 => transContext.GetString("CouldWork"),
4 => transContext.GetString("ItsAMatch"),
0 => Localization.Ship.NotGoingToHappen,
1 => Localization.Ship.NotSuchAGoodIdea,
2 => Localization.Ship.ThereMightBeAChance,
3 => Localization.Ship.CouldWork,
4 => Localization.Ship.ItsAMatch,
_ => "nope"
};
}

View file

@ -3,12 +3,14 @@ using System.Linq;
using System.Threading.Tasks;
using Discord;
using Discord.Commands;
using Geekbot.Bot.Utils;
using Geekbot.Core;
using Geekbot.Core.CommandPreconditions;
using Geekbot.Core.Database;
using Geekbot.Core.Database.Models;
using Geekbot.Core.ErrorHandling;
using Geekbot.Core.Extensions;
using Geekbot.Core.Localization;
using Geekbot.Core.GuildSettingsManager;
using Geekbot.Core.RandomNumberGenerator;
namespace Geekbot.Bot.Commands.Rpg
@ -16,18 +18,15 @@ namespace Geekbot.Bot.Commands.Rpg
[DisableInDirectMessage]
[Group("cookies")]
[Alias("cookie")]
public class Cookies : ModuleBase
public class Cookies : GeekbotCommandBase
{
private readonly DatabaseContext _database;
private readonly IErrorHandler _errorHandler;
private readonly ITranslationHandler _translation;
private readonly IRandomNumberGenerator _randomNumberGenerator;
public Cookies(DatabaseContext database, IErrorHandler errorHandler, ITranslationHandler translation , IRandomNumberGenerator randomNumberGenerator)
public Cookies(DatabaseContext database, IErrorHandler errorHandler, IRandomNumberGenerator randomNumberGenerator, IGuildSettingsManager guildSettingsManager)
: base(errorHandler, guildSettingsManager)
{
_database = database;
_errorHandler = errorHandler;
_translation = translation;
_randomNumberGenerator = randomNumberGenerator;
}
@ -37,23 +36,22 @@ namespace Geekbot.Bot.Commands.Rpg
{
try
{
var transContext = await _translation.GetGuildContext(Context);
var actor = await GetUser(Context.User.Id);
if (actor.LastPayout.Value.AddDays(1).Date > DateTime.Now.Date)
{
var formatedWaitTime = transContext.FormatDateTimeAsRemaining(DateTimeOffset.Now.AddDays(1).Date);
await ReplyAsync(transContext.GetString("WaitForMoreCookies", formatedWaitTime));
var formattedWaitTime = DateLocalization.FormatDateTimeAsRemaining(DateTimeOffset.Now.AddDays(1).Date);
await ReplyAsync(string.Format(Localization.Cookies.WaitForMoreCookies, formattedWaitTime));
return;
}
actor.Cookies += 10;
actor.LastPayout = DateTimeOffset.Now;
await SetUser(actor);
await ReplyAsync(transContext.GetString("GetCookies", 10, actor.Cookies));
await ReplyAsync(string.Format(Localization.Cookies.GetCookies, 10, actor.Cookies));
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
await ErrorHandler.HandleCommandException(e, Context);
}
}
@ -63,13 +61,12 @@ namespace Geekbot.Bot.Commands.Rpg
{
try
{
var transContext = await _translation.GetGuildContext(Context);
var actor = await GetUser(Context.User.Id);
await ReplyAsync(transContext.GetString("InYourJar", actor.Cookies));
await ReplyAsync(string.Format(Localization.Cookies.InYourJar, actor.Cookies));
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
await ErrorHandler.HandleCommandException(e, Context);
}
}
@ -79,12 +76,11 @@ namespace Geekbot.Bot.Commands.Rpg
{
try
{
var transContext = await _translation.GetGuildContext(Context);
var giver = await GetUser(Context.User.Id);
if (giver.Cookies < amount)
{
await ReplyAsync(transContext.GetString("NotEnoughToGive"));
await ReplyAsync(Localization.Cookies.NotEnoughToGive);
return;
}
@ -96,11 +92,11 @@ namespace Geekbot.Bot.Commands.Rpg
await SetUser(giver);
await SetUser(taker);
await ReplyAsync(transContext.GetString("Given", amount, user.Username));
await ReplyAsync(string.Format(Localization.Cookies.Given, amount, user.Username));
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
await ErrorHandler.HandleCommandException(e, Context);
}
}
@ -110,12 +106,11 @@ namespace Geekbot.Bot.Commands.Rpg
{
try
{
var transContext = await _translation.GetGuildContext(Context);
var actor = await GetUser(Context.User.Id);
if (actor.Cookies < 5)
{
await ReplyAsync(transContext.GetString("NotEnoughCookiesToEat"));
await ReplyAsync(Localization.Cookies.NotEnoughCookiesToEat);
return;
}
@ -124,11 +119,11 @@ namespace Geekbot.Bot.Commands.Rpg
await SetUser(actor);
await ReplyAsync(transContext.GetString("AteCookies", amount, actor.Cookies));
await ReplyAsync(string.Format(Localization.Cookies.AteCookies, amount, actor.Cookies));
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
await ErrorHandler.HandleCommandException(e, Context);
}
}

View file

@ -3,27 +3,25 @@ using System.Linq;
using System.Threading.Tasks;
using Discord;
using Discord.Commands;
using Geekbot.Bot.Utils;
using Geekbot.Core;
using Geekbot.Core.CommandPreconditions;
using Geekbot.Core.Database;
using Geekbot.Core.Database.Models;
using Geekbot.Core.ErrorHandling;
using Geekbot.Core.Extensions;
using Geekbot.Core.Localization;
using Geekbot.Core.GuildSettingsManager;
namespace Geekbot.Bot.Commands.User
{
[DisableInDirectMessage]
public class Karma : ModuleBase
public class Karma : GeekbotCommandBase
{
private readonly IErrorHandler _errorHandler;
private readonly DatabaseContext _database;
private readonly ITranslationHandler _translation;
public Karma(DatabaseContext database, IErrorHandler errorHandler, ITranslationHandler translation)
public Karma(DatabaseContext database, IErrorHandler errorHandler, IGuildSettingsManager guildSettingsManager) : base(errorHandler, guildSettingsManager)
{
_database = database;
_errorHandler = errorHandler;
_translation = translation;
}
[Command("good", RunMode = RunMode.Async)]
@ -32,16 +30,15 @@ namespace Geekbot.Bot.Commands.User
{
try
{
var transContext = await _translation.GetGuildContext(Context);
var actor = await GetUser(Context.User.Id);
if (user.Id == Context.User.Id)
{
await ReplyAsync(transContext.GetString("CannotChangeOwn", Context.User.Username));
await ReplyAsync(string.Format(Localization.Karma.CannotChangeOwnUp, Context.User.Username));
}
else if (TimeoutFinished(actor.TimeOut))
{
var formatedWaitTime = transContext.FormatDateTimeAsRemaining(actor.TimeOut.AddMinutes(3));
await ReplyAsync(transContext.GetString("WaitUntill", Context.User.Username, formatedWaitTime));
var formatedWaitTime = DateLocalization.FormatDateTimeAsRemaining(actor.TimeOut.AddMinutes(3));
await ReplyAsync(string.Format(Localization.Karma.WaitUntill, Context.User.Username, formatedWaitTime));
}
else
{
@ -60,16 +57,16 @@ namespace Geekbot.Bot.Commands.User
.WithName(user.Username));
eb.WithColor(new Color(138, 219, 146));
eb.Title = transContext.GetString("Increased");
eb.AddInlineField(transContext.GetString("By"), Context.User.Username);
eb.AddInlineField(transContext.GetString("Amount"), "+1");
eb.AddInlineField(transContext.GetString("Current"), target.Karma);
eb.Title = Localization.Karma.Increased;
eb.AddInlineField(Localization.Karma.By, Context.User.Username);
eb.AddInlineField(Localization.Karma.Amount, "+1");
eb.AddInlineField(Localization.Karma.Current, target.Karma);
await ReplyAsync("", false, eb.Build());
}
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
await ErrorHandler.HandleCommandException(e, Context);
}
}
@ -79,16 +76,15 @@ namespace Geekbot.Bot.Commands.User
{
try
{
var transContext = await _translation.GetGuildContext(Context);
var actor = await GetUser(Context.User.Id);
if (user.Id == Context.User.Id)
{
await ReplyAsync(transContext.GetString("CannotChangeOwn", Context.User.Username));
await ReplyAsync(string.Format(Localization.Karma.CannotChangeOwnDown, Context.User.Username));
}
else if (TimeoutFinished(actor.TimeOut))
{
var formatedWaitTime = transContext.FormatDateTimeAsRemaining(actor.TimeOut.AddMinutes(3));
await ReplyAsync(transContext.GetString("WaitUntill", Context.User.Username, formatedWaitTime));
var formatedWaitTime = DateLocalization.FormatDateTimeAsRemaining(actor.TimeOut.AddMinutes(3));
await ReplyAsync(string.Format(Localization.Karma.WaitUntill, Context.User.Username, formatedWaitTime));
}
else
{
@ -107,16 +103,16 @@ namespace Geekbot.Bot.Commands.User
.WithName(user.Username));
eb.WithColor(new Color(138, 219, 146));
eb.Title = transContext.GetString("Decreased");
eb.AddInlineField(transContext.GetString("By"), Context.User.Username);
eb.AddInlineField(transContext.GetString("Amount"), "-1");
eb.AddInlineField(transContext.GetString("Current"), target.Karma);
eb.Title = Localization.Karma.Decreased;
eb.AddInlineField(Localization.Karma.By, Context.User.Username);
eb.AddInlineField(Localization.Karma.Amount, "-1");
eb.AddInlineField(Localization.Karma.Current, target.Karma);
await ReplyAsync("", false, eb.Build());
}
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
await ErrorHandler.HandleCommandException(e, Context);
}
}

View file

@ -4,35 +4,29 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Discord.Commands;
using Geekbot.Core;
using Geekbot.Core.CommandPreconditions;
using Geekbot.Core.Converters;
using Geekbot.Core.Database;
using Geekbot.Core.ErrorHandling;
using Geekbot.Core.Extensions;
using Geekbot.Core.GuildSettingsManager;
using Geekbot.Core.Highscores;
using Geekbot.Core.Localization;
using Geekbot.Core.UserRepository;
namespace Geekbot.Bot.Commands.User.Ranking
{
public class Rank : ModuleBase
public class Rank : GeekbotCommandBase
{
private readonly IEmojiConverter _emojiConverter;
private readonly IHighscoreManager _highscoreManager;
private readonly ITranslationHandler _translationHandler;
private readonly IErrorHandler _errorHandler;
private readonly DatabaseContext _database;
private readonly IUserRepository _userRepository;
public Rank(DatabaseContext database, IErrorHandler errorHandler, IUserRepository userRepository,
IEmojiConverter emojiConverter, IHighscoreManager highscoreManager, ITranslationHandler translationHandler)
public Rank(DatabaseContext database, IErrorHandler errorHandler, IEmojiConverter emojiConverter, IHighscoreManager highscoreManager, IGuildSettingsManager guildSettingsManager)
: base(errorHandler, guildSettingsManager)
{
_database = database;
_errorHandler = errorHandler;
_userRepository = userRepository;
_emojiConverter = emojiConverter;
_highscoreManager = highscoreManager;
_translationHandler = translationHandler;
}
[Command("rank", RunMode = RunMode.Async)]
@ -42,7 +36,6 @@ namespace Geekbot.Bot.Commands.User.Ranking
{
try
{
var transContext = await _translationHandler.GetGuildContext(Context);
HighscoreTypes type;
try
{
@ -51,14 +44,14 @@ namespace Geekbot.Bot.Commands.User.Ranking
}
catch
{
await ReplyAsync(transContext.GetString("InvalidType"));
await ReplyAsync(Localization.Rank.InvalidType);
return;
}
var replyBuilder = new StringBuilder();
if (amount > 20)
{
await ReplyAsync(transContext.GetString("LimitingTo20Warning"));
await ReplyAsync(Localization.Rank.LimitingTo20Warning);
amount = 20;
}
@ -70,7 +63,7 @@ namespace Geekbot.Bot.Commands.User.Ranking
}
catch (HighscoreListEmptyException)
{
await ReplyAsync(transContext.GetString("NoTypeFoundForServer", type));
await ReplyAsync(string.Format(Localization.Rank.NoTypeFoundForServer, type));
return;
}
@ -85,22 +78,24 @@ namespace Geekbot.Bot.Commands.User.Ranking
var failedToRetrieveUser = highscoreUsers.Any(e => string.IsNullOrEmpty(e.Key.Username));
if (failedToRetrieveUser) replyBuilder.AppendLine(transContext.GetString("FailedToResolveAllUsernames"));
replyBuilder.AppendLine(transContext.GetString("HighscoresFor", type.ToString().CapitalizeFirst(), Context.Guild.Name));
if (failedToRetrieveUser) replyBuilder.AppendLine(Localization.Rank.FailedToResolveAllUsernames).AppendLine();
replyBuilder.AppendLine(string.Format(Localization.Rank.HighscoresFor, type.ToString().CapitalizeFirst(), Context.Guild.Name));
var highscorePlace = 1;
foreach (var user in highscoreUsers)
foreach (var (user, value) in highscoreUsers)
{
replyBuilder.Append(highscorePlace < 11
? $"{_emojiConverter.NumberToEmoji(highscorePlace)} "
: $"`{highscorePlace}.` ");
replyBuilder.Append(user.Key.Username != null
? $"**{user.Key.Username}#{user.Key.Discriminator}**"
: $"**{user.Key.Id}**");
replyBuilder.Append(user.Username != null
? $"**{user.Username}#{user.Discriminator}**"
: $"**{user.Id}**");
replyBuilder.Append(type == HighscoreTypes.messages
? $" - {user.Value} {type} - {Math.Round((double) (100 * user.Value) / guildMessages, 2)}%\n"
: $" - {user.Value} {type}\n");
? $" - {value} {type} - {Math.Round((double) (100 * value) / guildMessages, 2)}%\n"
: $" - {value} {type}\n");
highscorePlace++;
}
@ -109,7 +104,7 @@ namespace Geekbot.Bot.Commands.User.Ranking
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
await ErrorHandler.HandleCommandException(e, Context);
}
}
}

View file

@ -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);
}
}
}

View file

@ -1,20 +1,16 @@
using System;
using System.Threading.Tasks;
using Discord.Commands;
using Geekbot.Core;
using Geekbot.Core.ErrorHandling;
using Geekbot.Core.Localization;
using Geekbot.Core.GuildSettingsManager;
namespace Geekbot.Bot.Commands.Utils
{
public class Choose : ModuleBase
public class Choose : GeekbotCommandBase
{
private readonly IErrorHandler _errorHandler;
private readonly ITranslationHandler _translation;
public Choose(IErrorHandler errorHandler, ITranslationHandler translation)
public Choose(IErrorHandler errorHandler, IGuildSettingsManager guildSettingsManager) : base(errorHandler, guildSettingsManager)
{
_errorHandler = errorHandler;
_translation = translation;
}
[Command("choose", RunMode = RunMode.Async)]
@ -24,14 +20,13 @@ namespace Geekbot.Bot.Commands.Utils
{
try
{
var transContext = await _translation.GetGuildContext(Context);
var choicesArray = choices.Split(';');
var choice = new Random().Next(choicesArray.Length);
await ReplyAsync(transContext.GetString("Choice", choicesArray[choice].Trim()));
await ReplyAsync(string.Format(Localization.Choose.Choice, choicesArray[choice].Trim()));
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
await ErrorHandler.HandleCommandException(e, Context);
}
}
}

View file

@ -9,7 +9,7 @@ using Geekbot.Core.Database;
using Geekbot.Core.Database.Models;
using Geekbot.Core.ErrorHandling;
using Geekbot.Core.Extensions;
using Geekbot.Core.Localization;
using Geekbot.Core.GuildSettingsManager;
using Geekbot.Core.Polyfills;
using Geekbot.Core.RandomNumberGenerator;
@ -17,20 +17,17 @@ namespace Geekbot.Bot.Commands.Utils.Quote
{
[Group("quote")]
[DisableInDirectMessage]
public class Quote : ModuleBase
public class Quote : GeekbotCommandBase
{
private readonly IErrorHandler _errorHandler;
private readonly DatabaseContext _database;
private readonly IRandomNumberGenerator _randomNumberGenerator;
private readonly ITranslationHandler _translationHandler;
private readonly bool _isDev;
public Quote(IErrorHandler errorHandler, DatabaseContext database, IRandomNumberGenerator randomNumberGenerator, ITranslationHandler translationHandler)
public Quote(IErrorHandler errorHandler, DatabaseContext database, IRandomNumberGenerator randomNumberGenerator, IGuildSettingsManager guildSettingsManager)
: base(errorHandler, guildSettingsManager)
{
_errorHandler = errorHandler;
_database = database;
_randomNumberGenerator = randomNumberGenerator;
_translationHandler = translationHandler;
// to remove restrictions when developing
_isDev = Constants.BotVersion() == "0.0.0-DEV";
}
@ -45,8 +42,7 @@ namespace Geekbot.Bot.Commands.Utils.Quote
if (!s.Any())
{
var transContext = await _translationHandler.GetGuildContext(Context);
await ReplyAsync(transContext.GetString("NoQuotesFound"));
await ReplyAsync(Localization.Quote.NoQuotesFound);
return;
}
@ -58,7 +54,7 @@ namespace Geekbot.Bot.Commands.Utils.Quote
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context, "Whoops, seems like the quote was to edgy to return");
await ErrorHandler.HandleCommandException(e, Context, "Whoops, seems like the quote was to edgy to return");
}
}
@ -117,23 +113,22 @@ namespace Geekbot.Bot.Commands.Utils.Quote
{
try
{
var transContext = await _translationHandler.GetGuildContext(Context);
var quote = _database.Quotes.Where(e => e.GuildId == Context.Guild.Id.AsLong() && e.InternalId == id)?.FirstOrDefault();
if (quote != null)
{
_database.Quotes.Remove(quote);
await _database.SaveChangesAsync();
var embed = QuoteBuilder(quote);
await ReplyAsync(transContext.GetString("Removed", id), false, embed.Build());
await ReplyAsync(string.Format(Localization.Quote.Removed, id), false, embed.Build());
}
else
{
await ReplyAsync(transContext.GetString("NotFoundWithId"));
await ReplyAsync(Localization.Quote.NotFoundWithId);
}
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context, "I couldn't find a quote with that id :disappointed:");
await ErrorHandler.HandleCommandException(e, Context, "I couldn't find a quote with that id :disappointed:");
}
}
@ -144,12 +139,11 @@ namespace Geekbot.Bot.Commands.Utils.Quote
try
{
// setup
var transContext = await _translationHandler.GetGuildContext(Context);
var eb = new EmbedBuilder();
eb.Author = new EmbedAuthorBuilder()
{
IconUrl = Context.Guild.IconUrl,
Name = $"{Context.Guild.Name} - {transContext.GetString("QuoteStats")}"
Name = $"{Context.Guild.Name} - {Localization.Quote.QuoteStats}"
};
// gather data
@ -157,7 +151,7 @@ namespace Geekbot.Bot.Commands.Utils.Quote
if (totalQuotes == 0)
{
// no quotes, no stats, end of the road
await ReplyAsync(transContext.GetString("NoQuotesFound"));
await ReplyAsync(Localization.Quote.NoQuotesFound);
return;
}
@ -176,8 +170,8 @@ namespace Geekbot.Bot.Commands.Utils.Quote
.OrderBy(row => row.year);
// add data to the embed
eb.AddField(transContext.GetString("MostQuotesPerson"), $"{mostQuotedPersonUser.Username} ({mostQuotedPerson.amount})");
eb.AddInlineField(transContext.GetString("TotalQuotes"), totalQuotes);
eb.AddField(Localization.Quote.MostQuotesPerson, $"{mostQuotedPersonUser.Username} ({mostQuotedPerson.amount})");
eb.AddInlineField(Localization.Quote.TotalQuotes, totalQuotes);
foreach (var year in quotesByYear)
{
@ -188,7 +182,7 @@ namespace Geekbot.Bot.Commands.Utils.Quote
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
await ErrorHandler.HandleCommandException(e, Context);
}
}
@ -196,8 +190,6 @@ namespace Geekbot.Bot.Commands.Utils.Quote
{
try
{
var transContext = await _translationHandler.GetGuildContext(Context);
var list = Context.Channel.GetMessagesAsync().Flatten();
var message = await list.FirstOrDefaultAsync(msg =>
msg.Author.Id == user.Id &&
@ -206,11 +198,11 @@ namespace Geekbot.Bot.Commands.Utils.Quote
!msg.Content.ToLower().StartsWith("!"));
if (message == null) return;
await ProcessQuote(message, saveToDb, transContext);
await ProcessQuote(message, saveToDb);
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context, $"No quoteable messages have been sent by {user.Username} in this channel");
await ErrorHandler.HandleCommandException(e, Context, $"No quoteable messages have been sent by {user.Username} in this channel");
}
}
@ -219,14 +211,14 @@ namespace Geekbot.Bot.Commands.Utils.Quote
{
try
{
var transContext = await _translationHandler.GetGuildContext(Context);
// var transContext = await _translationHandler.GetGuildContext(Context);
var message = await Context.Channel.GetMessageAsync(messageId);
await ProcessQuote(message, saveToDb, transContext);
await ProcessQuote(message, saveToDb);
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context, "I couldn't find a message with that id :disappointed:");
await ErrorHandler.HandleCommandException(e, Context, "I couldn't find a message with that id :disappointed:");
}
}
@ -234,18 +226,18 @@ namespace Geekbot.Bot.Commands.Utils.Quote
{
try
{
var transContext = await _translationHandler.GetGuildContext(Context);
// var transContext = await _translationHandler.GetGuildContext(Context);
if (!MessageLink.IsValid(messageLink))
{
await ReplyAsync(transContext.GetString("NotAValidMessageLink"));
await ReplyAsync(Localization.Quote.NotAValidMessageLink);
return;
}
var link = new MessageLink(messageLink);
if (link.GuildId != Context.Guild.Id)
{
await ReplyAsync(transContext.GetString("OnlyQuoteFromSameServer"));
await ReplyAsync(Localization.Quote.OnlyQuoteFromSameServer);
return;
}
@ -255,25 +247,25 @@ namespace Geekbot.Bot.Commands.Utils.Quote
var message = await channel.GetMessageAsync(link.MessageId);
await ProcessQuote(message, saveToDb, transContext);
await ProcessQuote(message, saveToDb);
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context, "I couldn't find that message :disappointed:");
await ErrorHandler.HandleCommandException(e, Context, "I couldn't find that message :disappointed:");
}
}
private async Task ProcessQuote(IMessage message, bool saveToDb, TranslationGuildContext transContext)
private async Task ProcessQuote(IMessage message, bool saveToDb)
{
if (message.Author.Id == Context.Message.Author.Id && saveToDb && !_isDev)
{
await ReplyAsync(transContext.GetString("CannotSaveOwnQuotes"));
await ReplyAsync(Localization.Quote.CannotSaveOwnQuotes);
return;
}
if (message.Author.IsBot && saveToDb && !_isDev)
{
await ReplyAsync(transContext.GetString("CannotQuoteBots"));
await ReplyAsync(Localization.Quote.CannotQuoteBots);
return;
}
@ -285,7 +277,7 @@ namespace Geekbot.Bot.Commands.Utils.Quote
}
var embed = QuoteBuilder(quote);
await ReplyAsync(saveToDb ? transContext.GetString("QuoteAdded") : string.Empty, false, embed.Build());
await ReplyAsync(saveToDb ? Localization.Quote.QuoteAdded : string.Empty, false, embed.Build());
}
private EmbedBuilder QuoteBuilder(QuoteModel quote)

81
src/Bot/Localization/Admin.Designer.cs generated Normal file
View file

@ -0,0 +1,81 @@
//------------------------------------------------------------------------------
// <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 Admin {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Admin() {
}
/// <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.Admin", typeof(Admin).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 I&apos;m talking english.
/// </summary>
internal static string GetLanguage {
get {
return ResourceManager.GetString("GetLanguage", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to I will reply in english from now on.
/// </summary>
internal static string NewLanguageSet {
get {
return ResourceManager.GetString("NewLanguageSet", resourceCulture);
}
}
}
}

View file

@ -0,0 +1,20 @@
<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="NewLanguageSet" xml:space="preserve">
<value>I werd ab jetzt uf schwiizerdüütsch antworte, äuuä</value>
</data>
<data name="GetLanguage" xml:space="preserve">
<value>I red schwiizerdüütsch</value>
</data>
</root>

View file

@ -0,0 +1,27 @@
<?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="NewLanguageSet" xml:space="preserve">
<value>I will reply in english from now on</value>
</data>
<data name="GetLanguage" xml:space="preserve">
<value>I'm talking english</value>
</data>
</root>

72
src/Bot/Localization/Choose.Designer.cs generated Normal file
View file

@ -0,0 +1,72 @@
//------------------------------------------------------------------------------
// <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 Choose {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Choose() {
}
/// <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.Choose", typeof(Choose).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 I Choose **{0}**.
/// </summary>
internal static string Choice {
get {
return ResourceManager.GetString("Choice", resourceCulture);
}
}
}
}

View file

@ -0,0 +1,17 @@
<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="Choice" xml:space="preserve">
<value>I nimme **{0}**</value>
</data>
</root>

View file

@ -0,0 +1,24 @@
<?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="Choice" xml:space="preserve">
<value>I Choose **{0}**</value>
</data>
</root>

126
src/Bot/Localization/Cookies.Designer.cs generated Normal file
View file

@ -0,0 +1,126 @@
//------------------------------------------------------------------------------
// <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 Cookies {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Cookies() {
}
/// <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.Cookies", typeof(Cookies).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 You ate {0} cookies, you&apos;ve only got {1} cookies left.
/// </summary>
internal static string AteCookies {
get {
return ResourceManager.GetString("AteCookies", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You got {0} cookies, there are now {1} cookies in you cookie jar.
/// </summary>
internal static string GetCookies {
get {
return ResourceManager.GetString("GetCookies", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You gave {0} cookies to {1}.
/// </summary>
internal static string Given {
get {
return ResourceManager.GetString("Given", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to There are {0} cookies in you cookie jar.
/// </summary>
internal static string InYourJar {
get {
return ResourceManager.GetString("InYourJar", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Your cookie jar looks almost empty, you should probably not eat a cookie.
/// </summary>
internal static string NotEnoughCookiesToEat {
get {
return ResourceManager.GetString("NotEnoughCookiesToEat", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You don&apos;t have enough cookies.
/// </summary>
internal static string NotEnoughToGive {
get {
return ResourceManager.GetString("NotEnoughToGive", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You already got cookies today, you can have more cookies in {0}.
/// </summary>
internal static string WaitForMoreCookies {
get {
return ResourceManager.GetString("WaitForMoreCookies", resourceCulture);
}
}
}
}

View file

@ -0,0 +1,35 @@
<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="GetCookies" xml:space="preserve">
<value>Du häsch {0} guetzli becho, du häsch jetzt {1} guetzli ih dr büchse</value>
</data>
<data name="WaitForMoreCookies" xml:space="preserve">
<value>Du hesch scho guetzli becho hüt, du chasch meh ha in {0}</value>
</data>
<data name="InYourJar" xml:space="preserve">
<value>Es hät {0} guetzli ih dineri büchs</value>
</data>
<data name="Given" xml:space="preserve">
<value>Du hesch {1} {0} guetzli geh</value>
</data>
<data name="NotEnoughToGive" xml:space="preserve">
<value>Du hesch nid gnueg guetzli</value>
</data>
<data name="NotEnoughCookiesToEat" xml:space="preserve">
<value>Du hesch chuum no guetzli ih dineri büchs, du sötsch warschinli keini esse</value>
</data>
<data name="AteCookies" xml:space="preserve">
<value>Du hesch {0} guetzli gesse und hesch jezt no {1} übrig</value>
</data>
</root>

View file

@ -0,0 +1,42 @@
<?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="GetCookies" xml:space="preserve">
<value>You got {0} cookies, there are now {1} cookies in you cookie jar</value>
</data>
<data name="WaitForMoreCookies" xml:space="preserve">
<value>You already got cookies today, you can have more cookies in {0}</value>
</data>
<data name="InYourJar" xml:space="preserve">
<value>There are {0} cookies in you cookie jar</value>
</data>
<data name="Given" xml:space="preserve">
<value>You gave {0} cookies to {1}</value>
</data>
<data name="NotEnoughToGive" xml:space="preserve">
<value>You don't have enough cookies</value>
</data>
<data name="NotEnoughCookiesToEat" xml:space="preserve">
<value>Your cookie jar looks almost empty, you should probably not eat a cookie</value>
</data>
<data name="AteCookies" xml:space="preserve">
<value>You ate {0} cookies, you've only got {1} cookies left</value>
</data>
</root>

126
src/Bot/Localization/Internal.Designer.cs generated Normal file
View file

@ -0,0 +1,126 @@
//------------------------------------------------------------------------------
// <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 Internal {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Internal() {
}
/// <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.Internal", typeof(Internal).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 and.
/// </summary>
internal static string And {
get {
return ResourceManager.GetString("And", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to day|days.
/// </summary>
internal static string Days {
get {
return ResourceManager.GetString("Days", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to hour|hours.
/// </summary>
internal static string Hours {
get {
return ResourceManager.GetString("Hours", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Seems like i don&apos;t have enough permission to that :confused:.
/// </summary>
internal static string Http403 {
get {
return ResourceManager.GetString("Http403", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to minute|minutes.
/// </summary>
internal static string Minutes {
get {
return ResourceManager.GetString("Minutes", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to second|seconds.
/// </summary>
internal static string Seconds {
get {
return ResourceManager.GetString("Seconds", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Something went wrong :confused:.
/// </summary>
internal static string SomethingWentWrong {
get {
return ResourceManager.GetString("SomethingWentWrong", resourceCulture);
}
}
}
}

View file

@ -0,0 +1,35 @@
<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="SomethingWentWrong" xml:space="preserve">
<value>Öppis isch schief gange :confused:</value>
</data>
<data name="Http403" xml:space="preserve">
<value>Gseht danach us das ich nid gnueg recht han zum das mache :confused:</value>
</data>
<data name="Days" xml:space="preserve">
<value>tag|täg</value>
</data>
<data name="Hours" xml:space="preserve">
<value>stund|stunde</value>
</data>
<data name="Minutes" xml:space="preserve">
<value>minute|minute</value>
</data>
<data name="Seconds" xml:space="preserve">
<value>sekunde|sekunde</value>
</data>
<data name="And" xml:space="preserve">
<value>und</value>
</data>
</root>

View file

@ -0,0 +1,42 @@
<?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="SomethingWentWrong" xml:space="preserve">
<value>Something went wrong :confused:</value>
</data>
<data name="Http403" xml:space="preserve">
<value>Seems like i don't have enough permission to that :confused:</value>
</data>
<data name="Days" xml:space="preserve">
<value>day|days</value>
</data>
<data name="Hours" xml:space="preserve">
<value>hour|hours</value>
</data>
<data name="Minutes" xml:space="preserve">
<value>minute|minutes</value>
</data>
<data name="Seconds" xml:space="preserve">
<value>second|seconds</value>
</data>
<data name="And" xml:space="preserve">
<value>and</value>
</data>
</root>

135
src/Bot/Localization/Karma.Designer.cs generated Normal file
View 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 Karma {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Karma() {
}
/// <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.Karma", typeof(Karma).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 Amount.
/// </summary>
internal static string Amount {
get {
return ResourceManager.GetString("Amount", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to By.
/// </summary>
internal static string By {
get {
return ResourceManager.GetString("By", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Sorry {0}, but you can&apos;t lower your own karma.
/// </summary>
internal static string CannotChangeOwnDown {
get {
return ResourceManager.GetString("CannotChangeOwnDown", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Sorry {0}, but you can&apos;t give yourself karma.
/// </summary>
internal static string CannotChangeOwnUp {
get {
return ResourceManager.GetString("CannotChangeOwnUp", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Current.
/// </summary>
internal static string Current {
get {
return ResourceManager.GetString("Current", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Karma lowered.
/// </summary>
internal static string Decreased {
get {
return ResourceManager.GetString("Decreased", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Gained Karma.
/// </summary>
internal static string Increased {
get {
return ResourceManager.GetString("Increased", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Sorry {0}, but you have to wait {1} before you can give karma again....
/// </summary>
internal static string WaitUntill {
get {
return ResourceManager.GetString("WaitUntill", resourceCulture);
}
}
}
}

View 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="CannotChangeOwnUp" xml:space="preserve">
<value>Sorry {0}, aber du chasch dr selber kei karma geh</value>
</data>
<data name="WaitUntill" xml:space="preserve">
<value>Sorry {0}, aber du musch no {1} warte bisch d wieder karma chasch geh...</value>
</data>
<data name="Increased" xml:space="preserve">
<value>Karma becho</value>
</data>
<data name="By" xml:space="preserve">
<value>Vo</value>
</data>
<data name="Amount" xml:space="preserve">
<value>Mengi</value>
</data>
<data name="Current" xml:space="preserve">
<value>Jetzt</value>
</data>
<data name="CannotChangeOwnDown" xml:space="preserve">
<value>Sorry {0}, aber du chasch dr din eigete karma nid weg neh</value>
</data>
<data name="Decreased" xml:space="preserve">
<value>Karma gsenkt</value>
</data>
</root>

View 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="CannotChangeOwnUp" xml:space="preserve">
<value>Sorry {0}, but you can't give yourself karma</value>
</data>
<data name="WaitUntill" xml:space="preserve">
<value>Sorry {0}, but you have to wait {1} before you can give karma again...</value>
</data>
<data name="Increased" xml:space="preserve">
<value>Gained Karma</value>
</data>
<data name="By" xml:space="preserve">
<value>By</value>
</data>
<data name="Amount" xml:space="preserve">
<value>Amount</value>
</data>
<data name="Current" xml:space="preserve">
<value>Current</value>
</data>
<data name="CannotChangeOwnDown" xml:space="preserve">
<value>Sorry {0}, but you can't lower your own karma</value>
</data>
<data name="Decreased" xml:space="preserve">
<value>Karma lowered</value>
</data>
</root>

162
src/Bot/Localization/Quote.Designer.cs generated Normal file
View file

@ -0,0 +1,162 @@
//------------------------------------------------------------------------------
// <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 Quote {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Quote() {
}
/// <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.Quote", typeof(Quote).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 You can&apos;t save quotes by a bot....
/// </summary>
internal static string CannotQuoteBots {
get {
return ResourceManager.GetString("CannotQuoteBots", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You can&apos;t save your own quotes....
/// </summary>
internal static string CannotSaveOwnQuotes {
get {
return ResourceManager.GetString("CannotSaveOwnQuotes", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Most quoted person.
/// </summary>
internal static string MostQuotesPerson {
get {
return ResourceManager.GetString("MostQuotesPerson", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to This server doesn&apos;t seem to have any quotes yet. You can add a quote with `!quote save @user` or `!quote save &lt;messageId&gt;`.
/// </summary>
internal static string NoQuotesFound {
get {
return ResourceManager.GetString("NoQuotesFound", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to That is not a valid message link.
/// </summary>
internal static string NotAValidMessageLink {
get {
return ResourceManager.GetString("NotAValidMessageLink", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to I couldn&apos;t find a quote with that ID :disappointed:.
/// </summary>
internal static string NotFoundWithId {
get {
return ResourceManager.GetString("NotFoundWithId", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You can only quote messages from the same server.
/// </summary>
internal static string OnlyQuoteFromSameServer {
get {
return ResourceManager.GetString("OnlyQuoteFromSameServer", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to **Quote Added**.
/// </summary>
internal static string QuoteAdded {
get {
return ResourceManager.GetString("QuoteAdded", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Quote Stats.
/// </summary>
internal static string QuoteStats {
get {
return ResourceManager.GetString("QuoteStats", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to **Removed #{0}**.
/// </summary>
internal static string Removed {
get {
return ResourceManager.GetString("Removed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Total.
/// </summary>
internal static string TotalQuotes {
get {
return ResourceManager.GetString("TotalQuotes", resourceCulture);
}
}
}
}

View file

@ -0,0 +1,47 @@
<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="NoQuotesFound" xml:space="preserve">
<value>Dä server het no kei quotes. Du chasch quotes hinzuefüege mit `!quote save @user` oder `!quote save &lt;messageId&gt;`</value>
</data>
<data name="CannotSaveOwnQuotes" xml:space="preserve">
<value>Du chasch kei quotes vo dir selber speichere...</value>
</data>
<data name="CannotQuoteBots" xml:space="preserve">
<value>Du chasch kei quotes vomne bot speichere...</value>
</data>
<data name="QuoteAdded" xml:space="preserve">
<value>**Quote hinzugfüegt**</value>
</data>
<data name="Removed" xml:space="preserve">
<value>**#{0} glöscht**</value>
</data>
<data name="NotFoundWithId" xml:space="preserve">
<value>Ich chan kei quote finde mit därri ID :disappointed:</value>
</data>
<data name="QuoteStats" xml:space="preserve">
<value>Quote statistike</value>
</data>
<data name="TotalQuotes" xml:space="preserve">
<value>Total</value>
</data>
<data name="MostQuotesPerson" xml:space="preserve">
<value>Meist quoteti person</value>
</data>
<data name="NotAValidMessageLink" xml:space="preserve">
<value>Das isch kei korrete nachrichtelink</value>
</data>
<data name="OnlyQuoteFromSameServer" xml:space="preserve">
<value>Du chasch numme nachrichte vom gliche server quote</value>
</data>
</root>

View file

@ -0,0 +1,54 @@
<?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="NoQuotesFound" xml:space="preserve">
<value>This server doesn't seem to have any quotes yet. You can add a quote with `!quote save @user` or `!quote save &lt;messageId&gt;`</value>
</data>
<data name="CannotSaveOwnQuotes" xml:space="preserve">
<value>You can't save your own quotes...</value>
</data>
<data name="CannotQuoteBots" xml:space="preserve">
<value>You can't save quotes by a bot...</value>
</data>
<data name="QuoteAdded" xml:space="preserve">
<value>**Quote Added**</value>
</data>
<data name="Removed" xml:space="preserve">
<value>**Removed #{0}**</value>
</data>
<data name="NotFoundWithId" xml:space="preserve">
<value>I couldn't find a quote with that ID :disappointed:</value>
</data>
<data name="QuoteStats" xml:space="preserve">
<value>Quote Stats</value>
</data>
<data name="TotalQuotes" xml:space="preserve">
<value>Total</value>
</data>
<data name="MostQuotesPerson" xml:space="preserve">
<value>Most quoted person</value>
</data>
<data name="NotAValidMessageLink" xml:space="preserve">
<value>That is not a valid message link</value>
</data>
<data name="OnlyQuoteFromSameServer" xml:space="preserve">
<value>You can only quote messages from the same server</value>
</data>
</root>

108
src/Bot/Localization/Rank.Designer.cs generated Normal file
View file

@ -0,0 +1,108 @@
//------------------------------------------------------------------------------
// <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 Rank {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Rank() {
}
/// <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.Rank", typeof(Rank).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 :warning: I couldn&apos;t find all usernames. Maybe they left the server?.
/// </summary>
internal static string FailedToResolveAllUsernames {
get {
return ResourceManager.GetString("FailedToResolveAllUsernames", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to :bar_chart: **{0} Highscore for {1}**.
/// </summary>
internal static string HighscoresFor {
get {
return ResourceManager.GetString("HighscoresFor", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Valid types are &apos;`messages`&apos; &apos;`karma`&apos;, &apos;`rolls`&apos; and &apos;`cookies`&apos;.
/// </summary>
internal static string InvalidType {
get {
return ResourceManager.GetString("InvalidType", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to :warning: Limiting to 20.
/// </summary>
internal static string LimitingTo20Warning {
get {
return ResourceManager.GetString("LimitingTo20Warning", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to No {0} found on this server.
/// </summary>
internal static string NoTypeFoundForServer {
get {
return ResourceManager.GetString("NoTypeFoundForServer", resourceCulture);
}
}
}
}

View file

@ -0,0 +1,29 @@
<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="LimitingTo20Warning" xml:space="preserve">
<value>:warning: Limitiert uf 20</value>
</data>
<data name="NoTypeFoundForServer" xml:space="preserve">
<value>Kei {0} gfunde für dä server</value>
</data>
<data name="FailedToResolveAllUsernames" xml:space="preserve">
<value>:warning: Ich han nid alli benutzername gfunde. villiicht hend sie de server verlah?</value>
</data>
<data name="HighscoresFor" xml:space="preserve">
<value>:bar_chart: **{0} Highscore für {1}**</value>
</data>
<data name="InvalidType" xml:space="preserve">
<value>Gültigi paramenter sind '`messages`' '`karma`', '`rolls`' und '`cookies`</value>
</data>
</root>

View file

@ -0,0 +1,36 @@
<?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="InvalidType" xml:space="preserve">
<value>Valid types are '`messages`' '`karma`', '`rolls`' and '`cookies`'</value>
</data>
<data name="LimitingTo20Warning" xml:space="preserve">
<value>:warning: Limiting to 20</value>
</data>
<data name="NoTypeFoundForServer" xml:space="preserve">
<value>No {0} found on this server</value>
</data>
<data name="FailedToResolveAllUsernames" xml:space="preserve">
<value>:warning: I couldn't find all usernames. Maybe they left the server?</value>
</data>
<data name="HighscoresFor" xml:space="preserve">
<value>:bar_chart: **{0} Highscore for {1}**</value>
</data>
</root>

153
src/Bot/Localization/Role.Designer.cs generated Normal file
View file

@ -0,0 +1,153 @@
//------------------------------------------------------------------------------
// <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 Role {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Role() {
}
/// <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.Role", typeof(Role).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 Added {0} to the whitelist.
/// </summary>
internal static string AddedRoleToWhitelist {
get {
return ResourceManager.GetString("AddedRoleToWhitelist", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Added you to {0}.
/// </summary>
internal static string AddedUserFromRole {
get {
return ResourceManager.GetString("AddedUserFromRole", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You cannot add that role to self service because it contains one or more dangerous permissions.
/// </summary>
internal static string CannotAddDangerousRole {
get {
return ResourceManager.GetString("CannotAddDangerousRole", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You can&apos;t add a role that is managed by discord.
/// </summary>
internal static string CannotAddManagedRole {
get {
return ResourceManager.GetString("CannotAddManagedRole", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to **Self Service Roles on {0}**.
/// </summary>
internal static string ListHeader {
get {
return ResourceManager.GetString("ListHeader", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to To get a role, use `!role [name]`.
/// </summary>
internal static string ListInstruction {
get {
return ResourceManager.GetString("ListInstruction", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to There are no roles configured for this server.
/// </summary>
internal static string NoRolesConfigured {
get {
return ResourceManager.GetString("NoRolesConfigured", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Removed {0} from the whitelist.
/// </summary>
internal static string RemovedRoleFromWhitelist {
get {
return ResourceManager.GetString("RemovedRoleFromWhitelist", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Removed you from {0}.
/// </summary>
internal static string RemovedUserFromRole {
get {
return ResourceManager.GetString("RemovedUserFromRole", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to That role doesn&apos;t exist or is not on the whitelist.
/// </summary>
internal static string RoleNotFound {
get {
return ResourceManager.GetString("RoleNotFound", resourceCulture);
}
}
}
}

View file

@ -0,0 +1,44 @@
<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="NoRolesConfigured" xml:space="preserve">
<value>Es sind kei rolle für dä server konfiguriert</value>
</data>
<data name="ListHeader" xml:space="preserve">
<value>**Self Service Rollene uf {0}**</value>
</data>
<data name="ListInstruction" xml:space="preserve">
<value>Zum ä rolle becho, schriib `!role [name]`</value>
</data>
<data name="RoleNotFound" xml:space="preserve">
<value>Die rolle gids nid or isch nid uf dr whitelist</value>
</data>
<data name="RemovedUserFromRole" xml:space="preserve">
<value>Han di entfernt vo {0}</value>
</data>
<data name="AddedUserFromRole" xml:space="preserve">
<value>Han di hinzue gfüegt zu {0}</value>
</data>
<data name="CannotAddManagedRole" xml:space="preserve">
<value>Du chasch kei rolle hinzuefüge wo verwalted wird vo discord</value>
</data>
<data name="CannotAddDangerousRole" xml:space="preserve">
<value>Du chasch die rolle nid hinzuefüge will er ein oder mehreri gföhrlichi berechtigunge het</value>
</data>
<data name="AddedRoleToWhitelist" xml:space="preserve">
<value>{0} isch zur whitelist hinzuegfüegt</value>
</data>
<data name="RemovedRoleFromWhitelist" xml:space="preserve">
<value>{0} isch vo dr whitelist glöscht</value>
</data>
</root>

View file

@ -0,0 +1,51 @@
<?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="NoRolesConfigured" xml:space="preserve">
<value>There are no roles configured for this server</value>
</data>
<data name="ListHeader" xml:space="preserve">
<value>**Self Service Roles on {0}**</value>
</data>
<data name="ListInstruction" xml:space="preserve">
<value>To get a role, use `!role [name]`</value>
</data>
<data name="RoleNotFound" xml:space="preserve">
<value>That role doesn't exist or is not on the whitelist</value>
</data>
<data name="RemovedUserFromRole" xml:space="preserve">
<value>Removed you from {0}</value>
</data>
<data name="AddedUserFromRole" xml:space="preserve">
<value>Added you to {0}</value>
</data>
<data name="CannotAddManagedRole" xml:space="preserve">
<value>You can't add a role that is managed by discord</value>
</data>
<data name="CannotAddDangerousRole" xml:space="preserve">
<value>You cannot add that role to self service because it contains one or more dangerous permissions</value>
</data>
<data name="AddedRoleToWhitelist" xml:space="preserve">
<value>Added {0} to the whitelist</value>
</data>
<data name="RemovedRoleFromWhitelist" xml:space="preserve">
<value>Removed {0} from the whitelist</value>
</data>
</root>

99
src/Bot/Localization/Roll.Designer.cs generated Normal file
View file

@ -0,0 +1,99 @@
//------------------------------------------------------------------------------
// <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 Roll {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Roll() {
}
/// <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.Roll", typeof(Roll).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 Congratulations {0}, your guess was correct!.
/// </summary>
internal static string Gratz {
get {
return ResourceManager.GetString("Gratz", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to :red_circle: {0}, you can&apos;t guess the same number again, guess another number or wait {1}.
/// </summary>
internal static string NoPrevGuess {
get {
return ResourceManager.GetString("NoPrevGuess", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0}, you rolled {1}, your guess was {2}.
/// </summary>
internal static string Rolled {
get {
return ResourceManager.GetString("Rolled", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0}, you rolled {1}.
/// </summary>
internal static string RolledNoGuess {
get {
return ResourceManager.GetString("RolledNoGuess", resourceCulture);
}
}
}
}

View file

@ -0,0 +1,26 @@
<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="Rolled" xml:space="preserve">
<value>{0}, du hesch {1} grollt und hesch {2} grate</value>
</data>
<data name="Gratz" xml:space="preserve">
<value>Gratuliere {0}, du hesch richtig grate!</value>
</data>
<data name="RolledNoGuess" xml:space="preserve">
<value>{0}, du hesch {1} grollt</value>
</data>
<data name="NoPrevGuess" xml:space="preserve">
<value>:red_circle: {0}, du chasch nid nomol es gliche rate, rate öppis anders oder warte {1}</value>
</data>
</root>

View file

@ -0,0 +1,33 @@
<?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="Rolled" xml:space="preserve">
<value>{0}, you rolled {1}, your guess was {2}</value>
</data>
<data name="Gratz" xml:space="preserve">
<value>Congratulations {0}, your guess was correct!</value>
</data>
<data name="RolledNoGuess" xml:space="preserve">
<value>{0}, you rolled {1}</value>
</data>
<data name="NoPrevGuess" xml:space="preserve">
<value>:red_circle: {0}, you can't guess the same number again, guess another number or wait {1}</value>
</data>
</root>

117
src/Bot/Localization/Ship.Designer.cs generated Normal file
View file

@ -0,0 +1,117 @@
//------------------------------------------------------------------------------
// <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 Ship {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Ship() {
}
/// <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.Ship", typeof(Ship).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 Almost a match.
/// </summary>
internal static string CouldWork {
get {
return ResourceManager.GetString("CouldWork", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to It&apos;s a match.
/// </summary>
internal static string ItsAMatch {
get {
return ResourceManager.GetString("ItsAMatch", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Matchmaking.
/// </summary>
internal static string Matchmaking {
get {
return ResourceManager.GetString("Matchmaking", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Not going happen.
/// </summary>
internal static string NotGoingToHappen {
get {
return ResourceManager.GetString("NotGoingToHappen", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Not such a good idea.
/// </summary>
internal static string NotSuchAGoodIdea {
get {
return ResourceManager.GetString("NotSuchAGoodIdea", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to There might be a chance.
/// </summary>
internal static string ThereMightBeAChance {
get {
return ResourceManager.GetString("ThereMightBeAChance", resourceCulture);
}
}
}
}

View file

@ -0,0 +1,32 @@
<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="Matchmaking" xml:space="preserve">
<value>Verkupple</value>
</data>
<data name="NotGoingToHappen" xml:space="preserve">
<value>Wird nöd klappe</value>
</data>
<data name="NotSuchAGoodIdea" xml:space="preserve">
<value>Nöd so ä gueti idee</value>
</data>
<data name="ThereMightBeAChance" xml:space="preserve">
<value>Es gid eventuel ä chance</value>
</data>
<data name="CouldWork" xml:space="preserve">
<value>Fasch en match</value>
</data>
<data name="ItsAMatch" xml:space="preserve">
<value>Es isch es traumpaar</value>
</data>
</root>

View file

@ -0,0 +1,39 @@
<?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="Matchmaking" xml:space="preserve">
<value>Matchmaking</value>
</data>
<data name="NotGoingToHappen" xml:space="preserve">
<value>Not going happen</value>
</data>
<data name="NotSuchAGoodIdea" xml:space="preserve">
<value>Not such a good idea</value>
</data>
<data name="ThereMightBeAChance" xml:space="preserve">
<value>There might be a chance</value>
</data>
<data name="CouldWork" xml:space="preserve">
<value>Almost a match</value>
</data>
<data name="ItsAMatch" xml:space="preserve">
<value>It's a match</value>
</data>
</root>

135
src/Bot/Localization/Stats.Designer.cs generated Normal file
View 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);
}
}
}
}

View 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>

View 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>

View file

@ -17,7 +17,6 @@ using Geekbot.Core.GuildSettingsManager;
using Geekbot.Core.Highscores;
using Geekbot.Core.KvInMemoryStore;
using Geekbot.Core.Levels;
using Geekbot.Core.Localization;
using Geekbot.Core.Logger;
using Geekbot.Core.MalClient;
using Geekbot.Core.Media;
@ -168,8 +167,7 @@ namespace Geekbot.Bot
var randomNumberGenerator = new RandomNumberGenerator();
var mediaProvider = new MediaProvider(_logger, randomNumberGenerator);
var kvMemoryStore = new KvInInMemoryStore();
var translationHandler = new TranslationHandler(_logger, _guildSettingsManager);
var errorHandler = new ErrorHandler(_logger, translationHandler, _runParameters);
var errorHandler = new ErrorHandler(_logger, _runParameters, () => Localization.Internal.SomethingWentWrong);
var diceParser = new DiceParser(randomNumberGenerator);
services.AddSingleton(_userRepository);
@ -186,7 +184,6 @@ namespace Geekbot.Bot
services.AddSingleton<IGlobalSettings>(_globalSettings);
services.AddSingleton<IErrorHandler>(errorHandler);
services.AddSingleton<IDiceParser>(diceParser);
services.AddSingleton<ITranslationHandler>(translationHandler);
services.AddSingleton<IReactionListener>(_reactionListener);
services.AddSingleton<IGuildSettingsManager>(_guildSettingsManager);
services.AddSingleton(_client);

View file

@ -0,0 +1,49 @@
using System;
using System.Text;
namespace Geekbot.Bot.Utils
{
public class DateLocalization
{
public static string FormatDateTimeAsRemaining(DateTimeOffset dateTime)
{
var remaining = dateTime - DateTimeOffset.Now;
const string formattable = "{0} {1}";
var sb = new StringBuilder();
if (remaining.Days > 0)
{
sb.AppendFormat(formattable, remaining.Days, GetSingularOrPlural(remaining.Days, Localization.Internal.Days));
}
if (remaining.Hours > 0)
{
if (sb.Length > 0) sb.Append(", ");
sb.AppendFormat(formattable, remaining.Hours, GetSingularOrPlural(remaining.Hours, Localization.Internal.Hours));
}
if (remaining.Minutes > 0)
{
if (sb.Length > 0) sb.Append(", ");
sb.AppendFormat(formattable, remaining.Minutes, GetSingularOrPlural(remaining.Minutes, Localization.Internal.Minutes));
}
if (remaining.Seconds > 0)
{
if (sb.Length > 0)
{
sb.AppendFormat(" {0} ", Localization.Internal.And);
}
sb.AppendFormat(formattable, remaining.Seconds, GetSingularOrPlural(remaining.Seconds, Localization.Internal.Seconds));
}
return sb.ToString().Trim();
}
private static string GetSingularOrPlural(int number, string rawString)
{
var versions = rawString.Split('|');
return number == 1 ? versions[0] : versions[1];
}
}
}

View file

@ -31,10 +31,4 @@
<PackageReference Include="YamlDotNet" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
<Content Include="Localization\Translations.yml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>

View file

@ -1,9 +1,6 @@
using System;
using System.Net;
using System.Threading.Tasks;
using Discord.Commands;
using Discord.Net;
using Geekbot.Core.Localization;
using Geekbot.Core.Logger;
using SharpRaven;
using SharpRaven.Data;
@ -14,14 +11,14 @@ namespace Geekbot.Core.ErrorHandling
public class ErrorHandler : IErrorHandler
{
private readonly IGeekbotLogger _logger;
private readonly ITranslationHandler _translation;
private readonly Func<string> _getDefaultErrorText;
private readonly IRavenClient _raven;
private readonly bool _errorsInChat;
public ErrorHandler(IGeekbotLogger logger, ITranslationHandler translation, RunParameters runParameters)
public ErrorHandler(IGeekbotLogger logger, RunParameters runParameters, Func<string> getDefaultErrorText)
{
_logger = logger;
_translation = translation;
_getDefaultErrorText = getDefaultErrorText;
_errorsInChat = runParameters.ExposeErrors;
var sentryDsn = runParameters.SentryEndpoint;
@ -40,7 +37,9 @@ namespace Geekbot.Core.ErrorHandling
{
try
{
var errorString = errorMessage == "def" ? await _translation.GetString(context.Guild?.Id ?? 0, "errorHandler", "SomethingWentWrong") : errorMessage;
var errorString = errorMessage == "def"
? _getDefaultErrorText()
: errorMessage;
var errorObj = SimpleConextConverter.ConvertContext(context);
if (e.Message.Contains("50007")) return;
if (e.Message.Contains("50013")) return;
@ -76,17 +75,6 @@ namespace Geekbot.Core.ErrorHandling
}
}
public async Task HandleHttpException(HttpException e, ICommandContext context)
{
var errorStrings = await _translation.GetDict(context, "httpErrors");
switch(e.HttpCode)
{
case HttpStatusCode.Forbidden:
await context.Channel.SendMessageAsync(errorStrings["403"]);
break;
}
}
private void ReportExternal(Exception e, MessageDto errorObj)
{
if (_raven == null) return;

View file

@ -1,13 +1,11 @@
using System;
using System.Threading.Tasks;
using Discord.Commands;
using Discord.Net;
namespace Geekbot.Core.ErrorHandling
{
public interface IErrorHandler
{
Task HandleCommandException(Exception e, ICommandContext context, string errorMessage = "def");
Task HandleHttpException(HttpException e, ICommandContext context);
}
}

View file

@ -0,0 +1,30 @@
using System.Globalization;
using System.Threading;
using Discord.Commands;
using Geekbot.Core.Database.Models;
using Geekbot.Core.ErrorHandling;
using Geekbot.Core.GuildSettingsManager;
namespace Geekbot.Core
{
public class GeekbotCommandBase : ModuleBase<ICommandContext>
{
protected readonly IGuildSettingsManager GuildSettingsManager;
protected GuildSettingsModel GuildSettings;
protected readonly IErrorHandler ErrorHandler;
protected GeekbotCommandBase(IErrorHandler errorHandler, IGuildSettingsManager guildSettingsManager)
{
GuildSettingsManager = guildSettingsManager;
ErrorHandler = errorHandler;
}
protected override void BeforeExecute(CommandInfo command)
{
base.BeforeExecute(command);
GuildSettings = GuildSettingsManager.GetSettings(Context?.Guild?.Id ?? 0);
var language = GuildSettings.Language;
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(language == "CHDE" ? "de-ch" : language);
}
}
}

View file

@ -1,16 +0,0 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Discord.Commands;
namespace Geekbot.Core.Localization
{
public interface ITranslationHandler
{
Task<string> GetString(ulong guildId, string command, string stringName);
string GetString(string language, string command, string stringName);
Task<Dictionary<string, string>> GetDict(ICommandContext context, string command);
Task<TranslationGuildContext> GetGuildContext(ICommandContext context);
Task<bool> SetLanguage(ulong guildId, string language);
List<string> SupportedLanguages { get; }
}
}

View file

@ -1,90 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace Geekbot.Core.Localization
{
public class TranslationGuildContext
{
public ITranslationHandler TranslationHandler { get; }
public string Language { get; }
public Dictionary<string, string> Dict { get; }
public TranslationGuildContext(ITranslationHandler translationHandler, string language, Dictionary<string, string> dict)
{
TranslationHandler = translationHandler;
Language = language;
Dict = dict;
}
public string GetString(string stringToFormat, params object[] args)
{
return string.Format(Dict[stringToFormat] ?? "", args);
}
public string FormatDateTimeAsRemaining(DateTimeOffset dateTime)
{
var remaining = dateTime - DateTimeOffset.Now;
const string formattable = "{0} {1}";
var sb = new StringBuilder();
if (remaining.Days > 0)
{
var s = GetTimeString(TimeTypes.Days);
sb.AppendFormat(formattable, remaining.Days, GetSingOrPlur(remaining.Days, s));
}
if (remaining.Hours > 0)
{
if (sb.Length > 0) sb.Append(", ");
var s = GetTimeString(TimeTypes.Hours);
sb.AppendFormat(formattable, remaining.Hours, GetSingOrPlur(remaining.Hours, s));
}
if (remaining.Minutes > 0)
{
if (sb.Length > 0) sb.Append(", ");
var s = GetTimeString(TimeTypes.Minutes);
sb.AppendFormat(formattable, remaining.Minutes, GetSingOrPlur(remaining.Minutes, s));
}
if (remaining.Seconds > 0)
{
if (sb.Length > 0)
{
var and = TranslationHandler.GetString(Language, "dateTime", "And");
sb.AppendFormat(" {0} ", and);
}
var s = GetTimeString(TimeTypes.Seconds);
sb.AppendFormat(formattable, remaining.Seconds, GetSingOrPlur(remaining.Seconds, s));
}
return sb.ToString().Trim();
}
public Task<bool> SetLanguage(ulong guildId, string language)
{
return TranslationHandler.SetLanguage(guildId, language);
}
private string GetTimeString(TimeTypes type)
{
return TranslationHandler.GetString(Language, "dateTime", type.ToString());
}
private string GetSingOrPlur(int number, string rawString)
{
var versions = rawString.Split('|');
return number == 1 ? versions[0] : versions[1];
}
private enum TimeTypes
{
Days,
Hours,
Minutes,
Seconds
}
}
}

View file

@ -1,194 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Discord.Commands;
using Geekbot.Core.GuildSettingsManager;
using Geekbot.Core.Logger;
using YamlDotNet.Core;
using YamlDotNet.Serialization;
namespace Geekbot.Core.Localization
{
public class TranslationHandler : ITranslationHandler
{
private readonly IGeekbotLogger _logger;
private readonly IGuildSettingsManager _guildSettingsManager;
private readonly Dictionary<ulong, string> _serverLanguages;
private Dictionary<string, Dictionary<string, Dictionary<string, string>>> _translations;
public TranslationHandler(IGeekbotLogger logger, IGuildSettingsManager guildSettingsManager)
{
_logger = logger;
_guildSettingsManager = guildSettingsManager;
_logger.Information(LogSource.Geekbot, "Loading Translations");
LoadTranslations();
_serverLanguages = new Dictionary<ulong, string>();
}
private void LoadTranslations()
{
try
{
// Read the file
var translationFile = File.ReadAllText(Path.GetFullPath("./Localization/Translations.yml"));
// Deserialize
var input = new StringReader(translationFile);
var mergingParser = new MergingParser(new Parser(input));
var deserializer = new DeserializerBuilder().Build();
var rawTranslations = deserializer.Deserialize<Dictionary<string, Dictionary<string, Dictionary<string, string>>>>(mergingParser);
// Sort
var sortedPerLanguage = new Dictionary<string, Dictionary<string, Dictionary<string, string>>>();
foreach (var command in rawTranslations)
{
foreach (var str in command.Value)
{
foreach (var lang in str.Value)
{
if (!sortedPerLanguage.ContainsKey(lang.Key))
{
var commandDict = new Dictionary<string, Dictionary<string, string>>();
var strDict = new Dictionary<string, string>
{
{str.Key, lang.Value}
};
commandDict.Add(command.Key, strDict);
sortedPerLanguage.Add(lang.Key, commandDict);
}
if (!sortedPerLanguage[lang.Key].ContainsKey(command.Key))
{
var strDict = new Dictionary<string, string>
{
{str.Key, lang.Value}
};
sortedPerLanguage[lang.Key].Add(command.Key, strDict);
}
if (!sortedPerLanguage[lang.Key][command.Key].ContainsKey(str.Key))
{
sortedPerLanguage[lang.Key][command.Key].Add(str.Key, lang.Value);
}
}
}
}
_translations = sortedPerLanguage;
// Find Languages
SupportedLanguages = new List<string>();
foreach (var lang in sortedPerLanguage)
{
SupportedLanguages.Add(lang.Key);
}
}
catch (Exception e)
{
_logger.Error(LogSource.Geekbot, "Failed to load Translations", e);
Environment.Exit(GeekbotExitCode.TranslationsFailed.GetHashCode());
}
}
private Task<string> GetServerLanguage(ulong guildId)
{
try
{
string lang;
try
{
lang = _serverLanguages[guildId];
if (!string.IsNullOrEmpty(lang))
{
return Task.FromResult(lang);
}
throw new Exception();
}
catch
{
lang = _guildSettingsManager.GetSettings(guildId, false)?.Language ?? "EN";
_serverLanguages[guildId] = lang;
return Task.FromResult(lang);
}
}
catch (Exception e)
{
_logger.Error(LogSource.Geekbot, "Could not get guild language", e);
return Task.FromResult("EN");
}
}
public async Task<string> GetString(ulong guildId, string command, string stringName)
{
var serverLang = await GetServerLanguage(guildId);
return GetString(serverLang, command, stringName);
}
public string GetString(string language, string command, string stringName)
{
var translation = _translations[language][command][stringName];
if (!string.IsNullOrWhiteSpace(translation)) return translation;
translation = _translations[command][stringName]["EN"];
if (string.IsNullOrWhiteSpace(translation))
{
_logger.Warning(LogSource.Geekbot, $"No translation found for {command} - {stringName}");
}
return translation;
}
private async Task<Dictionary<string, string>> GetDict(ICommandContext context)
{
try
{
var command = context.Message.Content.Split(' ').First().TrimStart('!').ToLower();
var serverLanguage = await GetServerLanguage(context.Guild?.Id ?? 0);
return _translations[serverLanguage][command];
}
catch (Exception e)
{
_logger.Error(LogSource.Geekbot, "No translations for command found", e);
return new Dictionary<string, string>();
}
}
public async Task<TranslationGuildContext> GetGuildContext(ICommandContext context)
{
var dict = await GetDict(context);
var language = await GetServerLanguage(context.Guild?.Id ?? 0);
return new TranslationGuildContext(this, language, dict);
}
public async Task<Dictionary<string, string>> GetDict(ICommandContext context, string command)
{
try
{
var serverLanguage = await GetServerLanguage(context.Guild?.Id ?? 0);
return _translations[serverLanguage][command];
}
catch (Exception e)
{
_logger.Error(LogSource.Geekbot, "No translations for command found", e);
return new Dictionary<string, string>();
}
}
public async Task<bool> SetLanguage(ulong guildId, string language)
{
try
{
if (!SupportedLanguages.Contains(language)) return false;
var guild = _guildSettingsManager.GetSettings(guildId);
guild.Language = language;
await _guildSettingsManager.UpdateSettings(guild);
_serverLanguages[guildId] = language;
return true;
}
catch (Exception e)
{
_logger.Error(LogSource.Geekbot, "Error while changing language", e);
return false;
}
}
public List<string> SupportedLanguages { get; private set; }
}
}

View file

@ -1,213 +0,0 @@
---
dateTime:
Days:
EN: "day|days"
CHDE: "tag|täg"
Hours:
EN: "hour|hours"
CHDE: "stund|stunde"
Minutes:
EN: "minute|minutes"
CHDE: "minute|minute"
Seconds:
EN: "second|seconds"
CHDE: "sekunde|sekunde"
And:
EN: "and"
CHDE: "und"
admin:
NewLanguageSet:
EN: "I will reply in english from now on"
CHDE: "I werd ab jetzt uf schwiizerdüütsch antworte, äuuä"
GetLanguage:
EN: "I'm talking english"
CHDE: "I red schwiizerdüütsch"
errorHandler:
SomethingWentWrong:
EN: "Something went wrong :confused:"
CHDE: "Öppis isch schief gange :confused:"
httpErrors:
403:
EN: "Seems like i don't have enough permission to that :confused:"
CHDE: "Gseht danach us das ich nid gnueg recht han zum das mache :confused:"
choose:
Choice:
EN: "I Choose **{0}**"
CHDE: "I nimme **{0}**"
good:
CannotChangeOwn:
EN: "Sorry {0}, but you can't give yourself karma"
CHDE: "Sorry {0}, aber du chasch dr selber kei karma geh"
WaitUntill:
EN: "Sorry {0}, but you have to wait {1} before you can give karma again..."
CHDE: "Sorry {0}, aber du musch no {1} warte bisch d wieder karma chasch geh..."
Increased:
EN: "Karma gained"
CHDE: "Karma becho"
By:
EN: "By"
CHDE: "Vo"
Amount:
EN: "Amount"
CHDE: "Mengi"
Current:
EN: "Current"
CHDE: "Jetzt"
bad:
CannotChangeOwn:
EN: "Sorry {0}, but you can't lower your own karma"
CHDE: "Sorry {0}, aber du chasch dr din eigete karma nid weg neh"
WaitUntill:
EN: "Sorry {0}, but you have to wait {1} before you can lower karma again..."
CHDE: "Sorry {0}, aber du musch no {1} warte bisch d wieder karma chasch senke..."
Decreased:
EN: "Karma lowered"
CHDE: "Karma gsenkt"
By:
EN: "By"
CHDE: "Vo"
Amount:
EN: "Amount"
CHDE: "Mengi"
Current:
EN: "Current"
CHDE: "Jetzt"
roll:
Rolled:
EN: "{0}, you rolled {1}, your guess was {2}"
CHDE: "{0}, du hesch {1} grollt und hesch {2} grate"
Gratz:
EN: "Congratulations {0}, your guess was correct!"
CHDE: "Gratuliere {0}, du hesch richtig grate!"
RolledNoGuess:
EN: "{0}, you rolled {1}"
CHDE: "{0}, du hesch {1} grollt"
NoPrevGuess:
EN: ":red_circle: {0}, you can't guess the same number again, guess another number or wait {1}"
CHDE: ":red_circle: {0}, du chasch nid nomol es gliche rate, rate öppis anders oder warte {1}"
cookies: &cookiesAlias
GetCookies:
EN: "You got {0} cookies, there are now {1} cookies in you cookie jar"
CHDE: "Du häsch {0} guetzli becho, du häsch jetzt {1} guetzli ih dr büchse"
WaitForMoreCookies:
EN: "You already got cookies today, you can have more cookies in {0}"
CHDE: "Du hesch scho guetzli becho hüt, du chasch meh ha in {0}"
InYourJar:
EN: "There are {0} cookies in you cookie jar"
CHDE: "Es hät {0} guetzli ih dineri büchs"
Given:
EN: "You gave {0} cookies to {1}"
CHDE: "Du hesch {1} {0} guetzli geh"
NotEnoughToGive:
EN: "You don't have enough cookies"
CHDE: "Du hesch nid gnueg guetzli"
NotEnoughCookiesToEat:
EN: "Your cookie jar looks almost empty, you should probably not eat a cookie"
CHDE: "Du hesch chuum no guetzli ih dineri büchs, du sötsch warschinli keini esse"
AteCookies:
EN: "You ate {0} cookies, you've only got {1} cookies left"
CHDE: "Du hesch {0} guetzli gesse und hesch jezt no {1} übrig"
cookie:
# because command aliases are to hard to deal with...
<<: *cookiesAlias
role:
NoRolesConfigured:
EN: "There are no roles configured for this server"
CHDE: "Es sind kei rolle für dä server konfiguriert"
ListHeader:
EN: "**Self Service Roles on {0}**"
CHDE: "**Self Service Rollene uf {0}**"
ListInstruction:
EN: "To get a role, use `!role [name]`"
CHDE: "Zum ä rolle becho, schriib `!role [name]`"
RoleNotFound:
EN: "That role doesn't exist or is not on the whitelist"
CHDE: "Die rolle gids nid or isch nid uf dr whitelist"
RemovedUserFromRole:
EN: "Removed you from {0}"
CHDE: "Han di entfernt vo {0}"
AddedUserFromRole:
EN: "Added you to {0}"
CHDE: "Han di hinzue gfüegt zu {0}"
CannotAddManagedRole:
EN: "You can't add a role that is managed by discord"
CHDE: "Du chasch kei rolle hinzuefüge wo verwalted wird vo discord"
CannotAddDangerousRole:
EN: "You cannot add that role to self service because it contains one or more dangerous permissions"
CHDE: "Du chasch die rolle nid hinzuefüge will er ein oder mehreri gföhrlichi berechtigunge het"
AddedRoleToWhitelist:
EN: "Added {0} to the whitelist"
CHDE: "{0} isch zur whitelist hinzuegfüegt"
RemovedRoleFromWhitelist:
EN: "Removed {0} from the whitelist"
CHDE: "{0} isch vo dr whitelist glöscht"
quote:
NoQuotesFound:
EN: "This server doesn't seem to have any quotes yet. You can add a quote with `!quote save @user` or `!quote save <messageId>`"
CHDE: "Dä server het no kei quotes. Du chasch quotes hinzuefüege mit `!quote save @user` oder `!quote save <messageId>`"
CannotSaveOwnQuotes:
EN: "You can't save your own quotes..."
CHDE: "Du chasch kei quotes vo dir selber speichere..."
CannotQuoteBots:
EN: "You can't save quotes by a bot..."
CHDE: "Du chasch kei quotes vomne bot speichere..."
QuoteAdded:
EN: "**Quote Added**"
CHDE: "**Quote hinzugfüegt**"
Removed:
EN: "**Removed #{0}**"
CHDE: "**#{0} glöscht**"
NotFoundWithId:
EN: "I couldn't find a quote with that ID :disappointed:"
CHDE: "Ich chan kei quote finde mit därri ID :disappointed:"
QuoteStats:
EN: "Quote Stats"
CHDE: "Quote statistike"
TotalQuotes:
EN: "Total"
CHDE: "Total"
MostQuotesPerson:
EN: "Most quoted person"
CHDE: "Meist quoteti person"
NotAValidMessageLink:
EN: "That is not a valid message link"
CHDE: "Das isch kei korrete nachrichtelink"
OnlyQuoteFromSameServer:
EN: "You can only quote messages from the same server"
CHDE: "Du chasch numme nachrichte vom gliche server quote"
rank:
InvalidType:
EN: "Valid types are '`messages`' '`karma`', '`rolls`' and '`cookies`'"
CHDE: "Gültigi paramenter sind '`messages`' '`karma`', '`rolls`' und '`cookies`'"
LimitingTo20Warning:
EN: ":warning: Limiting to 20\n"
CHDE: ":warning: Limitiert uf 20\n"
NoTypeFoundForServer:
EN: "No {0} found on this server"
CHDE: "Kei {0} gfunde für dä server"
FailedToResolveAllUsernames:
EN: ":warning: I couldn't find all usernames. Maybe they left the server?\n"
CHDE: ":warning: Ich han nid alli benutzername gfunde. villiicht hend sie de server verlah?\n"
HighscoresFor:
EN: ":bar_chart: **{0} Highscore for {1}**"
CHDE: ":bar_chart: **{0} Highscore für {1}**"
ship:
Matchmaking:
EN: "Matchmaking"
CHDE: "Verkupple"
NotGonnaToHappen:
EN: "Not gonna happen"
CHDE: "Wird nöd klappe"
NotSuchAGoodIdea:
EN: "Not such a good idea"
CHDE: "Nöd so ä gueti idee"
ThereMightBeAChance:
EN: "There might be a chance"
CHDE: "Es gid eventuel ä chance"
CouldWork:
EN: "Almost a match"
CHDE: "Fasch en match"
ItsAMatch:
EN: "It's a match"
CHDE: "Es isch es traumpaar"

View file

@ -1,71 +0,0 @@
using System;
using System.Collections.Generic;
using Geekbot.Core.Localization;
using Moq;
using Xunit;
namespace Tests.Core.Localization
{
public class TranslationGuildContext_test
{
public class FormatDateTimeAsRemainingTestDto
{
public DateTimeOffset DateTime { get; set; }
public string Expected { get; set; }
}
public static TestData<FormatDateTimeAsRemainingTestDto> FormatDateTimeAsRemainingData =>
new TestData<FormatDateTimeAsRemainingTestDto>
{
{
"Wait for days",
new FormatDateTimeAsRemainingTestDto
{
DateTime = DateTimeOffset.Now.AddDays(5),
Expected = "4 days, 23 hours, 59 minutes and 59 seconds"
}
},
{
"Wait for minutes",
new FormatDateTimeAsRemainingTestDto
{
DateTime = DateTimeOffset.Now.AddMinutes(5),
Expected = "4 minutes and 59 seconds"
}
},
{
"Wait for seconds",
new FormatDateTimeAsRemainingTestDto
{
DateTime = DateTimeOffset.Now.AddSeconds(5),
Expected = "4 seconds"
}
}
};
[Theory, MemberData(nameof(FormatDateTimeAsRemainingData))]
public void FormatDateTimeAsRemaining(string testName, FormatDateTimeAsRemainingTestDto testData)
{
var translationHandlerMock = new Mock<ITranslationHandler>(MockBehavior.Loose);
translationHandlerMock
.Setup(thm => thm.GetString("EN", "dateTime", "Days"))
.Returns("day|days");
translationHandlerMock
.Setup(thm => thm.GetString("EN", "dateTime", "Hours"))
.Returns("hour|hours");
translationHandlerMock
.Setup(thm => thm.GetString("EN", "dateTime", "Minutes"))
.Returns("minute|minutes");
translationHandlerMock
.Setup(thm => thm.GetString("EN", "dateTime", "Seconds"))
.Returns("second|seconds");
translationHandlerMock
.Setup(thm => thm.GetString("EN", "dateTime", "And"))
.Returns("and");
var context = new TranslationGuildContext(translationHandlerMock.Object, "EN", new Dictionary<string, string>());
var result = context.FormatDateTimeAsRemaining(testData.DateTime);
Assert.Equal(result, testData.Expected);
}
}
}

View file

@ -1,46 +0,0 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using FluentAssertions;
using Xunit;
using YamlDotNet.Core;
using YamlDotNet.Serialization;
namespace Tests.Core.Localization
{
public class Translations_test
{
[Fact]
public void TranslationsYamlIsValid()
{
// Read the file
var translationFile = File.ReadAllText(Path.GetFullPath("./../../../../src/Core/Localization/Translations.yml"));
// Deserialize
var input = new StringReader(translationFile);
var mergingParser = new MergingParser(new Parser(input));
var deserializer = new DeserializerBuilder().Build();
var rawTranslations = deserializer.Deserialize<Dictionary<string, Dictionary<string, Dictionary<string, string>>>>(mergingParser);
// These languages must be supported
var supportedLanguages = new List<string>
{
"EN",
"CHDE"
};
// Iterate every single key to make sure it's populated
foreach (var command in rawTranslations)
{
foreach (var str in command.Value)
{
str.Value.Select(e => e.Key).ToList().Should().BeEquivalentTo(supportedLanguages, str.Key);
foreach (var lang in str.Value)
{
lang.Value.Should().NotBeNullOrEmpty($"{command.Key} / {str.Key} / {lang.Key}");
}
}
}
}
}
}