mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
Fixed around 140 wrong namings and other refactorings which were marked as warnings
This commit is contained in:
@@ -87,8 +87,8 @@ public partial class Administration : NadekoModule<AdministrationService>
|
||||
channels.Select(x =>
|
||||
{
|
||||
var ch = guild.GetChannel(x.ChannelId)?.ToString() ?? x.ChannelId.ToString();
|
||||
var prefix = x.State ? "✅ " : "❌ ";
|
||||
return prefix + ch;
|
||||
var prefixSign = x.State ? "✅ " : "❌ ";
|
||||
return prefixSign + ch;
|
||||
}));
|
||||
|
||||
if (string.IsNullOrWhiteSpace(str))
|
||||
@@ -319,7 +319,7 @@ public partial class Administration : NadekoModule<AdministrationService>
|
||||
}
|
||||
else if (time.Time <= TimeSpan.FromDays(7))
|
||||
{
|
||||
var _ = Task.Run(async () =>
|
||||
_= Task.Run(async () =>
|
||||
{
|
||||
await Task.Delay(time.Time);
|
||||
await msg.DeleteAsync();
|
||||
|
@@ -41,7 +41,7 @@ public class AdministrationService : INService
|
||||
|
||||
private Task DelMsgOnCmd_Handler(IUserMessage msg, CommandInfo cmd)
|
||||
{
|
||||
var _ = Task.Run(async () =>
|
||||
_= Task.Run(async () =>
|
||||
{
|
||||
if (msg.Channel is not SocketTextChannel channel)
|
||||
return;
|
||||
|
@@ -63,7 +63,7 @@ namespace NadekoBot.Modules.Administration
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public partial Task DeleteWaifus()
|
||||
=> SqlExec(DangerousCommandsService.WaifusDeleteSql);
|
||||
=> SqlExec(DangerousCommandsService.WAIFUS_DELETE_SQL);
|
||||
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
@@ -73,22 +73,22 @@ namespace NadekoBot.Modules.Administration
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public partial Task DeleteWaifu(ulong userId)
|
||||
=> InternalExecSql(DangerousCommandsService.WaifuDeleteSql, userId);
|
||||
=> InternalExecSql(DangerousCommandsService.WAIFU_DELETE_SQL, userId);
|
||||
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public partial Task DeleteCurrency()
|
||||
=> SqlExec(DangerousCommandsService.CurrencyDeleteSql);
|
||||
=> SqlExec(DangerousCommandsService.CURRENCY_DELETE_SQL);
|
||||
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public partial Task DeletePlaylists()
|
||||
=> SqlExec(DangerousCommandsService.MusicPlaylistDeleteSql);
|
||||
=> SqlExec(DangerousCommandsService.MUSIC_PLAYLIST_DELETE_SQL);
|
||||
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public partial Task DeleteXp()
|
||||
=> SqlExec(DangerousCommandsService.XpDeleteSql);
|
||||
=> SqlExec(DangerousCommandsService.XP_DELETE_SQL);
|
||||
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
|
@@ -8,22 +8,22 @@ namespace NadekoBot.Modules.Administration.Services;
|
||||
|
||||
public class DangerousCommandsService : INService
|
||||
{
|
||||
public const string WaifusDeleteSql = @"DELETE FROM WaifuUpdates;
|
||||
public const string WAIFUS_DELETE_SQL = @"DELETE FROM WaifuUpdates;
|
||||
DELETE FROM WaifuItem;
|
||||
DELETE FROM WaifuInfo;";
|
||||
|
||||
public const string WaifuDeleteSql =
|
||||
public const string WAIFU_DELETE_SQL =
|
||||
@"DELETE FROM WaifuUpdates WHERE UserId=(SELECT Id FROM DiscordUser WHERE UserId={0});
|
||||
DELETE FROM WaifuItem WHERE WaifuInfoId=(SELECT Id FROM WaifuInfo WHERE WaifuId=(SELECT Id FROM DiscordUser WHERE UserId={0}));
|
||||
UPDATE WaifuInfo SET ClaimerId=NULL WHERE ClaimerId=(SELECT Id FROM DiscordUser WHERE UserId={0});
|
||||
DELETE FROM WaifuInfo WHERE WaifuId=(SELECT Id FROM DiscordUser WHERE UserId={0});";
|
||||
|
||||
public const string CurrencyDeleteSql =
|
||||
public const string CURRENCY_DELETE_SQL =
|
||||
"UPDATE DiscordUser SET CurrencyAmount=0; DELETE FROM CurrencyTransactions; DELETE FROM PlantedCurrency;";
|
||||
|
||||
public const string MusicPlaylistDeleteSql = "DELETE FROM MusicPlaylists;";
|
||||
public const string MUSIC_PLAYLIST_DELETE_SQL = "DELETE FROM MusicPlaylists;";
|
||||
|
||||
public const string XpDeleteSql = @"DELETE FROM UserXpStats;
|
||||
public const string XP_DELETE_SQL = @"DELETE FROM UserXpStats;
|
||||
UPDATE DiscordUser
|
||||
SET ClubId=NULL,
|
||||
IsClubAdmin=0,
|
||||
|
@@ -27,7 +27,7 @@ public class GameVoiceChannelService : INService
|
||||
|
||||
private Task OnPresenceUpdate(SocketUser socketUser, SocketPresence before, SocketPresence after)
|
||||
{
|
||||
var _ = Task.Run(async () =>
|
||||
_= Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -83,7 +83,7 @@ public class GameVoiceChannelService : INService
|
||||
|
||||
private Task OnUserVoiceStateUpdated(SocketUser usr, SocketVoiceState oldState, SocketVoiceState newState)
|
||||
{
|
||||
var _ = Task.Run(async () =>
|
||||
_= Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@@ -107,7 +107,7 @@ public class GreetService : INService, IReadyExecutor
|
||||
|
||||
private Task OnUserLeft(SocketGuild guild, SocketUser user)
|
||||
{
|
||||
var _ = Task.Run(async () =>
|
||||
_= Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -271,7 +271,7 @@ public class GreetService : INService, IReadyExecutor
|
||||
|
||||
private Task OnUserJoined(IGuildUser user)
|
||||
{
|
||||
var _ = Task.Run(async () =>
|
||||
_= Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@@ -31,7 +31,7 @@ public sealed class ImageOnlyChannelService : IEarlyBehavior
|
||||
var uow = _db.GetDbContext();
|
||||
_enabledOn = uow.ImageOnlyChannels.ToList()
|
||||
.GroupBy(x => x.GuildId)
|
||||
.ToDictionary(x => x.Key, x => new ConcurrentHashSet<ulong>(x.Select(x => x.ChannelId)))
|
||||
.ToDictionary(x => x.Key, x => new ConcurrentHashSet<ulong>(x.Select(y => y.ChannelId)))
|
||||
.ToConcurrent();
|
||||
|
||||
_ = Task.Run(DeleteQueueRunner);
|
||||
|
@@ -126,7 +126,7 @@ public class MuteService : INService
|
||||
if (string.IsNullOrWhiteSpace(reason))
|
||||
return;
|
||||
|
||||
var _ = Task.Run(() => user.SendMessageAsync(embed: _eb.Create()
|
||||
_= Task.Run(() => user.SendMessageAsync(embed: _eb.Create()
|
||||
.WithDescription(
|
||||
$"You've been muted in {user.Guild} server")
|
||||
.AddField("Mute Type", type.ToString())
|
||||
@@ -144,7 +144,7 @@ public class MuteService : INService
|
||||
if (string.IsNullOrWhiteSpace(reason))
|
||||
return;
|
||||
|
||||
var _ = Task.Run(() => user.SendMessageAsync(embed: _eb.Create()
|
||||
_= Task.Run(() => user.SendMessageAsync(embed: _eb.Create()
|
||||
.WithDescription(
|
||||
$"You've been unmuted in {user.Guild} server")
|
||||
.AddField("Unmute Type", type.ToString())
|
||||
@@ -161,7 +161,7 @@ public class MuteService : INService
|
||||
|
||||
if (muted is null || !muted.Contains(usr.Id))
|
||||
return Task.CompletedTask;
|
||||
var _ = Task.Run(() => MuteUser(usr, _client.CurrentUser, reason: "Sticky mute"));
|
||||
_= Task.Run(() => MuteUser(usr, _client.CurrentUser, reason: "Sticky mute"));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -417,6 +417,9 @@ public class MuteService : INService
|
||||
{
|
||||
try
|
||||
{
|
||||
if (roleId is null)
|
||||
return;
|
||||
|
||||
RemoveTimerFromDb(guildId, userId, type);
|
||||
StopTimer(guildId, userId, type);
|
||||
var guild = _client.GetGuild(guildId);
|
||||
|
@@ -20,36 +20,36 @@ public partial class Administration
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[Priority(0)]
|
||||
public partial Task Prefix(Set _, [Leftover] string prefix)
|
||||
=> Prefix(prefix);
|
||||
public partial Task Prefix(Set _, [Leftover] string newPrefix)
|
||||
=> Prefix(newPrefix);
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[Priority(0)]
|
||||
public async partial Task Prefix([Leftover] string prefix)
|
||||
public async partial Task Prefix([Leftover] string toSet)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(prefix))
|
||||
return;
|
||||
|
||||
var oldPrefix = base.prefix;
|
||||
var newPrefix = CmdHandler.SetPrefix(ctx.Guild, prefix);
|
||||
var oldPrefix = prefix;
|
||||
var newPrefix = CmdHandler.SetPrefix(ctx.Guild, toSet);
|
||||
|
||||
await ReplyConfirmLocalizedAsync(strs.prefix_new(Format.Code(oldPrefix), Format.Code(newPrefix)));
|
||||
}
|
||||
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async partial Task DefPrefix([Leftover] string prefix = null)
|
||||
public async partial Task DefPrefix([Leftover] string toSet = null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(prefix))
|
||||
if (string.IsNullOrWhiteSpace(toSet))
|
||||
{
|
||||
await ReplyConfirmLocalizedAsync(strs.defprefix_current(CmdHandler.GetPrefix()));
|
||||
return;
|
||||
}
|
||||
|
||||
var oldPrefix = CmdHandler.GetPrefix();
|
||||
var newPrefix = CmdHandler.SetDefaultPrefix(prefix);
|
||||
var newPrefix = CmdHandler.SetDefaultPrefix(toSet);
|
||||
|
||||
await ReplyConfirmLocalizedAsync(strs.defprefix_new(Format.Code(oldPrefix), Format.Code(newPrefix)));
|
||||
}
|
||||
|
@@ -94,7 +94,7 @@ public class ProtectionService : INService
|
||||
|
||||
private Task _client_LeftGuild(SocketGuild guild)
|
||||
{
|
||||
var _ = Task.Run(async () =>
|
||||
_= Task.Run(async () =>
|
||||
{
|
||||
TryStopAntiRaid(guild.Id);
|
||||
TryStopAntiSpam(guild.Id);
|
||||
@@ -202,7 +202,7 @@ public class ProtectionService : INService
|
||||
|
||||
if (msg.Channel is not ITextChannel channel)
|
||||
return Task.CompletedTask;
|
||||
var _ = Task.Run(async () =>
|
||||
_= Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@@ -38,15 +38,15 @@ public class AntiAltStats
|
||||
=> _setting.MinAge;
|
||||
|
||||
public int Counter
|
||||
=> _counter;
|
||||
=> counter;
|
||||
|
||||
private readonly AntiAltSetting _setting;
|
||||
|
||||
private int _counter;
|
||||
private int counter;
|
||||
|
||||
public AntiAltStats(AntiAltSetting setting)
|
||||
=> _setting = setting;
|
||||
|
||||
public void Increment()
|
||||
=> Interlocked.Increment(ref _counter);
|
||||
=> Interlocked.Increment(ref counter);
|
||||
}
|
@@ -8,7 +8,7 @@ public partial class Administration
|
||||
[Group]
|
||||
public partial class PruneCommands : NadekoSubmodule<PruneService>
|
||||
{
|
||||
private static readonly TimeSpan twoWeeks = TimeSpan.FromDays(14);
|
||||
private static readonly TimeSpan _twoWeeks = TimeSpan.FromDays(14);
|
||||
|
||||
//delets her own messages, no perm required
|
||||
[Cmd]
|
||||
@@ -73,11 +73,11 @@ public partial class Administration
|
||||
if (parameter is "-s" or "--safe")
|
||||
await _service.PruneWhere((ITextChannel)ctx.Channel,
|
||||
count,
|
||||
m => m.Author.Id == userId && DateTime.UtcNow - m.CreatedAt < twoWeeks && !m.IsPinned);
|
||||
m => m.Author.Id == userId && DateTime.UtcNow - m.CreatedAt < _twoWeeks && !m.IsPinned);
|
||||
else
|
||||
await _service.PruneWhere((ITextChannel)ctx.Channel,
|
||||
count,
|
||||
m => m.Author.Id == userId && DateTime.UtcNow - m.CreatedAt < twoWeeks);
|
||||
m => m.Author.Id == userId && DateTime.UtcNow - m.CreatedAt < _twoWeeks);
|
||||
}
|
||||
}
|
||||
}
|
@@ -13,7 +13,7 @@ public partial class Administration
|
||||
{
|
||||
public enum Exclude { Excl }
|
||||
|
||||
private IServiceProvider _services;
|
||||
private readonly IServiceProvider _services;
|
||||
|
||||
public RoleCommands(IServiceProvider services)
|
||||
=> _services = services;
|
||||
@@ -24,7 +24,7 @@ public partial class Administration
|
||||
? await ctx.Channel.GetMessageAsync(msgId)
|
||||
: (await ctx.Channel.GetMessagesAsync(2).FlattenAsync()).Skip(1).FirstOrDefault();
|
||||
|
||||
if (input.Length % 2 != 0)
|
||||
if (input.Length % 2 != 0 || target is null)
|
||||
return;
|
||||
|
||||
var all = await input.Chunk(input.Length / 2)
|
||||
@@ -35,7 +35,7 @@ public partial class Administration
|
||||
var roleResult = await roleReader.ReadAsync(ctx, inputRoleStr, _services);
|
||||
if (!roleResult.IsSuccess)
|
||||
{
|
||||
Log.Warning("Role {0} not found.", inputRoleStr);
|
||||
Log.Warning("Role {Role} not found", inputRoleStr);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -163,7 +163,6 @@ public partial class Administration
|
||||
if (index < 1 || !_service.Get(ctx.Guild.Id, out var rrs) || !rrs.Any() || rrs.Count < index)
|
||||
return;
|
||||
index--;
|
||||
var rr = rrs[index];
|
||||
_service.Remove(ctx.Guild.Id, index);
|
||||
await ReplyConfirmLocalizedAsync(strs.reaction_role_removed(index + 1));
|
||||
}
|
||||
|
@@ -90,7 +90,7 @@ public class RoleCommandsService : INService
|
||||
await dl.RemoveReactionAsync(reaction.Emote,
|
||||
dl.Author,
|
||||
new() { RetryMode = RetryMode.RetryRatelimit | RetryMode.Retry502 });
|
||||
Log.Warning("User {0} is adding unrelated reactions to the reaction roles message.", dl.Author);
|
||||
Log.Warning("User {Author} is adding unrelated reactions to the reaction roles message", dl.Author);
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -58,8 +58,6 @@ public partial class Administration
|
||||
[Priority(0)]
|
||||
public async partial Task Sargn(int group, [Leftover] string name = null)
|
||||
{
|
||||
var guser = (IGuildUser)ctx.User;
|
||||
|
||||
var set = await _service.SetNameAsync(ctx.Guild.Id, group, name);
|
||||
|
||||
if (set)
|
||||
@@ -106,7 +104,7 @@ public partial class Administration
|
||||
|
||||
foreach (var kvp in roleGroups)
|
||||
{
|
||||
var groupNameText = string.Empty;
|
||||
string groupNameText;
|
||||
if (!groups.TryGetValue(kvp.Key, out var name))
|
||||
groupNameText = Format.Bold(GetText(strs.self_assign_group(kvp.Key)));
|
||||
else
|
||||
|
@@ -158,7 +158,7 @@ public class SelfAssignedRolesService : INService
|
||||
return success;
|
||||
}
|
||||
|
||||
public (bool AutoDelete, bool Exclusive, IEnumerable<SelfAssignedRole>) GetAdAndRoles(ulong guildId)
|
||||
public (bool AutoDelete, bool Exclusive, IReadOnlyCollection<SelfAssignedRole>) GetAdAndRoles(ulong guildId)
|
||||
{
|
||||
using var uow = _db.GetDbContext();
|
||||
var gc = uow.GuildConfigsForId(guildId, set => set);
|
||||
@@ -198,12 +198,12 @@ public class SelfAssignedRolesService : INService
|
||||
return areExclusive;
|
||||
}
|
||||
|
||||
public (bool Exclusive, IEnumerable<(SelfAssignedRole Model, IRole Role)> Roles, IDictionary<int, string> GroupNames
|
||||
public (bool Exclusive, IReadOnlyCollection<(SelfAssignedRole Model, IRole Role)> Roles, IDictionary<int, string> GroupNames
|
||||
) GetRoles(IGuild guild)
|
||||
{
|
||||
var exclusive = false;
|
||||
|
||||
IEnumerable<(SelfAssignedRole Model, IRole Role)> roles;
|
||||
IReadOnlyCollection<(SelfAssignedRole Model, IRole Role)> roles;
|
||||
IDictionary<int, string> groupNames;
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
@@ -211,11 +211,12 @@ public class SelfAssignedRolesService : INService
|
||||
exclusive = gc.ExclusiveSelfAssignedRoles;
|
||||
groupNames = gc.SelfAssignableRoleGroupNames.ToDictionary(x => x.Number, x => x.Name);
|
||||
var roleModels = uow.SelfAssignableRoles.GetFromGuild(guild.Id);
|
||||
roles = roleModels.Select(x => (Model: x, Role: guild.GetRole(x.RoleId)));
|
||||
roles = roleModels.Select(x => (Model: x, Role: guild.GetRole(x.RoleId)))
|
||||
.ToList();
|
||||
uow.SelfAssignableRoles.RemoveRange(roles.Where(x => x.Role is null).Select(x => x.Model).ToArray());
|
||||
uow.SaveChanges();
|
||||
}
|
||||
|
||||
return (exclusive, roles.Where(x => x.Role is not null), groupNames);
|
||||
return (exclusive, roles.Where(x => x.Role is not null).ToList(), groupNames);
|
||||
}
|
||||
}
|
@@ -183,7 +183,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
||||
|
||||
private Task _client_UserUpdated(SocketUser before, SocketUser uAfter)
|
||||
{
|
||||
var _ = Task.Run(async () =>
|
||||
_= Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -292,7 +292,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
||||
case LogType.VoicePresence:
|
||||
channelId = logSetting.LogVoicePresenceId = logSetting.LogVoicePresenceId is null ? cid : default;
|
||||
break;
|
||||
case LogType.VoicePresenceTTS:
|
||||
case LogType.VoicePresenceTts:
|
||||
channelId = logSetting.LogVoicePresenceTTSId =
|
||||
logSetting.LogVoicePresenceTTSId is null ? cid : default;
|
||||
break;
|
||||
@@ -306,7 +306,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
||||
|
||||
private Task _client_UserVoiceStateUpdated_TTS(SocketUser iusr, SocketVoiceState before, SocketVoiceState after)
|
||||
{
|
||||
var _ = Task.Run(async () =>
|
||||
_= Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -324,7 +324,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
||||
return;
|
||||
|
||||
ITextChannel? logChannel;
|
||||
if ((logChannel = await TryGetLogChannel(usr.Guild, logSetting, LogType.VoicePresenceTTS)) is null)
|
||||
if ((logChannel = await TryGetLogChannel(usr.Guild, logSetting, LogType.VoicePresenceTts)) is null)
|
||||
return;
|
||||
|
||||
var str = string.Empty;
|
||||
@@ -351,8 +351,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
||||
IUser mod,
|
||||
MuteType muteType,
|
||||
string reason)
|
||||
{
|
||||
var _ = Task.Run(async () =>
|
||||
=> _= Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -391,15 +390,13 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
||||
// ignored
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void MuteCommands_UserUnmuted(
|
||||
IGuildUser usr,
|
||||
IUser mod,
|
||||
MuteType muteType,
|
||||
string reason)
|
||||
{
|
||||
var _ = Task.Run(async () =>
|
||||
=> _= Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -443,11 +440,10 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
||||
// ignored
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Task TriggeredAntiProtection(PunishmentAction action, ProtectionType protection, params IGuildUser[] users)
|
||||
{
|
||||
var _ = Task.Run(async () =>
|
||||
_= Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -517,7 +513,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
||||
|
||||
private Task _client_GuildUserUpdated(Cacheable<SocketGuildUser, ulong> optBefore, SocketGuildUser after)
|
||||
{
|
||||
var _ = Task.Run(async () =>
|
||||
_= Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -620,7 +616,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
||||
|
||||
private Task _client_ChannelUpdated(IChannel cbefore, IChannel cafter)
|
||||
{
|
||||
var _ = Task.Run(async () =>
|
||||
_= Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -668,7 +664,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
||||
|
||||
private Task _client_ChannelDestroyed(IChannel ich)
|
||||
{
|
||||
var _ = Task.Run(async () =>
|
||||
_= Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -706,7 +702,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
||||
|
||||
private Task _client_ChannelCreated(IChannel ich)
|
||||
{
|
||||
var _ = Task.Run(async () =>
|
||||
_= Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -742,7 +738,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
||||
|
||||
private Task _client_UserVoiceStateUpdated(SocketUser iusr, SocketVoiceState before, SocketVoiceState after)
|
||||
{
|
||||
var _ = Task.Run(async () =>
|
||||
_= Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -805,7 +801,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
||||
|
||||
private Task _client_UserLeft(SocketGuild guild, SocketUser usr)
|
||||
{
|
||||
var _ = Task.Run(async () =>
|
||||
_= Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -840,7 +836,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
||||
|
||||
private Task _client_UserJoined(IGuildUser usr)
|
||||
{
|
||||
var _ = Task.Run(async () =>
|
||||
_= Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -879,7 +875,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
||||
|
||||
private Task _client_UserUnbanned(IUser usr, IGuild guild)
|
||||
{
|
||||
var _ = Task.Run(async () =>
|
||||
_= Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -914,7 +910,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
||||
|
||||
private Task _client_UserBanned(IUser usr, IGuild guild)
|
||||
{
|
||||
var _ = Task.Run(async () =>
|
||||
_= Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -951,7 +947,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
||||
|
||||
private Task _client_MessageDeleted(Cacheable<IMessage, ulong> optMsg, Cacheable<IMessageChannel, ulong> optCh)
|
||||
{
|
||||
var _ = Task.Run(async () =>
|
||||
_= Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1005,7 +1001,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
||||
SocketMessage imsg2,
|
||||
ISocketMessageChannel ch)
|
||||
{
|
||||
var _ = Task.Run(async () =>
|
||||
_= Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1104,7 +1100,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
||||
case LogType.VoicePresence:
|
||||
id = logSetting.LogVoicePresenceId;
|
||||
break;
|
||||
case LogType.VoicePresenceTTS:
|
||||
case LogType.VoicePresenceTts:
|
||||
id = logSetting.LogVoicePresenceTTSId;
|
||||
break;
|
||||
case LogType.UserMuted:
|
||||
@@ -1177,7 +1173,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
||||
case LogType.VoicePresence:
|
||||
newLogSetting.LogVoicePresenceId = null;
|
||||
break;
|
||||
case LogType.VoicePresenceTTS:
|
||||
case LogType.VoicePresenceTts:
|
||||
newLogSetting.LogVoicePresenceTTSId = null;
|
||||
break;
|
||||
}
|
||||
|
@@ -131,7 +131,7 @@ public partial class Administration
|
||||
return l.LogUserPresenceId;
|
||||
case LogType.VoicePresence:
|
||||
return l.LogVoicePresenceId;
|
||||
case LogType.VoicePresenceTTS:
|
||||
case LogType.VoicePresenceTts:
|
||||
return l.LogVoicePresenceTTSId;
|
||||
case LogType.UserMuted:
|
||||
return l.UserMutedId;
|
||||
|
@@ -315,6 +315,9 @@ WHERE GuildId={guildId}
|
||||
if (number <= 0 || (time is not null && time.Time > TimeSpan.FromDays(49)))
|
||||
return false;
|
||||
|
||||
if (punish is PunishmentAction.AddRole && role is null)
|
||||
return false;
|
||||
|
||||
using var uow = _db.GetDbContext();
|
||||
var ps = uow.GuildConfigsForId(guildId, set => set.Include(x => x.WarnPunishments)).WarnPunishments;
|
||||
var toDelete = ps.Where(x => x.Count == number);
|
||||
@@ -326,7 +329,7 @@ WHERE GuildId={guildId}
|
||||
Count = number,
|
||||
Punishment = punish,
|
||||
Time = (int?)time?.Time.TotalMinutes ?? 0,
|
||||
RoleId = punish == PunishmentAction.AddRole ? role.Id : default(ulong?)
|
||||
RoleId = punish == PunishmentAction.AddRole ? role!.Id : default(ulong?)
|
||||
});
|
||||
uow.SaveChanges();
|
||||
return true;
|
||||
|
@@ -80,7 +80,7 @@ public class VcRoleService : INService
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var configWithVcRole = uow.GuildConfigsForId(arg.GuildId, set => set.Include(x => x.VcRoleInfos));
|
||||
var _ = InitializeVcRole(configWithVcRole);
|
||||
_= InitializeVcRole(configWithVcRole);
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
@@ -166,7 +166,7 @@ public class VcRoleService : INService
|
||||
|
||||
var oldVc = oldState.VoiceChannel;
|
||||
var newVc = newState.VoiceChannel;
|
||||
var _ = Task.Run(() =>
|
||||
_= Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
|
Reference in New Issue
Block a user