Fix build warnings in MediaProvider.cs and TranslationHandler.cs
This commit is contained in:
parent
77e912501d
commit
fff2324232
2 changed files with 15 additions and 14 deletions
|
@ -89,7 +89,7 @@ namespace Geekbot.net.Lib.Localization
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<string> GetServerLanguage(ulong guildId)
|
private Task<string> GetServerLanguage(ulong guildId)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -99,7 +99,7 @@ namespace Geekbot.net.Lib.Localization
|
||||||
lang = _serverLanguages[guildId];
|
lang = _serverLanguages[guildId];
|
||||||
if (!string.IsNullOrEmpty(lang))
|
if (!string.IsNullOrEmpty(lang))
|
||||||
{
|
{
|
||||||
return lang;
|
return Task.FromResult(lang);
|
||||||
}
|
}
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
}
|
}
|
||||||
|
@ -107,13 +107,13 @@ namespace Geekbot.net.Lib.Localization
|
||||||
{
|
{
|
||||||
lang = _guildSettingsManager.GetSettings(guildId, false)?.Language ?? "EN";
|
lang = _guildSettingsManager.GetSettings(guildId, false)?.Language ?? "EN";
|
||||||
_serverLanguages[guildId] = lang;
|
_serverLanguages[guildId] = lang;
|
||||||
return lang;
|
return Task.FromResult(lang);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_logger.Error(LogSource.Geekbot, "Could not get guild language", e);
|
_logger.Error(LogSource.Geekbot, "Could not get guild language", e);
|
||||||
return "EN";
|
return Task.FromResult("EN");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Geekbot.net.Lib.Logger;
|
using Geekbot.net.Lib.Logger;
|
||||||
using Geekbot.net.Lib.RandomNumberGenerator;
|
using Geekbot.net.Lib.RandomNumberGenerator;
|
||||||
|
@ -9,14 +10,14 @@ namespace Geekbot.net.Lib.Media
|
||||||
{
|
{
|
||||||
private readonly IRandomNumberGenerator _random;
|
private readonly IRandomNumberGenerator _random;
|
||||||
private readonly IGeekbotLogger _logger;
|
private readonly IGeekbotLogger _logger;
|
||||||
private string[] _pandaImages;
|
private readonly string[] _pandaImages;
|
||||||
private string[] _croissantImages;
|
private readonly string[] _croissantImages;
|
||||||
private string[] _squirrelImages;
|
private readonly string[] _squirrelImages;
|
||||||
private string[] _pumpkinImages;
|
private readonly string[] _pumpkinImages;
|
||||||
private string[] _turtlesImages;
|
private readonly string[] _turtlesImages;
|
||||||
private string[] _penguinImages;
|
private readonly string[] _penguinImages;
|
||||||
private string[] _foxImages;
|
private readonly string[] _foxImages;
|
||||||
private string[] _dabImages;
|
private readonly string[] _dabImages;
|
||||||
|
|
||||||
public MediaProvider(IGeekbotLogger logger, IRandomNumberGenerator random)
|
public MediaProvider(IGeekbotLogger logger, IRandomNumberGenerator random)
|
||||||
{
|
{
|
||||||
|
@ -24,7 +25,6 @@ namespace Geekbot.net.Lib.Media
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
|
||||||
logger.Information(LogSource.Geekbot, "Loading Media Files");
|
logger.Information(LogSource.Geekbot, "Loading Media Files");
|
||||||
;
|
|
||||||
LoadMedia("./Storage/pandas", ref _pandaImages);
|
LoadMedia("./Storage/pandas", ref _pandaImages);
|
||||||
LoadMedia("./Storage/croissant", ref _croissantImages);
|
LoadMedia("./Storage/croissant", ref _croissantImages);
|
||||||
LoadMedia("./Storage/squirrel", ref _squirrelImages);
|
LoadMedia("./Storage/squirrel", ref _squirrelImages);
|
||||||
|
@ -53,7 +53,8 @@ namespace Geekbot.net.Lib.Media
|
||||||
MediaType.Turtle => _turtlesImages,
|
MediaType.Turtle => _turtlesImages,
|
||||||
MediaType.Penguin => _penguinImages,
|
MediaType.Penguin => _penguinImages,
|
||||||
MediaType.Fox => _foxImages,
|
MediaType.Fox => _foxImages,
|
||||||
MediaType.Dab => _dabImages
|
MediaType.Dab => _dabImages,
|
||||||
|
_ => new string[0]
|
||||||
};
|
};
|
||||||
|
|
||||||
return collection[_random.Next(0, collection.Length)];
|
return collection[_random.Next(0, collection.Length)];
|
||||||
|
|
Loading…
Reference in a new issue