Remove redundant code
This commit is contained in:
parent
dd9cf3c5d7
commit
21f813d342
12 changed files with 19 additions and 29 deletions
|
@ -3,9 +3,7 @@ using System.Net.Http;
|
|||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Commands.Randomness.Dad;
|
||||
using Geekbot.net.Lib.ErrorHandling;
|
||||
using Microsoft.AspNetCore.Hosting.Internal;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Geekbot.net.Commands.Randomness.Kanye
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using Geekbot.net.Database.LoggingAdapter;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.Logger;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Npgsql.Logging;
|
||||
|
||||
namespace Geekbot.net.Database
|
||||
|
|
|
@ -103,7 +103,7 @@ namespace Geekbot.net
|
|||
if (!(message.HasCharPrefix('!', ref argPos) ||
|
||||
message.HasMentionPrefix(_client.CurrentUser, ref argPos))) return Task.CompletedTask;
|
||||
var context = new CommandContext(_client, message);
|
||||
var commandExec = _commands.ExecuteAsync(context, argPos, _servicesProvider);
|
||||
_commands.ExecuteAsync(context, argPos, _servicesProvider);
|
||||
_logger.Information(LogSource.Command,
|
||||
context.Message.Content.Split(" ")[0].Replace("!", ""),
|
||||
SimpleConextConverter.ConvertContext(context));
|
||||
|
|
|
@ -3,7 +3,6 @@ using System.Net;
|
|||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using Discord.Net;
|
||||
using Geekbot.net.Lib.GlobalSettings;
|
||||
using Geekbot.net.Lib.Localization;
|
||||
using Geekbot.net.Lib.Logger;
|
||||
using SharpRaven;
|
||||
|
@ -19,7 +18,7 @@ namespace Geekbot.net.Lib.ErrorHandling
|
|||
private readonly IRavenClient _raven;
|
||||
private readonly bool _errorsInChat;
|
||||
|
||||
public ErrorHandler(IGeekbotLogger logger, ITranslationHandler translation, IGlobalSettings globalSettings, bool errorsInChat)
|
||||
public ErrorHandler(IGeekbotLogger logger, ITranslationHandler translation, bool errorsInChat)
|
||||
{
|
||||
_logger = logger;
|
||||
_translation = translation;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace Geekbot.net.Lib
|
||||
{
|
||||
public enum GeekbotExitCode : int
|
||||
public enum GeekbotExitCode
|
||||
{
|
||||
// General
|
||||
Clean = 0,
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Geekbot.net.Database;
|
||||
using Geekbot.net.Lib.Extensions;
|
||||
using Geekbot.net.Lib.Logger;
|
||||
using Geekbot.net.Lib.UserRepository;
|
||||
|
||||
namespace Geekbot.net.Lib.Highscores
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace Geekbot.net.Lib.ReactionListener
|
|||
LoadListeners();
|
||||
}
|
||||
|
||||
private Task LoadListeners()
|
||||
private void LoadListeners()
|
||||
{
|
||||
var ids = _redis.SetMembers("MessageIds");
|
||||
_listener = new Dictionary<string, Dictionary<IEmote, ulong>>();
|
||||
|
@ -43,8 +43,6 @@ namespace Geekbot.net.Lib.ReactionListener
|
|||
}
|
||||
_listener.Add(messageId, emojiDict);
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public bool IsListener(ulong id)
|
||||
|
|
|
@ -21,6 +21,7 @@ using Geekbot.net.Lib.Media;
|
|||
using Geekbot.net.Lib.RandomNumberGenerator;
|
||||
using Geekbot.net.Lib.ReactionListener;
|
||||
using Geekbot.net.Lib.UserRepository;
|
||||
using Geekbot.net.WebApi;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using WikipediaApi;
|
||||
|
@ -125,8 +126,8 @@ namespace Geekbot.net
|
|||
var wikipediaClient = new WikipediaClient();
|
||||
var randomNumberGenerator = new RandomNumberGenerator();
|
||||
|
||||
_services.AddSingleton<IAlmostRedis>(_redis);
|
||||
_services.AddSingleton<IUserRepository>(_userRepository);
|
||||
_services.AddSingleton(_redis);
|
||||
_services.AddSingleton(_userRepository);
|
||||
_services.AddSingleton<IGeekbotLogger>(logger);
|
||||
_services.AddSingleton<ILevelCalc>(levelCalc);
|
||||
_services.AddSingleton<IEmojiConverter>(emojiConverter);
|
||||
|
@ -136,9 +137,9 @@ namespace Geekbot.net
|
|||
_services.AddSingleton<IMtgManaConverter>(mtgManaConverter);
|
||||
_services.AddSingleton<IWikipediaClient>(wikipediaClient);
|
||||
_services.AddSingleton<IRandomNumberGenerator>(randomNumberGenerator);
|
||||
_services.AddSingleton<IGlobalSettings>(_globalSettings);
|
||||
_services.AddTransient<IHighscoreManager>((e) => new HighscoreManager(_databaseInitializer.Initialize(), _userRepository));
|
||||
_services.AddTransient<DatabaseContext>((e) => _databaseInitializer.Initialize());
|
||||
_services.AddSingleton(_globalSettings);
|
||||
_services.AddTransient<IHighscoreManager>(e => new HighscoreManager(_databaseInitializer.Initialize(), _userRepository));
|
||||
_services.AddTransient(e => _databaseInitializer.Initialize());
|
||||
|
||||
logger.Information(LogSource.Geekbot, "Connecting to Discord");
|
||||
|
||||
|
@ -162,7 +163,7 @@ namespace Geekbot.net
|
|||
|
||||
_logger.Information(LogSource.Geekbot, "Registering Stuff");
|
||||
var translationHandler = new TranslationHandler(_databaseInitializer.Initialize(), _logger);
|
||||
var errorHandler = new ErrorHandler(_logger, translationHandler, _globalSettings, _runParameters.ExposeErrors);
|
||||
var errorHandler = new ErrorHandler(_logger, translationHandler, _runParameters.ExposeErrors);
|
||||
var reactionListener = new ReactionListener(_redis.Db);
|
||||
_services.AddSingleton<IErrorHandler>(errorHandler);
|
||||
_services.AddSingleton<ITranslationHandler>(translationHandler);
|
||||
|
@ -207,7 +208,7 @@ namespace Geekbot.net
|
|||
{
|
||||
_logger.Information(LogSource.Api, "Starting Webserver");
|
||||
var highscoreManager = new HighscoreManager(_databaseInitializer.Initialize(), _userRepository);
|
||||
WebApi.WebApiStartup.StartWebApi(_logger, _runParameters, _commands, _databaseInitializer.Initialize(), _client, _globalSettings, highscoreManager);
|
||||
WebApiStartup.StartWebApi(_logger, _runParameters, _commands, _databaseInitializer.Initialize(), _client, _globalSettings, highscoreManager);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Geekbot.net.WebApi.Controllers.Commands
|
||||
{
|
||||
|
|
|
@ -29,11 +29,11 @@ namespace Geekbot.net.WebApi
|
|||
.ConfigureServices(services =>
|
||||
{
|
||||
services.AddMvc();
|
||||
services.AddSingleton<CommandService>(commandService);
|
||||
services.AddSingleton<DatabaseContext>(databaseContext);
|
||||
services.AddSingleton<DiscordSocketClient>(client);
|
||||
services.AddSingleton<IGlobalSettings>(globalSettings);
|
||||
services.AddSingleton<IHighscoreManager>(highscoreManager);
|
||||
services.AddSingleton(commandService);
|
||||
services.AddSingleton(databaseContext);
|
||||
services.AddSingleton(client);
|
||||
services.AddSingleton(globalSettings);
|
||||
services.AddSingleton(highscoreManager);
|
||||
services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy("AllowSpecificOrigin",
|
||||
|
|
Loading…
Reference in a new issue