General cleanup

This commit is contained in:
Deukhoofd 2019-01-31 11:52:08 +01:00
parent 89dd74c711
commit af39acfe03
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
24 changed files with 17 additions and 34 deletions

View File

@ -4,7 +4,6 @@ using System.Net.Http;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web; using System.Web;
using Discord;
namespace DeukBot4.APIHandlers namespace DeukBot4.APIHandlers
{ {

View File

@ -1,5 +1,4 @@
using System; using System;
using DeukBot4.MessageHandlers.Permissions;
using Npgsql; using Npgsql;
namespace DeukBot4.Database namespace DeukBot4.Database

View File

@ -6,6 +6,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Discord.Net" Version="2.0.0-beta2-01018" /> <PackageReference Include="Discord.Net" Version="2.0.0-beta2-01018" />
<PackageReference Include="JetBrains.Annotations" Version="2018.3.0" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" /> <PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="Npgsql" Version="4.0.3" /> <PackageReference Include="Npgsql" Version="4.0.3" />
<PackageReference Include="StackExchange.Redis" Version="2.0.513" /> <PackageReference Include="StackExchange.Redis" Version="2.0.513" />

View File

@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks; using System.Threading.Tasks;
using Discord; using Discord;

View File

@ -1,9 +1,11 @@
using System; using System;
using DeukBot4.MessageHandlers.Permissions; using DeukBot4.MessageHandlers.Permissions;
using JetBrains.Annotations;
namespace DeukBot4.MessageHandlers namespace DeukBot4.MessageHandlers
{ {
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
[MeansImplicitUse]
public class CommandAttribute : Attribute public class CommandAttribute : Attribute
{ {
public string Command { get; } public string Command { get; }

View File

@ -1,7 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection.Metadata.Ecma335;
using DeukBot4.MessageHandlers.CommandHandler.RequestStructure;
namespace DeukBot4.MessageHandlers.CommandHandler namespace DeukBot4.MessageHandlers.CommandHandler
{ {

View File

@ -1,13 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using DeukBot4.MessageHandlers.CommandHandler.RequestStructure; using DeukBot4.MessageHandlers.CommandHandler.RequestStructure;
using DeukBot4.MessageHandlers.Permissions; using DeukBot4.MessageHandlers.Permissions;
using DeukBot4.Utilities; using DeukBot4.Utilities;
using Discord; using Discord;
using Discord.WebSocket;
namespace DeukBot4.MessageHandlers.CommandHandler namespace DeukBot4.MessageHandlers.CommandHandler
{ {

View File

@ -1,20 +1,16 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq;
using System.Net;
using System.Text; using System.Text;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web;
using DeukBot4.APIHandlers; using DeukBot4.APIHandlers;
using DeukBot4.Database; using DeukBot4.Database;
using DeukBot4.MessageHandlers.CommandHandler.RequestStructure; using DeukBot4.MessageHandlers.CommandHandler.RequestStructure;
using DeukBot4.MessageHandlers.Permissions; using DeukBot4.MessageHandlers.Permissions;
using DeukBot4.Utilities; using DeukBot4.Utilities;
using Discord; using Discord;
using Discord.Rest;
using Discord.WebSocket; using Discord.WebSocket;
#pragma warning disable 4014
namespace DeukBot4.MessageHandlers.CommandHandler namespace DeukBot4.MessageHandlers.CommandHandler
{ {
@ -259,7 +255,7 @@ namespace DeukBot4.MessageHandlers.CommandHandler
} }
if (sb.Length > 0) if (sb.Length > 0)
eb.AddField("Roles", sb.ToString(), false); eb.AddField("Roles", sb.ToString());
} }

View File

@ -5,6 +5,7 @@ using DeukBot4.MessageHandlers.CommandHandler.RequestStructure;
using DeukBot4.MessageHandlers.JokeHandling; using DeukBot4.MessageHandlers.JokeHandling;
using DeukBot4.MessageHandlers.Permissions; using DeukBot4.MessageHandlers.Permissions;
using Discord; using Discord;
#pragma warning disable 4014
namespace DeukBot4.MessageHandlers.CommandHandler namespace DeukBot4.MessageHandlers.CommandHandler
{ {

View File

@ -7,6 +7,7 @@ using DeukBot4.MessageHandlers.Permissions;
using DeukBot4.Utilities; using DeukBot4.Utilities;
using Discord; using Discord;
using Discord.WebSocket; using Discord.WebSocket;
#pragma warning disable 4014
namespace DeukBot4.MessageHandlers.CommandHandler namespace DeukBot4.MessageHandlers.CommandHandler
{ {
@ -222,12 +223,16 @@ namespace DeukBot4.MessageHandlers.CommandHandler
} }
} }
private async Task<string> SilenceUser(IGuildUser user, TimeSpan span) private static async Task<string> SilenceUser(IGuildUser user, TimeSpan span)
{ {
if (user.Id == Program.BotId) if (user.Id == Program.BotId)
{ {
return "Stop trying to mute me."; return "Stop trying to mute me.";
} }
if (span.TotalHours > 24)
return "Can't mute for that long.";
var silencedRoleId = ServerSettingHandler.GetSettings(user.GuildId).MutedRoleId; var silencedRoleId = ServerSettingHandler.GetSettings(user.GuildId).MutedRoleId;
if (silencedRoleId == 0) if (silencedRoleId == 0)
{ {

View File

@ -1,8 +1,6 @@
using System; using System.Threading.Tasks;
using System.Threading.Tasks;
using DeukBot4.MessageHandlers.CommandHandler.RequestStructure; using DeukBot4.MessageHandlers.CommandHandler.RequestStructure;
using DeukBot4.MessageHandlers.Permissions; using DeukBot4.MessageHandlers.Permissions;
using DeukBot4.Utilities;
using Discord; using Discord;
namespace DeukBot4.MessageHandlers.CommandHandler namespace DeukBot4.MessageHandlers.CommandHandler
@ -33,7 +31,7 @@ namespace DeukBot4.MessageHandlers.CommandHandler
[Command("dm", PermissionLevel.BotCreator)] [Command("dm", PermissionLevel.BotCreator)]
[CommandParameters(ParameterMatcher.ParameterType.Number, ParameterMatcher.ParameterType.Remainder)] [CommandParameters(ParameterMatcher.ParameterType.Number, ParameterMatcher.ParameterType.Remainder)]
public async Task DMMessage(CommandRequest request) public async Task DmMessage(CommandRequest request)
{ {
if (request.Parameters.Length < 2) if (request.Parameters.Length < 2)
return; return;

View File

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;

View File

@ -4,7 +4,6 @@ using System.Linq;
using System.Net; using System.Net;
using System.Threading.Tasks; using System.Threading.Tasks;
using Discord; using Discord;
using Discord.WebSocket;
namespace DeukBot4.MessageHandlers namespace DeukBot4.MessageHandlers
{ {

View File

@ -1,7 +1,6 @@
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using Discord; using Discord;
using Discord.WebSocket;
namespace DeukBot4.MessageHandlers.JokeHandling namespace DeukBot4.MessageHandlers.JokeHandling
{ {

View File

@ -2,7 +2,6 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using DeukBot4.APIHandlers; using DeukBot4.APIHandlers;
using DeukBot4.Utilities; using DeukBot4.Utilities;
using Discord.WebSocket;
namespace DeukBot4.MessageHandlers.JokeHandling namespace DeukBot4.MessageHandlers.JokeHandling
{ {

View File

@ -1,8 +1,9 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Discord.WebSocket; using JetBrains.Annotations;
namespace DeukBot4.MessageHandlers.JokeHandling namespace DeukBot4.MessageHandlers.JokeHandling
{ {
[UsedImplicitly]
public interface IJokeController public interface IJokeController
{ {
string Id { get; } string Id { get; }

View File

@ -4,7 +4,6 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using DeukBot4.Database.ServerSettings; using DeukBot4.Database.ServerSettings;
using Discord; using Discord;
using Discord.WebSocket;
namespace DeukBot4.MessageHandlers.JokeHandling namespace DeukBot4.MessageHandlers.JokeHandling
{ {

View File

@ -1,6 +1,5 @@
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using Discord.WebSocket;
namespace DeukBot4.MessageHandlers.JokeHandling namespace DeukBot4.MessageHandlers.JokeHandling
{ {

View File

@ -1,10 +1,8 @@
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using DeukBot4.Database; using DeukBot4.Database;
using DeukBot4.MessageHandlers.CommandHandler.RequestStructure;
using Discord; using Discord;
using Discord.WebSocket; using Discord.WebSocket;

View File

@ -6,7 +6,6 @@ using DeukBot4.Database;
using DeukBot4.MessageHandlers.CommandHandler; using DeukBot4.MessageHandlers.CommandHandler;
using DeukBot4.MessageHandlers.Permissions; using DeukBot4.MessageHandlers.Permissions;
using Discord; using Discord;
using Discord.WebSocket;
namespace DeukBot4.MessageHandlers namespace DeukBot4.MessageHandlers
{ {

View File

@ -3,7 +3,6 @@ using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using DeukBot4.MessageHandlers.CommandHandler; using DeukBot4.MessageHandlers.CommandHandler;
using DeukBot4.Utilities; using DeukBot4.Utilities;
using Discord.WebSocket;
namespace DeukBot4.MessageHandlers namespace DeukBot4.MessageHandlers
{ {

View File

@ -6,9 +6,7 @@ using DeukBot4.MessageHandlers;
using DeukBot4.MessageHandlers.CommandHandler; using DeukBot4.MessageHandlers.CommandHandler;
using DeukBot4.MessageHandlers.JokeHandling; using DeukBot4.MessageHandlers.JokeHandling;
using Discord; using Discord;
using Discord.Commands.Builders;
using Discord.WebSocket; using Discord.WebSocket;
using StackExchange.Redis;
using ReminderHandler = DeukBot4.Database.ReminderHandler; using ReminderHandler = DeukBot4.Database.ReminderHandler;
namespace DeukBot4 namespace DeukBot4

View File

@ -1,5 +1,4 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.IO; using System.IO;
using DeukBot4.MessageHandlers; using DeukBot4.MessageHandlers;
using Newtonsoft.Json; using Newtonsoft.Json;

View File

@ -1,5 +1,4 @@
using System; using System;
using System.Threading.Tasks;
using DeukBot4.MessageHandlers.CommandHandler.RequestStructure; using DeukBot4.MessageHandlers.CommandHandler.RequestStructure;
namespace DeukBot4.Utilities namespace DeukBot4.Utilities