chore: code cleanup (mostly whitespace / remove unused imports)
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
using System.Net.WebSockets;
|
||||
|
||||
using App.Metrics;
|
||||
|
||||
using Autofac;
|
||||
@@ -123,7 +121,11 @@ public class Bot
|
||||
{
|
||||
Activities = new[]
|
||||
{
|
||||
new Activity {Name = "Restarting... (please wait)", Type = ActivityType.Game}
|
||||
new Activity
|
||||
{
|
||||
Name = "Restarting... (please wait)",
|
||||
Type = ActivityType.Game
|
||||
}
|
||||
},
|
||||
Status = GatewayStatusUpdate.UserStatus.Idle
|
||||
})));
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using App.Metrics;
|
||||
using App.Metrics.Gauge;
|
||||
using App.Metrics.Meter;
|
||||
using App.Metrics.Timer;
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ public partial class CommandTree
|
||||
await ctx.Reply(
|
||||
$"{Emojis.Error} Unknown command `pk;{ctx.FullCommand().Truncate(100)}`. Perhaps you meant to use one of the following commands?\n{commandListStr}\n\nFor a full list of possible commands, see <https://pluralkit.me/commands>.");
|
||||
}
|
||||
|
||||
private async Task PrintCommandExpectedError(Context ctx, params Command[] potentialCommands)
|
||||
{
|
||||
var commandListStr = CreatePotentialCommandList(potentialCommands);
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
using Humanizer;
|
||||
|
||||
using Myriad.Builders;
|
||||
using Myriad.Types;
|
||||
|
||||
using NodaTime;
|
||||
|
||||
using PluralKit.Core;
|
||||
|
||||
namespace PluralKit.Bot;
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
using Humanizer;
|
||||
|
||||
using Myriad.Builders;
|
||||
using Myriad.Types;
|
||||
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
using NodaTime;
|
||||
|
||||
using PluralKit.Core;
|
||||
|
||||
namespace PluralKit.Bot;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Text;
|
||||
|
||||
using Myriad.Extensions;
|
||||
using Myriad.Rest.Exceptions;
|
||||
using Myriad.Rest.Types;
|
||||
using Myriad.Rest.Types.Requests;
|
||||
|
||||
@@ -5,8 +5,6 @@ using Humanizer;
|
||||
using Myriad.Builders;
|
||||
using Myriad.Types;
|
||||
|
||||
using NodaTime;
|
||||
|
||||
using PluralKit.Core;
|
||||
|
||||
namespace PluralKit.Bot;
|
||||
|
||||
@@ -323,6 +323,7 @@ public class MemberEdit
|
||||
}
|
||||
|
||||
private string boldIf(string str, bool condition) => condition ? $"**{str}**" : str;
|
||||
|
||||
private async Task<EmbedBuilder> CreateMemberNameInfoEmbed(Context ctx, PKMember target)
|
||||
{
|
||||
var lcx = ctx.LookupContextFor(target.System);
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace PluralKit.Bot;
|
||||
public class ProxiedMessage
|
||||
{
|
||||
private static readonly Duration EditTimeout = Duration.FromMinutes(10);
|
||||
|
||||
// private readonly IDiscordCache _cache;
|
||||
private readonly IClock _clock;
|
||||
|
||||
|
||||
@@ -3,10 +3,6 @@ using System.Text.RegularExpressions;
|
||||
using Myriad.Builders;
|
||||
using Myriad.Types;
|
||||
|
||||
using NodaTime;
|
||||
using NodaTime.Text;
|
||||
using NodaTime.TimeZones;
|
||||
|
||||
using PluralKit.Core;
|
||||
|
||||
namespace PluralKit.Bot;
|
||||
@@ -479,9 +475,10 @@ public class SystemEdit
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new PKSyntaxError(
|
||||
"This system does not have a banner image set." + (isOwnSystem ? "Set one by attaching an image to this command, or by passing an image URL or @mention." : ""));
|
||||
throw new PKSyntaxError("This system does not have a banner image set."
|
||||
+ (isOwnSystem ? "Set one by attaching an image to this command, or by passing an image URL or @mention." : ""));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -514,7 +511,6 @@ public class SystemEdit
|
||||
? ctx.Reply(msg, new EmbedBuilder().Image(new Embed.EmbedImage(img.Url)).Build())
|
||||
: ctx.Reply(msg));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async Task Delete(Context ctx, PKSystem target)
|
||||
|
||||
@@ -52,12 +52,7 @@ public class MessageCreated: IEventHandler<MessageCreateEvent>
|
||||
_dmCache = dmCache;
|
||||
}
|
||||
|
||||
// for now, only return error messages for explicit commands
|
||||
public ulong? ErrorChannelFor(MessageCreateEvent evt, ulong userId)
|
||||
{
|
||||
return evt.ChannelId;
|
||||
}
|
||||
|
||||
public ulong? ErrorChannelFor(MessageCreateEvent evt, ulong userId) => evt.ChannelId;
|
||||
private bool IsDuplicateMessage(Message msg) =>
|
||||
// We consider a message duplicate if it has the same ID as the previous message that hit the gateway
|
||||
_lastMessageCache.GetLastMessage(msg.ChannelId)?.Current.Id == msg.Id;
|
||||
|
||||
@@ -63,7 +63,8 @@ public class ProxyService
|
||||
if (autoproxySettings.AutoproxyMode == AutoproxyMode.Latch && IsUnlatch(message))
|
||||
{
|
||||
// "unlatch"
|
||||
await _repo.UpdateAutoproxy(ctx.SystemId.Value, guild.Id, null, new() {
|
||||
await _repo.UpdateAutoproxy(ctx.SystemId.Value, guild.Id, null, new()
|
||||
{
|
||||
AutoproxyMember = null
|
||||
});
|
||||
return false;
|
||||
|
||||
@@ -18,8 +18,8 @@ public class ErrorMessageService
|
||||
// globally rate limit errors for now, don't want to spam users when something breaks
|
||||
private static readonly Duration MinErrorInterval = Duration.FromSeconds(10);
|
||||
private static readonly Duration IntervalFromStartup = Duration.FromMinutes(2);
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly ILogger _logger;
|
||||
private readonly BotConfig _botConfig;
|
||||
private readonly IMetrics _metrics;
|
||||
private readonly DiscordApiClient _rest;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Serilog;
|
||||
|
||||
using Myriad.Cache;
|
||||
using Myriad.Gateway;
|
||||
using Myriad.Rest;
|
||||
|
||||
@@ -10,11 +9,11 @@ namespace PluralKit.Bot;
|
||||
|
||||
public class PrivateChannelService
|
||||
{
|
||||
private static readonly Dictionary<ulong, ulong> _channelsCache = new();
|
||||
|
||||
private readonly ILogger _logger;
|
||||
private readonly ModelRepository _repo;
|
||||
private readonly DiscordApiClient _rest;
|
||||
|
||||
private static Dictionary<ulong, ulong> _channelsCache = new();
|
||||
public PrivateChannelService(ILogger logger, ModelRepository repo, DiscordApiClient rest)
|
||||
{
|
||||
_logger = logger;
|
||||
|
||||
@@ -169,7 +169,8 @@ public static class ContextUtils
|
||||
if (currentPage < 0) currentPage += pageCount;
|
||||
|
||||
// If we can, remove the user's reaction (so they can press again quickly)
|
||||
if ((await ctx.BotPermissions).HasFlag(PermissionSet.ManageMessages)) try
|
||||
if ((await ctx.BotPermissions).HasFlag(PermissionSet.ManageMessages))
|
||||
try
|
||||
{
|
||||
await ctx.Rest.DeleteUserReaction(msg.ChannelId, msg.Id, reaction.Emoji, reaction.UserId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user