mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 01:38:27 -04:00
- Updated editorconfig rules to hopefully look a bit nicer.
- Removed configureawait(false) from everywhere as it doesnt' do anything in a console app and just makes the code look ugly - Started using .WhenAll extension instead of Task.WhenAll to make it look nicer when chaining methods
This commit is contained in:
@@ -78,7 +78,7 @@ public partial class Administration : NadekoModule<AdministrationService>
|
||||
|
||||
embed.AddField(GetText(strs.channel_delmsgoncmd), str);
|
||||
|
||||
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
public enum Server
|
||||
@@ -96,12 +96,12 @@ public partial class Administration : NadekoModule<AdministrationService>
|
||||
if (_service.ToggleDeleteMessageOnCommand(ctx.Guild.Id))
|
||||
{
|
||||
_service.DeleteMessagesOnCommand.Add(ctx.Guild.Id);
|
||||
await ReplyConfirmLocalizedAsync(strs.delmsg_on).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.delmsg_on);
|
||||
}
|
||||
else
|
||||
{
|
||||
_service.DeleteMessagesOnCommand.TryRemove(ctx.Guild.Id);
|
||||
await ReplyConfirmLocalizedAsync(strs.delmsg_off).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.delmsg_off);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,19 +136,19 @@ public partial class Administration : NadekoModule<AdministrationService>
|
||||
public async Task Delmsgoncmd(Channel _, State s, ulong? chId = null)
|
||||
{
|
||||
var actualChId = chId ?? ctx.Channel.Id;
|
||||
await _service.SetDelMsgOnCmdState(ctx.Guild.Id, actualChId, s).ConfigureAwait(false);
|
||||
await _service.SetDelMsgOnCmdState(ctx.Guild.Id, actualChId, s);
|
||||
|
||||
if (s == State.Disable)
|
||||
{
|
||||
await ReplyConfirmLocalizedAsync(strs.delmsg_channel_off).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.delmsg_channel_off);
|
||||
}
|
||||
else if (s == State.Enable)
|
||||
{
|
||||
await ReplyConfirmLocalizedAsync(strs.delmsg_channel_on).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.delmsg_channel_on);
|
||||
}
|
||||
else
|
||||
{
|
||||
await ReplyConfirmLocalizedAsync(strs.delmsg_channel_inherit).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.delmsg_channel_inherit);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,8 +158,8 @@ public partial class Administration : NadekoModule<AdministrationService>
|
||||
[BotPerm(GuildPerm.DeafenMembers)]
|
||||
public async Task Deafen(params IGuildUser[] users)
|
||||
{
|
||||
await _service.DeafenUsers(true, users).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.deafen).ConfigureAwait(false);
|
||||
await _service.DeafenUsers(true, users);
|
||||
await ReplyConfirmLocalizedAsync(strs.deafen);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -168,8 +168,8 @@ public partial class Administration : NadekoModule<AdministrationService>
|
||||
[BotPerm(GuildPerm.DeafenMembers)]
|
||||
public async Task UnDeafen(params IGuildUser[] users)
|
||||
{
|
||||
await _service.DeafenUsers(false, users).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.undeafen).ConfigureAwait(false);
|
||||
await _service.DeafenUsers(false, users);
|
||||
await ReplyConfirmLocalizedAsync(strs.undeafen);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -178,8 +178,8 @@ public partial class Administration : NadekoModule<AdministrationService>
|
||||
[BotPerm(GuildPerm.ManageChannels)]
|
||||
public async Task DelVoiChanl([Leftover] IVoiceChannel voiceChannel)
|
||||
{
|
||||
await voiceChannel.DeleteAsync().ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.delvoich(Format.Bold(voiceChannel.Name))).ConfigureAwait(false);
|
||||
await voiceChannel.DeleteAsync();
|
||||
await ReplyConfirmLocalizedAsync(strs.delvoich(Format.Bold(voiceChannel.Name)));
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -188,8 +188,8 @@ public partial class Administration : NadekoModule<AdministrationService>
|
||||
[BotPerm(GuildPerm.ManageChannels)]
|
||||
public async Task CreatVoiChanl([Leftover] string channelName)
|
||||
{
|
||||
var ch = await ctx.Guild.CreateVoiceChannelAsync(channelName).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.createvoich(Format.Bold(ch.Name))).ConfigureAwait(false);
|
||||
var ch = await ctx.Guild.CreateVoiceChannelAsync(channelName);
|
||||
await ReplyConfirmLocalizedAsync(strs.createvoich(Format.Bold(ch.Name)));
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -198,8 +198,8 @@ public partial class Administration : NadekoModule<AdministrationService>
|
||||
[BotPerm(GuildPerm.ManageChannels)]
|
||||
public async Task DelTxtChanl([Leftover] ITextChannel toDelete)
|
||||
{
|
||||
await toDelete.DeleteAsync().ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.deltextchan(Format.Bold(toDelete.Name))).ConfigureAwait(false);
|
||||
await toDelete.DeleteAsync();
|
||||
await ReplyConfirmLocalizedAsync(strs.deltextchan(Format.Bold(toDelete.Name)));
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -208,8 +208,8 @@ public partial class Administration : NadekoModule<AdministrationService>
|
||||
[BotPerm(GuildPerm.ManageChannels)]
|
||||
public async Task CreaTxtChanl([Leftover] string channelName)
|
||||
{
|
||||
var txtCh = await ctx.Guild.CreateTextChannelAsync(channelName).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.createtextchan(Format.Bold(txtCh.Name))).ConfigureAwait(false);
|
||||
var txtCh = await ctx.Guild.CreateTextChannelAsync(channelName);
|
||||
await ReplyConfirmLocalizedAsync(strs.createtextchan(Format.Bold(txtCh.Name)));
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -220,8 +220,8 @@ public partial class Administration : NadekoModule<AdministrationService>
|
||||
{
|
||||
var channel = (ITextChannel) ctx.Channel;
|
||||
topic ??= "";
|
||||
await channel.ModifyAsync(c => c.Topic = topic).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.set_topic).ConfigureAwait(false);
|
||||
await channel.ModifyAsync(c => c.Topic = topic);
|
||||
await ReplyConfirmLocalizedAsync(strs.set_topic);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -231,8 +231,8 @@ public partial class Administration : NadekoModule<AdministrationService>
|
||||
public async Task SetChanlName([Leftover] string name)
|
||||
{
|
||||
var channel = (ITextChannel) ctx.Channel;
|
||||
await channel.ModifyAsync(c => c.Name = name).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.set_channel_name).ConfigureAwait(false);
|
||||
await channel.ModifyAsync(c => c.Name = name);
|
||||
await ReplyConfirmLocalizedAsync(strs.set_channel_name);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -244,12 +244,12 @@ public partial class Administration : NadekoModule<AdministrationService>
|
||||
var channel = (ITextChannel) ctx.Channel;
|
||||
var isEnabled = channel.IsNsfw;
|
||||
|
||||
await channel.ModifyAsync(c => c.IsNsfw = !isEnabled).ConfigureAwait(false);
|
||||
await channel.ModifyAsync(c => c.IsNsfw = !isEnabled);
|
||||
|
||||
if (isEnabled)
|
||||
await ReplyConfirmLocalizedAsync(strs.nsfw_set_false).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.nsfw_set_false);
|
||||
else
|
||||
await ReplyConfirmLocalizedAsync(strs.nsfw_set_true).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.nsfw_set_true);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -268,13 +268,13 @@ public partial class Administration : NadekoModule<AdministrationService>
|
||||
var botPerms = ((SocketGuild) ctx.Guild).CurrentUser.GetPermissions(channel);
|
||||
if (!userPerms.Has(ChannelPermission.ManageMessages))
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.insuf_perms_u).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.insuf_perms_u);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!botPerms.Has(ChannelPermission.ViewChannel))
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.insuf_perms_i).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.insuf_perms_i);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -300,39 +300,39 @@ public partial class Administration : NadekoModule<AdministrationService>
|
||||
var botPerms = ((SocketGuild) ctx.Guild).CurrentUser.GetPermissions(channel);
|
||||
if (!userPerms.Has(ChannelPermission.ManageMessages))
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.insuf_perms_u).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.insuf_perms_u);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!botPerms.Has(ChannelPermission.ManageMessages))
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.insuf_perms_i).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.insuf_perms_i);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var msg = await channel.GetMessageAsync(messageId).ConfigureAwait(false);
|
||||
var msg = await channel.GetMessageAsync(messageId);
|
||||
if (msg is null)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.msg_not_found).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.msg_not_found);
|
||||
return;
|
||||
}
|
||||
|
||||
if (time is null)
|
||||
{
|
||||
await msg.DeleteAsync().ConfigureAwait(false);
|
||||
await msg.DeleteAsync();
|
||||
}
|
||||
else if (time.Time <= TimeSpan.FromDays(7))
|
||||
{
|
||||
var _ = Task.Run(async () =>
|
||||
{
|
||||
await Task.Delay(time.Time).ConfigureAwait(false);
|
||||
await msg.DeleteAsync().ConfigureAwait(false);
|
||||
await Task.Delay(time.Time);
|
||||
await msg.DeleteAsync();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.time_too_long).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.time_too_long);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using NadekoBot.Modules.Administration.Services;
|
||||
|
||||
#if !GLOBAL_NADEKO
|
||||
@@ -20,17 +20,17 @@ namespace NadekoBot.Modules.Administration
|
||||
.WithTitle(GetText(strs.sql_confirm_exec))
|
||||
.WithDescription(Format.Code(sql));
|
||||
|
||||
if (!await PromptUserConfirmAsync(embed).ConfigureAwait(false))
|
||||
if (!await PromptUserConfirmAsync(embed))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var res = await _service.ExecuteSql(sql).ConfigureAwait(false);
|
||||
await SendConfirmAsync(res.ToString()).ConfigureAwait(false);
|
||||
var res = await _service.ExecuteSql(sql);
|
||||
await SendConfirmAsync(res.ToString());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await SendErrorAsync(ex.ToString()).ConfigureAwait(false);
|
||||
await SendErrorAsync(ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace NadekoBot.Modules.Administration
|
||||
var embed = _eb.Create()
|
||||
.WithDescription(GetText(strs.purge_user_confirm(Format.Bold(userId.ToString()))));
|
||||
|
||||
if (!await PromptUserConfirmAsync(embed).ConfigureAwait(false))
|
||||
if (!await PromptUserConfirmAsync(embed))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using NadekoBot.Modules.Administration.Services;
|
||||
|
||||
namespace NadekoBot.Modules.Administration;
|
||||
@@ -18,19 +18,19 @@ public partial class Administration
|
||||
|
||||
if (vch is null)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.not_in_voice).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.not_in_voice);
|
||||
return;
|
||||
}
|
||||
var id = _service.ToggleGameVoiceChannel(ctx.Guild.Id, vch.Id);
|
||||
|
||||
if (id is null)
|
||||
{
|
||||
await ReplyConfirmLocalizedAsync(strs.gvc_disabled).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.gvc_disabled);
|
||||
}
|
||||
else
|
||||
{
|
||||
_service.GameVoiceChannels.Add(vch.Id);
|
||||
await ReplyConfirmLocalizedAsync(strs.gvc_enabled(Format.Bold(vch.Name))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.gvc_enabled(Format.Bold(vch.Name)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -127,8 +127,7 @@ public class GreetSettingsService : INService
|
||||
var groupClear = false;
|
||||
while (!groupClear)
|
||||
{
|
||||
await Task.Delay(5000)
|
||||
.ConfigureAwait(false);
|
||||
await Task.Delay(5000);
|
||||
groupClear = _byes.ClearGroup(guild.Id, 5, out var toBye);
|
||||
await ByeUsers(conf, channel, toBye);
|
||||
}
|
||||
@@ -217,8 +216,7 @@ public class GreetSettingsService : INService
|
||||
text = rep.Replace(text);
|
||||
try
|
||||
{
|
||||
var toDelete = await channel.SendAsync(text)
|
||||
.ConfigureAwait(false);
|
||||
var toDelete = await channel.SendAsync(text);
|
||||
if (conf.AutoDeleteGreetMessagesTimer > 0)
|
||||
{
|
||||
toDelete.DeleteAfter(conf.AutoDeleteGreetMessagesTimer);
|
||||
@@ -243,8 +241,7 @@ public class GreetSettingsService : INService
|
||||
rep.Replace(text);
|
||||
try
|
||||
{
|
||||
await channel.SendAsync(text)
|
||||
.ConfigureAwait(false);
|
||||
await channel.SendAsync(text);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -279,8 +276,7 @@ public class GreetSettingsService : INService
|
||||
var groupClear = false;
|
||||
while (!groupClear)
|
||||
{
|
||||
await Task.Delay(5000)
|
||||
.ConfigureAwait(false);
|
||||
await Task.Delay(5000);
|
||||
groupClear = _greets.ClearGroup(user.GuildId, 5, out var toGreet);
|
||||
await GreetUsers(conf, channel, toGreet);
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using System.Globalization;
|
||||
|
||||
namespace NadekoBot.Modules.Administration;
|
||||
@@ -72,7 +72,7 @@ public partial class Administration
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.lang_set_fail).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.lang_set_fail);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ public partial class Administration
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.lang_set_fail).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.lang_set_fail);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public partial class Administration
|
||||
=> await ctx.Channel.EmbedAsync(_eb.Create().WithOkColor()
|
||||
.WithTitle(GetText(strs.lang_list))
|
||||
.WithDescription(string.Join("\n",
|
||||
supportedLocales.Select(x => $"{Format.Code(x.Key),-10} => {x.Value}")))).ConfigureAwait(false);
|
||||
supportedLocales.Select(x => $"{Format.Code(x.Key),-10} => {x.Value}"))));
|
||||
}
|
||||
}
|
||||
/* list of language codes for reference.
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using NadekoBot.Common.TypeReaders.Models;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using NadekoBot.Modules.Administration.Services;
|
||||
@@ -17,11 +17,11 @@ public partial class Administration
|
||||
[OwnerOnly]
|
||||
public async Task LogServer(PermissionAction action)
|
||||
{
|
||||
await _service.LogServer(ctx.Guild.Id, ctx.Channel.Id, action.Value).ConfigureAwait(false);
|
||||
await _service.LogServer(ctx.Guild.Id, ctx.Channel.Id, action.Value);
|
||||
if (action.Value)
|
||||
await ReplyConfirmLocalizedAsync(strs.log_all).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.log_all);
|
||||
else
|
||||
await ReplyConfirmLocalizedAsync(strs.log_disabled).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.log_disabled);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -58,9 +58,9 @@ public partial class Administration
|
||||
var removed = _service.LogIgnore(ctx.Guild.Id, target.Id, IgnoredItemType.Channel);
|
||||
|
||||
if (!removed)
|
||||
await ReplyConfirmLocalizedAsync(strs.log_ignore_chan(Format.Bold(target.Mention + "(" + target.Id + ")"))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.log_ignore_chan(Format.Bold(target.Mention + "(" + target.Id + ")")));
|
||||
else
|
||||
await ReplyConfirmLocalizedAsync(strs.log_not_ignore_chan(Format.Bold(target.Mention + "(" + target.Id + ")"))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.log_not_ignore_chan(Format.Bold(target.Mention + "(" + target.Id + ")")));
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -72,9 +72,9 @@ public partial class Administration
|
||||
var removed = _service.LogIgnore(ctx.Guild.Id, target.Id, IgnoredItemType.User);
|
||||
|
||||
if (!removed)
|
||||
await ReplyConfirmLocalizedAsync(strs.log_ignore_user(Format.Bold(target.Mention + "(" + target.Id + ")"))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.log_ignore_user(Format.Bold(target.Mention + "(" + target.Id + ")")));
|
||||
else
|
||||
await ReplyConfirmLocalizedAsync(strs.log_not_ignore_user(Format.Bold(target.Mention + "(" + target.Id + ")"))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.log_not_ignore_user(Format.Bold(target.Mention + "(" + target.Id + ")")));
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -94,8 +94,7 @@ public partial class Administration
|
||||
}));
|
||||
|
||||
await SendConfirmAsync(Format.Bold(GetText(strs.log_events)) + "\n" +
|
||||
str)
|
||||
.ConfigureAwait(false);
|
||||
str);
|
||||
}
|
||||
|
||||
private static ulong? GetLogProperty(LogSetting l, LogType type)
|
||||
@@ -146,9 +145,9 @@ public partial class Administration
|
||||
var val = _service.Log(ctx.Guild.Id, ctx.Channel.Id, type);
|
||||
|
||||
if (val)
|
||||
await ReplyConfirmLocalizedAsync(strs.log(Format.Bold(type.ToString()))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.log(Format.Bold(type.ToString())));
|
||||
else
|
||||
await ReplyConfirmLocalizedAsync(strs.log_stop(Format.Bold(type.ToString()))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.log_stop(Format.Bold(type.ToString())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using NadekoBot.Common.TypeReaders.Models;
|
||||
using NadekoBot.Modules.Administration.Services;
|
||||
|
||||
@@ -16,7 +16,7 @@ public partial class Administration
|
||||
if (runnerUser.Id != ctx.Guild.OwnerId &&
|
||||
runnerUserRoles.Max(x => x.Position) <= targetUserRoles.Max(x => x.Position))
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.mute_perms).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.mute_perms);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -30,21 +30,21 @@ public partial class Administration
|
||||
{
|
||||
if (role is null)
|
||||
{
|
||||
var muteRole = await _service.GetMuteRole(ctx.Guild).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.mute_role(Format.Code(muteRole.Name))).ConfigureAwait(false);
|
||||
var muteRole = await _service.GetMuteRole(ctx.Guild);
|
||||
await ReplyConfirmLocalizedAsync(strs.mute_role(Format.Code(muteRole.Name)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctx.User.Id != ctx.Guild.OwnerId &&
|
||||
role.Position >= ((SocketGuildUser) ctx.User).Roles.Max(x => x.Position))
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.insuf_perms_u).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.insuf_perms_u);
|
||||
return;
|
||||
}
|
||||
|
||||
await _service.SetMuteRoleAsync(ctx.Guild.Id, role.Name).ConfigureAwait(false);
|
||||
await _service.SetMuteRoleAsync(ctx.Guild.Id, role.Name);
|
||||
|
||||
await ReplyConfirmLocalizedAsync(strs.mute_role_set).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.mute_role_set);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -58,13 +58,13 @@ public partial class Administration
|
||||
if (!await VerifyMutePermissions((IGuildUser)ctx.User, target))
|
||||
return;
|
||||
|
||||
await _service.MuteUser(target, ctx.User, reason: reason).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.user_muted(Format.Bold(target.ToString()))).ConfigureAwait(false);
|
||||
await _service.MuteUser(target, ctx.User, reason: reason);
|
||||
await ReplyConfirmLocalizedAsync(strs.user_muted(Format.Bold(target.ToString())));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Warning(ex.ToString());
|
||||
await ReplyErrorLocalizedAsync(strs.mute_error).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.mute_error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,13 +81,13 @@ public partial class Administration
|
||||
if (!await VerifyMutePermissions((IGuildUser)ctx.User, user))
|
||||
return;
|
||||
|
||||
await _service.TimedMute(user, ctx.User, time.Time, reason: reason).ConfigureAwait(false);
|
||||
await _service.TimedMute(user, ctx.User, time.Time, reason: reason);
|
||||
await ReplyConfirmLocalizedAsync(strs.user_muted_time(Format.Bold(user.ToString()), (int)time.Time.TotalMinutes));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Warning(ex, "Error in mute command");
|
||||
await ReplyErrorLocalizedAsync(strs.mute_error).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.mute_error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,12 +98,12 @@ public partial class Administration
|
||||
{
|
||||
try
|
||||
{
|
||||
await _service.UnmuteUser(user.GuildId, user.Id, ctx.User, reason: reason).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.user_unmuted(Format.Bold(user.ToString()))).ConfigureAwait(false);
|
||||
await _service.UnmuteUser(user.GuildId, user.Id, ctx.User, reason: reason);
|
||||
await ReplyConfirmLocalizedAsync(strs.user_unmuted(Format.Bold(user.ToString())));
|
||||
}
|
||||
catch
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.mute_error).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.mute_error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,13 +118,13 @@ public partial class Administration
|
||||
if (!await VerifyMutePermissions((IGuildUser)ctx.User, user))
|
||||
return;
|
||||
|
||||
await _service.MuteUser(user, ctx.User, MuteType.Chat, reason: reason).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.user_chat_mute(Format.Bold(user.ToString()))).ConfigureAwait(false);
|
||||
await _service.MuteUser(user, ctx.User, MuteType.Chat, reason: reason);
|
||||
await ReplyConfirmLocalizedAsync(strs.user_chat_mute(Format.Bold(user.ToString())));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Warning(ex.ToString());
|
||||
await ReplyErrorLocalizedAsync(strs.mute_error).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.mute_error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,13 +141,13 @@ public partial class Administration
|
||||
if (!await VerifyMutePermissions((IGuildUser)ctx.User, user))
|
||||
return;
|
||||
|
||||
await _service.TimedMute(user, ctx.User, time.Time, MuteType.Chat, reason: reason).ConfigureAwait(false);
|
||||
await _service.TimedMute(user, ctx.User, time.Time, MuteType.Chat, reason: reason);
|
||||
await ReplyConfirmLocalizedAsync(strs.user_chat_mute_time(Format.Bold(user.ToString()), (int)time.Time.TotalMinutes));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Warning(ex.ToString());
|
||||
await ReplyErrorLocalizedAsync(strs.mute_error).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.mute_error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,12 +158,12 @@ public partial class Administration
|
||||
{
|
||||
try
|
||||
{
|
||||
await _service.UnmuteUser(user.Guild.Id, user.Id, ctx.User, MuteType.Chat, reason: reason).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.user_chat_unmute(Format.Bold(user.ToString()))).ConfigureAwait(false);
|
||||
await _service.UnmuteUser(user.Guild.Id, user.Id, ctx.User, MuteType.Chat, reason: reason);
|
||||
await ReplyConfirmLocalizedAsync(strs.user_chat_unmute(Format.Bold(user.ToString())));
|
||||
}
|
||||
catch
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.mute_error).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.mute_error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,12 +178,12 @@ public partial class Administration
|
||||
if (!await VerifyMutePermissions((IGuildUser)ctx.User, user))
|
||||
return;
|
||||
|
||||
await _service.MuteUser(user, ctx.User, MuteType.Voice, reason: reason).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.user_voice_mute(Format.Bold(user.ToString()))).ConfigureAwait(false);
|
||||
await _service.MuteUser(user, ctx.User, MuteType.Voice, reason: reason);
|
||||
await ReplyConfirmLocalizedAsync(strs.user_voice_mute(Format.Bold(user.ToString())));
|
||||
}
|
||||
catch
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.mute_error).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.mute_error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,12 +200,12 @@ public partial class Administration
|
||||
if (!await VerifyMutePermissions((IGuildUser)ctx.User, user))
|
||||
return;
|
||||
|
||||
await _service.TimedMute(user, ctx.User, time.Time, MuteType.Voice, reason: reason).ConfigureAwait(false);
|
||||
await _service.TimedMute(user, ctx.User, time.Time, MuteType.Voice, reason: reason);
|
||||
await ReplyConfirmLocalizedAsync(strs.user_voice_mute_time(Format.Bold(user.ToString()), (int)time.Time.TotalMinutes));
|
||||
}
|
||||
catch
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.mute_error).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.mute_error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,12 +216,12 @@ public partial class Administration
|
||||
{
|
||||
try
|
||||
{
|
||||
await _service.UnmuteUser(user.GuildId, user.Id, ctx.User, MuteType.Voice, reason: reason).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.user_voice_unmute(Format.Bold(user.ToString()))).ConfigureAwait(false);
|
||||
await _service.UnmuteUser(user.GuildId, user.Id, ctx.User, MuteType.Voice, reason: reason);
|
||||
await ReplyConfirmLocalizedAsync(strs.user_voice_unmute(Format.Bold(user.ToString())));
|
||||
}
|
||||
catch
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.mute_error).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.mute_error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using NadekoBot.Modules.Administration.Services;
|
||||
|
||||
namespace NadekoBot.Modules.Administration;
|
||||
@@ -13,18 +13,18 @@ public partial class Administration
|
||||
public async Task RotatePlaying()
|
||||
{
|
||||
if (_service.ToggleRotatePlaying())
|
||||
await ReplyConfirmLocalizedAsync(strs.ropl_enabled).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.ropl_enabled);
|
||||
else
|
||||
await ReplyConfirmLocalizedAsync(strs.ropl_disabled).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.ropl_disabled);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
[OwnerOnly]
|
||||
public async Task AddPlaying(ActivityType t, [Leftover] string status)
|
||||
{
|
||||
await _service.AddPlaying(t, status).ConfigureAwait(false);
|
||||
await _service.AddPlaying(t, status);
|
||||
|
||||
await ReplyConfirmLocalizedAsync(strs.ropl_added).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.ropl_added);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -35,7 +35,7 @@ public partial class Administration
|
||||
|
||||
if (!statuses.Any())
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.ropl_not_set).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.ropl_not_set);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -52,7 +52,7 @@ public partial class Administration
|
||||
{
|
||||
index -= 1;
|
||||
|
||||
var msg = await _service.RemovePlayingAsync(index).ConfigureAwait(false);
|
||||
var msg = await _service.RemovePlayingAsync(index);
|
||||
|
||||
if (msg is null)
|
||||
return;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
namespace NadekoBot.Modules.Administration;
|
||||
|
||||
public partial class Administration
|
||||
@@ -9,7 +9,7 @@ public partial class Administration
|
||||
[NadekoCommand, Aliases]
|
||||
[Priority(1)]
|
||||
public async Task PrefixCommand()
|
||||
=> await ReplyConfirmLocalizedAsync(strs.prefix_current(Format.Code(CmdHandler.GetPrefix(ctx.Guild)))).ConfigureAwait(false);
|
||||
=> await ReplyConfirmLocalizedAsync(strs.prefix_current(Format.Code(CmdHandler.GetPrefix(ctx.Guild))));
|
||||
|
||||
public enum Set
|
||||
{
|
||||
@@ -35,7 +35,7 @@ public partial class Administration
|
||||
var oldPrefix = base.Prefix;
|
||||
var newPrefix = CmdHandler.SetPrefix(ctx.Guild, prefix);
|
||||
|
||||
await ReplyConfirmLocalizedAsync(strs.prefix_new(Format.Code(oldPrefix), Format.Code(newPrefix))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.prefix_new(Format.Code(oldPrefix), Format.Code(newPrefix)));
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -44,14 +44,14 @@ public partial class Administration
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(prefix))
|
||||
{
|
||||
await ReplyConfirmLocalizedAsync(strs.defprefix_current(CmdHandler.GetPrefix())).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.defprefix_current(CmdHandler.GetPrefix()));
|
||||
return;
|
||||
}
|
||||
|
||||
var oldPrefix = CmdHandler.GetPrefix();
|
||||
var newPrefix = CmdHandler.SetDefaultPrefix(prefix);
|
||||
|
||||
await ReplyConfirmLocalizedAsync(strs.defprefix_new(Format.Code(oldPrefix), Format.Code(newPrefix))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.defprefix_new(Format.Code(oldPrefix), Format.Code(newPrefix)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using NadekoBot.Modules.Administration.Common;
|
||||
using NadekoBot.Modules.Administration.Services;
|
||||
@@ -120,7 +120,7 @@ public partial class Administration
|
||||
return;
|
||||
|
||||
var stats = await _service.StartAntiRaidAsync(ctx.Guild.Id, userThreshold, seconds,
|
||||
action, time).ConfigureAwait(false);
|
||||
action, time);
|
||||
|
||||
if (stats is null)
|
||||
{
|
||||
@@ -128,8 +128,7 @@ public partial class Administration
|
||||
}
|
||||
|
||||
await SendConfirmAsync(GetText(strs.prot_enable("Anti-Raid")),
|
||||
$"{ctx.User.Mention} {GetAntiRaidString(stats)}")
|
||||
.ConfigureAwait(false);
|
||||
$"{ctx.User.Mention} {GetAntiRaidString(stats)}");
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -191,10 +190,10 @@ public partial class Administration
|
||||
if (time is < 0 or > 60 * 24)
|
||||
return;
|
||||
|
||||
var stats = await _service.StartAntiSpamAsync(ctx.Guild.Id, messageCount, action, time, role?.Id).ConfigureAwait(false);
|
||||
var stats = await _service.StartAntiSpamAsync(ctx.Guild.Id, messageCount, action, time, role?.Id);
|
||||
|
||||
await SendConfirmAsync(GetText(strs.prot_enable("Anti-Spam")),
|
||||
$"{ctx.User.Mention} {GetAntiSpamString(stats)}").ConfigureAwait(false);
|
||||
$"{ctx.User.Mention} {GetAntiSpamString(stats)}");
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -202,7 +201,7 @@ public partial class Administration
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async Task AntispamIgnore()
|
||||
{
|
||||
var added = await _service.AntiSpamIgnoreAsync(ctx.Guild.Id, ctx.Channel.Id).ConfigureAwait(false);
|
||||
var added = await _service.AntiSpamIgnoreAsync(ctx.Guild.Id, ctx.Channel.Id);
|
||||
|
||||
if(added is null)
|
||||
{
|
||||
@@ -224,7 +223,7 @@ public partial class Administration
|
||||
|
||||
if (spam is null && raid is null && alt is null)
|
||||
{
|
||||
await ReplyConfirmLocalizedAsync(strs.prot_none).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.prot_none);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -240,7 +239,7 @@ public partial class Administration
|
||||
if (alt is not null)
|
||||
embed.AddField("Anti-Alt", GetAntiAltString(alt), true);
|
||||
|
||||
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
private string GetAntiAltString(AntiAltStats alt)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using NadekoBot.Modules.Administration.Services;
|
||||
using ITextChannel = Discord.ITextChannel;
|
||||
|
||||
@@ -16,12 +16,12 @@ public partial class Administration
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Prune(string parameter = null)
|
||||
{
|
||||
var user = await ctx.Guild.GetCurrentUserAsync().ConfigureAwait(false);
|
||||
var user = await ctx.Guild.GetCurrentUserAsync();
|
||||
|
||||
if (parameter is "-s" or "--safe")
|
||||
await _service.PruneWhere((ITextChannel)ctx.Channel, 100, x => x.Author.Id == user.Id && !x.IsPinned).ConfigureAwait(false);
|
||||
await _service.PruneWhere((ITextChannel)ctx.Channel, 100, x => x.Author.Id == user.Id && !x.IsPinned);
|
||||
else
|
||||
await _service.PruneWhere((ITextChannel)ctx.Channel, 100, x => x.Author.Id == user.Id).ConfigureAwait(false);
|
||||
await _service.PruneWhere((ITextChannel)ctx.Channel, 100, x => x.Author.Id == user.Id);
|
||||
ctx.Message.DeleteAfter(3);
|
||||
}
|
||||
// prune x
|
||||
@@ -39,9 +39,9 @@ public partial class Administration
|
||||
count = 1000;
|
||||
|
||||
if (parameter is "-s" or "--safe")
|
||||
await _service.PruneWhere((ITextChannel)ctx.Channel, count, x => !x.IsPinned).ConfigureAwait(false);
|
||||
await _service.PruneWhere((ITextChannel)ctx.Channel, count, x => !x.IsPinned);
|
||||
else
|
||||
await _service.PruneWhere((ITextChannel)ctx.Channel, count, x => true).ConfigureAwait(false);
|
||||
await _service.PruneWhere((ITextChannel)ctx.Channel, count, x => true);
|
||||
}
|
||||
|
||||
//prune @user [x]
|
||||
@@ -71,9 +71,9 @@ public partial class Administration
|
||||
count = 1000;
|
||||
|
||||
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).ConfigureAwait(false);
|
||||
await _service.PruneWhere((ITextChannel)ctx.Channel, count, 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).ConfigureAwait(false);
|
||||
await _service.PruneWhere((ITextChannel)ctx.Channel, count, m => m.Author.Id == userId && DateTime.UtcNow - m.CreatedAt < twoWeeks);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using NadekoBot.Modules.Administration.Services;
|
||||
using SixLabors.ImageSharp.PixelFormats;
|
||||
@@ -19,15 +19,15 @@ public partial class Administration
|
||||
public async Task InternalReactionRoles(bool exclusive, ulong? messageId, params string[] input)
|
||||
{
|
||||
var target = messageId is { } msgId
|
||||
? await ctx.Channel.GetMessageAsync(msgId).ConfigureAwait(false)
|
||||
: (await ctx.Channel.GetMessagesAsync(2).FlattenAsync().ConfigureAwait(false))
|
||||
? await ctx.Channel.GetMessageAsync(msgId)
|
||||
: (await ctx.Channel.GetMessagesAsync(2).FlattenAsync())
|
||||
.Skip(1)
|
||||
.FirstOrDefault();
|
||||
|
||||
if (input.Length % 2 != 0)
|
||||
return;
|
||||
|
||||
var results = input
|
||||
var all = await input
|
||||
.Chunk(input.Length / 2)
|
||||
.Select(async x =>
|
||||
{
|
||||
@@ -46,9 +46,8 @@ public partial class Administration
|
||||
var emote = x.Last().ToIEmote();
|
||||
return new { role, emote };
|
||||
})
|
||||
.Where(x => x != null);
|
||||
|
||||
var all = await Task.WhenAll(results);
|
||||
.Where(x => x != null)
|
||||
.WhenAll();
|
||||
|
||||
if (!all.Any())
|
||||
return;
|
||||
@@ -60,7 +59,7 @@ public partial class Administration
|
||||
await target.AddReactionAsync(x.emote, new()
|
||||
{
|
||||
RetryMode = RetryMode.Retry502 | RetryMode.RetryRatelimit
|
||||
}).ConfigureAwait(false);
|
||||
});
|
||||
}
|
||||
catch (Discord.Net.HttpException ex) when(ex.HttpCode == HttpStatusCode.BadRequest)
|
||||
{
|
||||
@@ -68,7 +67,7 @@ public partial class Administration
|
||||
return;
|
||||
}
|
||||
|
||||
await Task.Delay(500).ConfigureAwait(false);
|
||||
await Task.Delay(500);
|
||||
}
|
||||
|
||||
if (_service.Add(ctx.Guild.Id, new()
|
||||
@@ -90,7 +89,7 @@ public partial class Administration
|
||||
}
|
||||
else
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.reaction_roles_full).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.reaction_roles_full);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,14 +151,14 @@ public partial class Administration
|
||||
IUserMessage msg = null;
|
||||
if (ch is not null)
|
||||
{
|
||||
msg = await ch.GetMessageAsync(rr.MessageId).ConfigureAwait(false) as IUserMessage;
|
||||
msg = await ch.GetMessageAsync(rr.MessageId) as IUserMessage;
|
||||
}
|
||||
var content = msg?.Content.TrimTo(30) ?? "DELETED!";
|
||||
embed.AddField($"**{rr.Index + 1}.** {ch?.Name ?? "DELETED!"}",
|
||||
GetText(strs.reaction_roles_message(rr.ReactionRoles?.Count ?? 0, content)));
|
||||
}
|
||||
}
|
||||
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -192,16 +191,16 @@ public partial class Administration
|
||||
return;
|
||||
try
|
||||
{
|
||||
await targetUser.AddRoleAsync(roleToAdd).ConfigureAwait(false);
|
||||
await targetUser.AddRoleAsync(roleToAdd);
|
||||
|
||||
await ReplyConfirmLocalizedAsync(
|
||||
strs.setrole(Format.Bold(roleToAdd.Name),
|
||||
Format.Bold(targetUser.ToString())));
|
||||
strs.setrole(Format.Bold(roleToAdd.Name), Format.Bold(targetUser.ToString()))
|
||||
);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Warning(ex, "Error in setrole command");
|
||||
await ReplyErrorLocalizedAsync(strs.setrole_err).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.setrole_err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,12 +215,12 @@ public partial class Administration
|
||||
return;
|
||||
try
|
||||
{
|
||||
await targetUser.RemoveRoleAsync(roleToRemove).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.remrole(Format.Bold(roleToRemove.Name), Format.Bold(targetUser.ToString()))).ConfigureAwait(false);
|
||||
await targetUser.RemoveRoleAsync(roleToRemove);
|
||||
await ReplyConfirmLocalizedAsync(strs.remrole(Format.Bold(roleToRemove.Name), Format.Bold(targetUser.ToString())));
|
||||
}
|
||||
catch
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.remrole_err).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.remrole_err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,17 +235,17 @@ public partial class Administration
|
||||
return;
|
||||
try
|
||||
{
|
||||
if (roleToEdit.Position > (await ctx.Guild.GetCurrentUserAsync().ConfigureAwait(false)).GetRoles().Max(r => r.Position))
|
||||
if (roleToEdit.Position > (await ctx.Guild.GetCurrentUserAsync()).GetRoles().Max(r => r.Position))
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.renrole_perms).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.renrole_perms);
|
||||
return;
|
||||
}
|
||||
await roleToEdit.ModifyAsync(g => g.Name = newname).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.renrole).ConfigureAwait(false);
|
||||
await roleToEdit.ModifyAsync(g => g.Name = newname);
|
||||
await ReplyConfirmLocalizedAsync(strs.renrole);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.renrole_err).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.renrole_err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,12 +265,12 @@ public partial class Administration
|
||||
return;
|
||||
try
|
||||
{
|
||||
await user.RemoveRolesAsync(userRoles).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.rar(Format.Bold(user.ToString()))).ConfigureAwait(false);
|
||||
await user.RemoveRolesAsync(userRoles);
|
||||
await ReplyConfirmLocalizedAsync(strs.rar(Format.Bold(user.ToString())));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.rar_err).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.rar_err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,8 +283,8 @@ public partial class Administration
|
||||
if (string.IsNullOrWhiteSpace(roleName))
|
||||
return;
|
||||
|
||||
var r = await ctx.Guild.CreateRoleAsync(roleName, isMentionable: false).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.cr(Format.Bold(r.Name))).ConfigureAwait(false);
|
||||
var r = await ctx.Guild.CreateRoleAsync(roleName, isMentionable: false);
|
||||
await ReplyConfirmLocalizedAsync(strs.cr(Format.Bold(r.Name)));
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -299,8 +298,8 @@ public partial class Administration
|
||||
&& guser.GetRoles().Max(x => x.Position) <= role.Position)
|
||||
return;
|
||||
|
||||
await role.DeleteAsync().ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.dr(Format.Bold(role.Name))).ConfigureAwait(false);
|
||||
await role.DeleteAsync();
|
||||
await ReplyConfirmLocalizedAsync(strs.dr(Format.Bold(role.Name)));
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -310,14 +309,14 @@ public partial class Administration
|
||||
public async Task RoleHoist(IRole role)
|
||||
{
|
||||
var newHoisted = !role.IsHoisted;
|
||||
await role.ModifyAsync(r => r.Hoist = newHoisted).ConfigureAwait(false);
|
||||
await role.ModifyAsync(r => r.Hoist = newHoisted);
|
||||
if (newHoisted)
|
||||
{
|
||||
await ReplyConfirmLocalizedAsync(strs.rolehoist_enabled(Format.Bold(role.Name))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.rolehoist_enabled(Format.Bold(role.Name)));
|
||||
}
|
||||
else
|
||||
{
|
||||
await ReplyConfirmLocalizedAsync(strs.rolehoist_disabled(Format.Bold(role.Name))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.rolehoist_disabled(Format.Bold(role.Name)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,7 +324,7 @@ public partial class Administration
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(1)]
|
||||
public async Task RoleColor([Leftover] IRole role)
|
||||
=> await SendConfirmAsync("Role Color", role.Color.RawValue.ToString("x6")).ConfigureAwait(false);
|
||||
=> await SendConfirmAsync("Role Color", role.Color.RawValue.ToString("x6"));
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
@@ -337,12 +336,12 @@ public partial class Administration
|
||||
try
|
||||
{
|
||||
var rgba32 = color.ToPixel<Rgba32>();
|
||||
await role.ModifyAsync(r => r.Color = new Color(rgba32.R, rgba32.G, rgba32.B)).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.rc(Format.Bold(role.Name))).ConfigureAwait(false);
|
||||
await role.ModifyAsync(r => r.Color = new Color(rgba32.R, rgba32.G, rgba32.B));
|
||||
await ReplyConfirmLocalizedAsync(strs.rc(Format.Bold(role.Name)));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.rc_perms).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.rc_perms);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using System.Text;
|
||||
using NadekoBot.Modules.Administration.Services;
|
||||
|
||||
@@ -50,11 +50,11 @@ public partial class Administration
|
||||
|
||||
if (succ)
|
||||
{
|
||||
await ReplyConfirmLocalizedAsync(strs.role_added(Format.Bold(role.Name), Format.Bold(group.ToString()))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.role_added(Format.Bold(role.Name), Format.Bold(group.ToString())));
|
||||
}
|
||||
else
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.role_in_list(Format.Bold(role.Name))).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.role_in_list(Format.Bold(role.Name)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,15 +67,15 @@ public partial class Administration
|
||||
{
|
||||
var guser = (IGuildUser)ctx.User;
|
||||
|
||||
var set = await _service.SetNameAsync(ctx.Guild.Id, group, name).ConfigureAwait(false);
|
||||
var set = await _service.SetNameAsync(ctx.Guild.Id, group, name);
|
||||
|
||||
if (set)
|
||||
{
|
||||
await ReplyConfirmLocalizedAsync(strs.group_name_added(Format.Bold(group.ToString()), Format.Bold(name.ToString()))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.group_name_added(Format.Bold(group.ToString()), Format.Bold(name.ToString())));
|
||||
}
|
||||
else
|
||||
{
|
||||
await ReplyConfirmLocalizedAsync(strs.group_name_removed(Format.Bold(group.ToString()))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.group_name_removed(Format.Bold(group.ToString())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,11 +91,11 @@ public partial class Administration
|
||||
var success = _service.RemoveSar(role.Guild.Id, role.Id);
|
||||
if (!success)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.self_assign_not).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.self_assign_not);
|
||||
}
|
||||
else
|
||||
{
|
||||
await ReplyConfirmLocalizedAsync(strs.self_assign_rem(Format.Bold(role.Name))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.self_assign_rem(Format.Bold(role.Name)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ public partial class Administration
|
||||
.WithFooter(exclusive
|
||||
? GetText(strs.self_assign_are_exclusive)
|
||||
: GetText(strs.self_assign_are_not_exclusive));
|
||||
}, roles.Count(), 20).ConfigureAwait(false);
|
||||
}, roles.Count(), 20);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -166,9 +166,9 @@ public partial class Administration
|
||||
{
|
||||
var areExclusive = _service.ToggleEsar(ctx.Guild.Id);
|
||||
if (areExclusive)
|
||||
await ReplyConfirmLocalizedAsync(strs.self_assign_excl).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.self_assign_excl);
|
||||
else
|
||||
await ReplyConfirmLocalizedAsync(strs.self_assign_no_excl).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.self_assign_no_excl);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -184,7 +184,7 @@ public partial class Administration
|
||||
|
||||
if (!succ)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.self_assign_not).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.self_assign_not);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -199,28 +199,28 @@ public partial class Administration
|
||||
{
|
||||
var guildUser = (IGuildUser)ctx.User;
|
||||
|
||||
var (result, autoDelete, extra) = await _service.Assign(guildUser, role).ConfigureAwait(false);
|
||||
var (result, autoDelete, extra) = await _service.Assign(guildUser, role);
|
||||
|
||||
IUserMessage msg;
|
||||
if (result == SelfAssignedRolesService.AssignResult.Err_Not_Assignable)
|
||||
{
|
||||
msg = await ReplyErrorLocalizedAsync(strs.self_assign_not).ConfigureAwait(false);
|
||||
msg = await ReplyErrorLocalizedAsync(strs.self_assign_not);
|
||||
}
|
||||
else if (result == SelfAssignedRolesService.AssignResult.Err_Lvl_Req)
|
||||
{
|
||||
msg = await ReplyErrorLocalizedAsync(strs.self_assign_not_level(Format.Bold(extra.ToString()))).ConfigureAwait(false);
|
||||
msg = await ReplyErrorLocalizedAsync(strs.self_assign_not_level(Format.Bold(extra.ToString())));
|
||||
}
|
||||
else if (result == SelfAssignedRolesService.AssignResult.Err_Already_Have)
|
||||
{
|
||||
msg = await ReplyErrorLocalizedAsync(strs.self_assign_already(Format.Bold(role.Name))).ConfigureAwait(false);
|
||||
msg = await ReplyErrorLocalizedAsync(strs.self_assign_already(Format.Bold(role.Name)));
|
||||
}
|
||||
else if (result == SelfAssignedRolesService.AssignResult.Err_Not_Perms)
|
||||
{
|
||||
msg = await ReplyErrorLocalizedAsync(strs.self_assign_perms).ConfigureAwait(false);
|
||||
msg = await ReplyErrorLocalizedAsync(strs.self_assign_perms);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = await ReplyConfirmLocalizedAsync(strs.self_assign_success(Format.Bold(role.Name))).ConfigureAwait(false);
|
||||
msg = await ReplyConfirmLocalizedAsync(strs.self_assign_success(Format.Bold(role.Name)));
|
||||
}
|
||||
|
||||
if (autoDelete)
|
||||
@@ -236,24 +236,24 @@ public partial class Administration
|
||||
{
|
||||
var guildUser = (IGuildUser)ctx.User;
|
||||
|
||||
var (result, autoDelete) = await _service.Remove(guildUser, role).ConfigureAwait(false);
|
||||
var (result, autoDelete) = await _service.Remove(guildUser, role);
|
||||
|
||||
IUserMessage msg;
|
||||
if (result == SelfAssignedRolesService.RemoveResult.Err_Not_Assignable)
|
||||
{
|
||||
msg = await ReplyErrorLocalizedAsync(strs.self_assign_not).ConfigureAwait(false);
|
||||
msg = await ReplyErrorLocalizedAsync(strs.self_assign_not);
|
||||
}
|
||||
else if (result == SelfAssignedRolesService.RemoveResult.Err_Not_Have)
|
||||
{
|
||||
msg = await ReplyErrorLocalizedAsync(strs.self_assign_not_have(Format.Bold(role.Name))).ConfigureAwait(false);
|
||||
msg = await ReplyErrorLocalizedAsync(strs.self_assign_not_have(Format.Bold(role.Name)));
|
||||
}
|
||||
else if (result == SelfAssignedRolesService.RemoveResult.Err_Not_Perms)
|
||||
{
|
||||
msg = await ReplyErrorLocalizedAsync(strs.self_assign_perms).ConfigureAwait(false);
|
||||
msg = await ReplyErrorLocalizedAsync(strs.self_assign_perms);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = await ReplyConfirmLocalizedAsync(strs.self_assign_remove(Format.Bold(role.Name))).ConfigureAwait(false);
|
||||
msg = await ReplyConfirmLocalizedAsync(strs.self_assign_remove(Format.Bold(role.Name)));
|
||||
}
|
||||
|
||||
if (autoDelete)
|
||||
|
@@ -94,7 +94,7 @@ public partial class Administration
|
||||
|
||||
if (scmds.Count == 0)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.startcmdlist_none).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.startcmdlist_none);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -107,8 +107,7 @@ public partial class Administration
|
||||
[{GetText(strs.channel)}]: {x.ChannelName} #{x.ChannelId}
|
||||
[{GetText(strs.command_text)}]: {x.CommandText}```")),
|
||||
title: string.Empty,
|
||||
footer: GetText(strs.page(page + 1)))
|
||||
.ConfigureAwait(false);
|
||||
footer: GetText(strs.page(page + 1)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +125,7 @@ public partial class Administration
|
||||
.ToList();
|
||||
if (!scmds.Any())
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.autocmdlist_none).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.autocmdlist_none);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -140,8 +139,7 @@ public partial class Administration
|
||||
{GetIntervalText(x.Interval)}
|
||||
[{GetText(strs.command_text)}]: {x.CommandText}```")),
|
||||
title: string.Empty,
|
||||
footer: GetText(strs.page(page + 1)))
|
||||
.ConfigureAwait(false);
|
||||
footer: GetText(strs.page(page + 1)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,13 +155,12 @@ public partial class Administration
|
||||
ctx.Message.DeleteAfter(0);
|
||||
try
|
||||
{
|
||||
var msg = await SendConfirmAsync($"⏲ {miliseconds}ms")
|
||||
.ConfigureAwait(false);
|
||||
var msg = await SendConfirmAsync($"⏲ {miliseconds}ms");
|
||||
msg.DeleteAfter(miliseconds / 1000);
|
||||
}
|
||||
catch { }
|
||||
|
||||
await Task.Delay(miliseconds).ConfigureAwait(false);
|
||||
await Task.Delay(miliseconds);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -174,7 +171,7 @@ public partial class Administration
|
||||
{
|
||||
if (!_service.RemoveAutoCommand(--index, out _))
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.acrm_fail).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.acrm_fail);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -187,9 +184,9 @@ public partial class Administration
|
||||
public async Task StartupCommandRemove([Leftover] int index)
|
||||
{
|
||||
if (!_service.RemoveStartupCommand(--index, out _))
|
||||
await ReplyErrorLocalizedAsync(strs.scrm_fail).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.scrm_fail);
|
||||
else
|
||||
await ReplyConfirmLocalizedAsync(strs.scrm).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.scrm);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -200,7 +197,7 @@ public partial class Administration
|
||||
{
|
||||
_service.ClearStartupCommands();
|
||||
|
||||
await ReplyConfirmLocalizedAsync(strs.startcmds_cleared).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.startcmds_cleared);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -210,9 +207,9 @@ public partial class Administration
|
||||
var enabled = _service.ForwardMessages();
|
||||
|
||||
if (enabled)
|
||||
await ReplyConfirmLocalizedAsync(strs.fwdm_start).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.fwdm_start);
|
||||
else
|
||||
await ReplyPendingLocalizedAsync(strs.fwdm_stop).ConfigureAwait(false);
|
||||
await ReplyPendingLocalizedAsync(strs.fwdm_stop);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -222,9 +219,9 @@ public partial class Administration
|
||||
var enabled = _service.ForwardToAll();
|
||||
|
||||
if (enabled)
|
||||
await ReplyConfirmLocalizedAsync(strs.fwall_start).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.fwall_start);
|
||||
else
|
||||
await ReplyPendingLocalizedAsync(strs.fwall_stop).ConfigureAwait(false);
|
||||
await ReplyPendingLocalizedAsync(strs.fwall_stop);
|
||||
|
||||
}
|
||||
|
||||
@@ -264,7 +261,7 @@ public partial class Administration
|
||||
return _eb.Create()
|
||||
.WithOkColor()
|
||||
.WithDescription($"{status}\n\n{str}");
|
||||
}, allShardStrings.Length, 25).ConfigureAwait(false);
|
||||
}, allShardStrings.Length, 25);
|
||||
}
|
||||
|
||||
private static string ConnectionStateToEmoji(ShardStatus status)
|
||||
@@ -286,11 +283,11 @@ public partial class Administration
|
||||
var success = _coord.RestartShard(shardId);
|
||||
if (success)
|
||||
{
|
||||
await ReplyConfirmLocalizedAsync(strs.shard_reconnecting(Format.Bold("#" + shardId))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.shard_reconnecting(Format.Bold("#" + shardId)));
|
||||
}
|
||||
else
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.no_shard_id).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.no_shard_id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,13 +303,13 @@ public partial class Administration
|
||||
{
|
||||
try
|
||||
{
|
||||
await ReplyConfirmLocalizedAsync(strs.shutting_down).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.shutting_down);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
await Task.Delay(2000).ConfigureAwait(false);
|
||||
await Task.Delay(2000);
|
||||
_coord.Die(graceful);
|
||||
}
|
||||
|
||||
@@ -323,11 +320,11 @@ public partial class Administration
|
||||
var success = _coord.RestartBot();
|
||||
if (!success)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.restart_fail).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.restart_fail);
|
||||
return;
|
||||
}
|
||||
|
||||
try { await ReplyConfirmLocalizedAsync(strs.restarting).ConfigureAwait(false); } catch { }
|
||||
try { await ReplyConfirmLocalizedAsync(strs.restarting); } catch { }
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -339,14 +336,14 @@ public partial class Administration
|
||||
|
||||
try
|
||||
{
|
||||
await _client.CurrentUser.ModifyAsync(u => u.Username = newName).ConfigureAwait(false);
|
||||
await _client.CurrentUser.ModifyAsync(u => u.Username = newName);
|
||||
}
|
||||
catch (RateLimitedException)
|
||||
{
|
||||
Log.Warning("You've been ratelimited. Wait 2 hours to change your name");
|
||||
}
|
||||
|
||||
await ReplyConfirmLocalizedAsync(strs.bot_name(Format.Bold(newName))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.bot_name(Format.Bold(newName)));
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -357,8 +354,8 @@ public partial class Administration
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(newNick))
|
||||
return;
|
||||
var curUser = await ctx.Guild.GetCurrentUserAsync().ConfigureAwait(false);
|
||||
await curUser.ModifyAsync(u => u.Nickname = newNick).ConfigureAwait(false);
|
||||
var curUser = await ctx.Guild.GetCurrentUserAsync();
|
||||
await curUser.ModifyAsync(u => u.Nickname = newNick);
|
||||
|
||||
await ReplyConfirmLocalizedAsync(strs.bot_nick(Format.Bold(newNick) ?? "-"));
|
||||
}
|
||||
@@ -377,7 +374,7 @@ public partial class Administration
|
||||
return;
|
||||
}
|
||||
|
||||
await gu.ModifyAsync(u => u.Nickname = newNick).ConfigureAwait(false);
|
||||
await gu.ModifyAsync(u => u.Nickname = newNick);
|
||||
|
||||
await ReplyConfirmLocalizedAsync(strs.user_nick(Format.Bold(gu.ToString()), Format.Bold(newNick) ?? "-"));
|
||||
}
|
||||
@@ -386,9 +383,9 @@ public partial class Administration
|
||||
[OwnerOnly]
|
||||
public async Task SetStatus([Leftover] SettableUserStatus status)
|
||||
{
|
||||
await _client.SetStatusAsync(SettableUserStatusToUserStatus(status)).ConfigureAwait(false);
|
||||
await _client.SetStatusAsync(SettableUserStatusToUserStatus(status));
|
||||
|
||||
await ReplyConfirmLocalizedAsync(strs.bot_status(Format.Bold(status.ToString()))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.bot_status(Format.Bold(status.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -399,7 +396,7 @@ public partial class Administration
|
||||
|
||||
if (success)
|
||||
{
|
||||
await ReplyConfirmLocalizedAsync(strs.set_avatar).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.set_avatar);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,9 +408,9 @@ public partial class Administration
|
||||
.WithDefault(Context)
|
||||
.Build();
|
||||
|
||||
await _service.SetGameAsync(game is null ? game : rep.Replace(game), type).ConfigureAwait(false);
|
||||
await _service.SetGameAsync(game is null ? game : rep.Replace(game), type);
|
||||
|
||||
await ReplyConfirmLocalizedAsync(strs.set_game).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.set_game);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -422,9 +419,9 @@ public partial class Administration
|
||||
{
|
||||
name ??= "";
|
||||
|
||||
await _service.SetStreamAsync(name, url).ConfigureAwait(false);
|
||||
await _service.SetStreamAsync(name, url);
|
||||
|
||||
await ReplyConfirmLocalizedAsync(strs.set_stream).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.set_stream);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -468,11 +465,11 @@ public partial class Administration
|
||||
}
|
||||
else
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.invalid_format).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.invalid_format);
|
||||
return;
|
||||
}
|
||||
|
||||
await ReplyConfirmLocalizedAsync(strs.message_sent).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.message_sent);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -488,7 +485,7 @@ public partial class Administration
|
||||
public async Task StringsReload()
|
||||
{
|
||||
_strings.Reload();
|
||||
await ReplyConfirmLocalizedAsync(strs.bot_strings_reloaded).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.bot_strings_reloaded);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using NadekoBot.Db;
|
||||
@@ -52,14 +52,14 @@ public class AdministrationService : INService
|
||||
if (state && cmd.Name != "prune" && cmd.Name != "pick")
|
||||
{
|
||||
_logService.AddDeleteIgnore(msg.Id);
|
||||
try { await msg.DeleteAsync().ConfigureAwait(false); } catch { }
|
||||
try { await msg.DeleteAsync(); } catch { }
|
||||
}
|
||||
//if state is false, that means do not do it
|
||||
}
|
||||
else if (DeleteMessagesOnCommand.Contains(channel.Guild.Id) && cmd.Name != "prune" && cmd.Name != "pick")
|
||||
{
|
||||
_logService.AddDeleteIgnore(msg.Id);
|
||||
try { await msg.DeleteAsync().ConfigureAwait(false); } catch { }
|
||||
try { await msg.DeleteAsync(); } catch { }
|
||||
}
|
||||
});
|
||||
return Task.CompletedTask;
|
||||
@@ -128,7 +128,7 @@ public class AdministrationService : INService
|
||||
{
|
||||
try
|
||||
{
|
||||
await u.ModifyAsync(usr => usr.Deaf = value).ConfigureAwait(false);
|
||||
await u.ModifyAsync(usr => usr.Deaf = value);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using System.Threading.Channels;
|
||||
using LinqToDB;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@@ -50,8 +50,8 @@ public sealed class AutoAssignRoleService : INService
|
||||
|
||||
if (roleIds.Any())
|
||||
{
|
||||
await user.AddRolesAsync(roleIds).ConfigureAwait(false);
|
||||
await Task.Delay(250).ConfigureAwait(false);
|
||||
await user.AddRolesAsync(roleIds);
|
||||
await Task.Delay(250);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -118,7 +118,7 @@ public class GameVoiceChannelService : INService
|
||||
if (vch is null)
|
||||
return;
|
||||
|
||||
await Task.Delay(1000).ConfigureAwait(false);
|
||||
await gUser.ModifyAsync(gu => gu.Channel = vch).ConfigureAwait(false);
|
||||
await Task.Delay(1000);
|
||||
await gUser.ModifyAsync(gu => gu.Channel = vch);
|
||||
}
|
||||
}
|
||||
|
@@ -90,7 +90,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
{
|
||||
var keys = PresenceUpdates.Keys.ToList();
|
||||
|
||||
await Task.WhenAll(keys.Select(key =>
|
||||
await keys.Select(key =>
|
||||
{
|
||||
if (!((SocketGuild) key.Guild).CurrentUser.GetPermissions(key).SendMessages)
|
||||
return Task.CompletedTask;
|
||||
@@ -102,7 +102,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
})).ConfigureAwait(false);
|
||||
}).WhenAll();
|
||||
}, null, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15));
|
||||
|
||||
//_client.MessageReceived += _client_MessageReceived;
|
||||
@@ -229,7 +229,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
|
||||
ITextChannel logChannel;
|
||||
if ((logChannel =
|
||||
await TryGetLogChannel(g, logSetting, LogType.UserUpdated).ConfigureAwait(false)) is null)
|
||||
await TryGetLogChannel(g, logSetting, LogType.UserUpdated)) is null)
|
||||
return;
|
||||
|
||||
var embed = _eb.Create();
|
||||
@@ -263,7 +263,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
return;
|
||||
}
|
||||
|
||||
await logChannel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
await logChannel.EmbedAsync(embed);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -360,8 +360,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
return;
|
||||
|
||||
ITextChannel logChannel;
|
||||
if ((logChannel = await TryGetLogChannel(usr.Guild, logSetting, LogType.VoicePresenceTTS)
|
||||
.ConfigureAwait(false)) is null)
|
||||
if ((logChannel = await TryGetLogChannel(usr.Guild, logSetting, LogType.VoicePresenceTTS)) is null)
|
||||
return;
|
||||
|
||||
var str = string.Empty;
|
||||
@@ -378,7 +377,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
str = GetText(logChannel.Guild, strs.log_vc_left(usr.Username, beforeVch.Name));
|
||||
}
|
||||
|
||||
var toDelete = await logChannel.SendMessageAsync(str, true).ConfigureAwait(false);
|
||||
var toDelete = await logChannel.SendMessageAsync(str, true);
|
||||
toDelete.DeleteAfter(5);
|
||||
}
|
||||
catch
|
||||
@@ -400,8 +399,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
return;
|
||||
|
||||
ITextChannel logChannel;
|
||||
if ((logChannel = await TryGetLogChannel(usr.Guild, logSetting, LogType.UserMuted)
|
||||
.ConfigureAwait(false)) is null)
|
||||
if ((logChannel = await TryGetLogChannel(usr.Guild, logSetting, LogType.UserMuted)) is null)
|
||||
return;
|
||||
var mutes = string.Empty;
|
||||
var mutedLocalized = GetText(logChannel.Guild, strs.muted_sn);
|
||||
@@ -424,7 +422,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
.WithFooter(CurrentTime(usr.Guild))
|
||||
.WithOkColor();
|
||||
|
||||
await logChannel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
await logChannel.EmbedAsync(embed);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -444,8 +442,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
return;
|
||||
|
||||
ITextChannel logChannel;
|
||||
if ((logChannel = await TryGetLogChannel(usr.Guild, logSetting, LogType.UserMuted)
|
||||
.ConfigureAwait(false)) is null)
|
||||
if ((logChannel = await TryGetLogChannel(usr.Guild, logSetting, LogType.UserMuted)) is null)
|
||||
return;
|
||||
|
||||
var mutes = string.Empty;
|
||||
@@ -472,7 +469,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
if (!string.IsNullOrWhiteSpace(reason))
|
||||
embed.WithDescription(reason);
|
||||
|
||||
await logChannel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
await logChannel.EmbedAsync(embed);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -495,8 +492,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
|| logSetting.LogOtherId is null)
|
||||
return;
|
||||
ITextChannel logChannel;
|
||||
if ((logChannel = await TryGetLogChannel(users.First().Guild, logSetting, LogType.Other)
|
||||
.ConfigureAwait(false)) is null)
|
||||
if ((logChannel = await TryGetLogChannel(users.First().Guild, logSetting, LogType.Other)) is null)
|
||||
return;
|
||||
|
||||
var punishment = string.Empty;
|
||||
@@ -525,7 +521,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
.WithFooter(CurrentTime(logChannel.Guild))
|
||||
.WithOkColor();
|
||||
|
||||
await logChannel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
await logChannel.EmbedAsync(embed);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -570,8 +566,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
|
||||
ITextChannel logChannel;
|
||||
if (logSetting.UserUpdatedId != null &&
|
||||
(logChannel = await TryGetLogChannel(before.Guild, logSetting, LogType.UserUpdated)
|
||||
.ConfigureAwait(false)) != null)
|
||||
(logChannel = await TryGetLogChannel(before.Guild, logSetting, LogType.UserUpdated)) != null)
|
||||
{
|
||||
var embed = _eb.Create().WithOkColor()
|
||||
.WithFooter(CurrentTime(before.Guild))
|
||||
@@ -584,7 +579,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
.AddField(GetText(logChannel.Guild, strs.new_nick)
|
||||
, $"{after.Nickname}#{after.Discriminator}");
|
||||
|
||||
await logChannel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
await logChannel.EmbedAsync(embed);
|
||||
}
|
||||
else if (!before.Roles.SequenceEqual(after.Roles))
|
||||
{
|
||||
@@ -594,7 +589,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
embed.WithAuthor("⚔ " + GetText(logChannel.Guild, strs.user_role_add))
|
||||
.WithDescription(string.Join(", ", diffRoles).SanitizeMentions());
|
||||
|
||||
await logChannel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
await logChannel.EmbedAsync(embed);
|
||||
}
|
||||
else if (before.Roles.Count > after.Roles.Count)
|
||||
{
|
||||
@@ -609,7 +604,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
embed.WithAuthor("⚔ " + GetText(logChannel.Guild, strs.user_role_rem))
|
||||
.WithDescription(string.Join(", ", diffRoles).SanitizeMentions());
|
||||
|
||||
await logChannel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
await logChannel.EmbedAsync(embed);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -617,8 +612,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
|
||||
logChannel = null;
|
||||
if (!before.IsBot && logSetting.LogUserPresenceId != null && (logChannel =
|
||||
await TryGetLogChannel(before.Guild, logSetting, LogType.UserPresence)
|
||||
.ConfigureAwait(false)) != null)
|
||||
await TryGetLogChannel(before.Guild, logSetting, LogType.UserPresence)) != null)
|
||||
{
|
||||
if (before.Status != after.Status)
|
||||
{
|
||||
@@ -671,8 +665,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
return;
|
||||
|
||||
ITextChannel logChannel;
|
||||
if ((logChannel = await TryGetLogChannel(before.Guild, logSetting, LogType.ChannelUpdated)
|
||||
.ConfigureAwait(false)) is null)
|
||||
if ((logChannel = await TryGetLogChannel(before.Guild, logSetting, LogType.ChannelUpdated)) is null)
|
||||
return;
|
||||
|
||||
var embed = _eb.Create().WithOkColor()
|
||||
@@ -697,7 +690,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
else
|
||||
return;
|
||||
|
||||
await logChannel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
await logChannel.EmbedAsync(embed);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -722,8 +715,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
return;
|
||||
|
||||
ITextChannel logChannel;
|
||||
if ((logChannel = await TryGetLogChannel(ch.Guild, logSetting, LogType.ChannelDestroyed)
|
||||
.ConfigureAwait(false)) is null)
|
||||
if ((logChannel = await TryGetLogChannel(ch.Guild, logSetting, LogType.ChannelDestroyed)) is null)
|
||||
return;
|
||||
string title;
|
||||
if (ch is IVoiceChannel)
|
||||
@@ -737,7 +729,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
.WithOkColor()
|
||||
.WithTitle("🆕 " + title)
|
||||
.WithDescription($"{ch.Name} | {ch.Id}")
|
||||
.WithFooter(CurrentTime(ch.Guild))).ConfigureAwait(false);
|
||||
.WithFooter(CurrentTime(ch.Guild)));
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -761,8 +753,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
return;
|
||||
|
||||
ITextChannel logChannel;
|
||||
if ((logChannel = await TryGetLogChannel(ch.Guild, logSetting, LogType.ChannelCreated)
|
||||
.ConfigureAwait(false)) is null)
|
||||
if ((logChannel = await TryGetLogChannel(ch.Guild, logSetting, LogType.ChannelCreated)) is null)
|
||||
return;
|
||||
string title;
|
||||
if (ch is IVoiceChannel)
|
||||
@@ -776,7 +767,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
.WithOkColor()
|
||||
.WithTitle("🆕 " + title)
|
||||
.WithDescription($"{ch.Name} | {ch.Id}")
|
||||
.WithFooter(CurrentTime(ch.Guild))).ConfigureAwait(false);
|
||||
.WithFooter(CurrentTime(ch.Guild)));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -807,8 +798,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
return;
|
||||
|
||||
ITextChannel logChannel;
|
||||
if ((logChannel = await TryGetLogChannel(usr.Guild, logSetting, LogType.VoicePresence)
|
||||
.ConfigureAwait(false)) is null)
|
||||
if ((logChannel = await TryGetLogChannel(usr.Guild, logSetting, LogType.VoicePresence)) is null)
|
||||
return;
|
||||
|
||||
string str = null;
|
||||
@@ -860,8 +850,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
return;
|
||||
|
||||
ITextChannel logChannel;
|
||||
if ((logChannel = await TryGetLogChannel(guild, logSetting, LogType.UserLeft)
|
||||
.ConfigureAwait(false)) is null)
|
||||
if ((logChannel = await TryGetLogChannel(guild, logSetting, LogType.UserLeft)) is null)
|
||||
return;
|
||||
var embed = _eb.Create()
|
||||
.WithOkColor()
|
||||
@@ -873,7 +862,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
if (Uri.IsWellFormedUriString(usr.GetAvatarUrl(), UriKind.Absolute))
|
||||
embed.WithThumbnailUrl(usr.GetAvatarUrl());
|
||||
|
||||
await logChannel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
await logChannel.EmbedAsync(embed);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -894,8 +883,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
return;
|
||||
|
||||
ITextChannel logChannel;
|
||||
if ((logChannel = await TryGetLogChannel(usr.Guild, logSetting, LogType.UserJoined)
|
||||
.ConfigureAwait(false)) is null)
|
||||
if ((logChannel = await TryGetLogChannel(usr.Guild, logSetting, LogType.UserJoined)) is null)
|
||||
return;
|
||||
|
||||
var embed = _eb.Create()
|
||||
@@ -914,7 +902,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
if (Uri.IsWellFormedUriString(usr.GetAvatarUrl(), UriKind.Absolute))
|
||||
embed.WithThumbnailUrl(usr.GetAvatarUrl());
|
||||
|
||||
await logChannel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
await logChannel.EmbedAsync(embed);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -936,8 +924,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
return;
|
||||
|
||||
ITextChannel logChannel;
|
||||
if ((logChannel = await TryGetLogChannel(guild, logSetting, LogType.UserUnbanned)
|
||||
.ConfigureAwait(false)) is null)
|
||||
if ((logChannel = await TryGetLogChannel(guild, logSetting, LogType.UserUnbanned)) is null)
|
||||
return;
|
||||
var embed = _eb.Create()
|
||||
.WithOkColor()
|
||||
@@ -949,7 +936,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
if (Uri.IsWellFormedUriString(usr.GetAvatarUrl(), UriKind.Absolute))
|
||||
embed.WithThumbnailUrl(usr.GetAvatarUrl());
|
||||
|
||||
await logChannel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
await logChannel.EmbedAsync(embed);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -972,7 +959,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
|
||||
ITextChannel logChannel;
|
||||
if ((logChannel =
|
||||
await TryGetLogChannel(guild, logSetting, LogType.UserBanned).ConfigureAwait(false)) ==
|
||||
await TryGetLogChannel(guild, logSetting, LogType.UserBanned)) ==
|
||||
null)
|
||||
return;
|
||||
var embed = _eb.Create()
|
||||
@@ -987,7 +974,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
if (Uri.IsWellFormedUriString(avatarUrl, UriKind.Absolute))
|
||||
embed.WithThumbnailUrl(usr.GetAvatarUrl());
|
||||
|
||||
await logChannel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
await logChannel.EmbedAsync(embed);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -1019,8 +1006,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
return;
|
||||
|
||||
ITextChannel logChannel;
|
||||
if ((logChannel = await TryGetLogChannel(channel.Guild, logSetting, LogType.MessageDeleted)
|
||||
.ConfigureAwait(false)) is null || logChannel.Id == msg.Id)
|
||||
if ((logChannel = await TryGetLogChannel(channel.Guild, logSetting, LogType.MessageDeleted)) is null || logChannel.Id == msg.Id)
|
||||
return;
|
||||
|
||||
var resolvedMessage = msg.Resolve(userHandling: TagHandling.FullName);
|
||||
@@ -1038,7 +1024,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
string.Join(", ", msg.Attachments.Select(a => a.Url)),
|
||||
false);
|
||||
|
||||
await logChannel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
await logChannel.EmbedAsync(embed);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -1076,8 +1062,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
return;
|
||||
|
||||
ITextChannel logChannel;
|
||||
if ((logChannel = await TryGetLogChannel(channel.Guild, logSetting, LogType.MessageUpdated)
|
||||
.ConfigureAwait(false)) is null || logChannel.Id == after.Channel.Id)
|
||||
if ((logChannel = await TryGetLogChannel(channel.Guild, logSetting, LogType.MessageUpdated)) is null || logChannel.Id == after.Channel.Id)
|
||||
return;
|
||||
|
||||
var embed = _eb.Create()
|
||||
@@ -1098,7 +1083,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
.AddField("Id", after.Id.ToString(), false)
|
||||
.WithFooter(CurrentTime(channel.Guild));
|
||||
|
||||
await logChannel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
await logChannel.EmbedAsync(embed);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -1166,7 +1151,7 @@ public sealed class LogCommandService : ILogCommandService
|
||||
return null;
|
||||
}
|
||||
|
||||
var channel = await guild.GetTextChannelAsync(id.Value).ConfigureAwait(false);
|
||||
var channel = await guild.GetTextChannelAsync(id.Value);
|
||||
|
||||
if (channel is null)
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using NadekoBot.Db;
|
||||
@@ -152,7 +152,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").ConfigureAwait(false));
|
||||
var _ = Task.Run(() => MuteUser(usr, _client.CurrentUser, reason: "Sticky mute"));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -174,10 +174,10 @@ public class MuteService : INService
|
||||
{
|
||||
if (type == MuteType.All)
|
||||
{
|
||||
try { await usr.ModifyAsync(x => x.Mute = true).ConfigureAwait(false); } catch { }
|
||||
var muteRole = await GetMuteRole(usr.Guild).ConfigureAwait(false);
|
||||
try { await usr.ModifyAsync(x => x.Mute = true); } catch { }
|
||||
var muteRole = await GetMuteRole(usr.Guild);
|
||||
if (!usr.RoleIds.Contains(muteRole.Id))
|
||||
await usr.AddRoleAsync(muteRole).ConfigureAwait(false);
|
||||
await usr.AddRoleAsync(muteRole);
|
||||
StopTimer(usr.GuildId, usr.Id, TimerType.Mute);
|
||||
await using (var uow = _db.GetDbContext())
|
||||
{
|
||||
@@ -201,14 +201,14 @@ public class MuteService : INService
|
||||
{
|
||||
try
|
||||
{
|
||||
await usr.ModifyAsync(x => x.Mute = true).ConfigureAwait(false);
|
||||
await usr.ModifyAsync(x => x.Mute = true);
|
||||
UserMuted(usr, mod, MuteType.Voice, reason);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
else if (type == MuteType.Chat)
|
||||
{
|
||||
await usr.AddRoleAsync(await GetMuteRole(usr.Guild).ConfigureAwait(false)).ConfigureAwait(false);
|
||||
await usr.AddRoleAsync(await GetMuteRole(usr.Guild));
|
||||
UserMuted(usr, mod, MuteType.Chat, reason);
|
||||
}
|
||||
}
|
||||
@@ -241,8 +241,8 @@ public class MuteService : INService
|
||||
}
|
||||
if (usr != null)
|
||||
{
|
||||
try { await usr.ModifyAsync(x => x.Mute = false).ConfigureAwait(false); } catch { }
|
||||
try { await usr.RemoveRoleAsync(await GetMuteRole(usr.Guild).ConfigureAwait(false)).ConfigureAwait(false); } catch { /*ignore*/ }
|
||||
try { await usr.ModifyAsync(x => x.Mute = false); } catch { }
|
||||
try { await usr.RemoveRoleAsync(await GetMuteRole(usr.Guild)); } catch { /*ignore*/ }
|
||||
UserUnmuted(usr, mod, MuteType.All, reason);
|
||||
}
|
||||
}
|
||||
@@ -252,7 +252,7 @@ public class MuteService : INService
|
||||
return;
|
||||
try
|
||||
{
|
||||
await usr.ModifyAsync(x => x.Mute = false).ConfigureAwait(false);
|
||||
await usr.ModifyAsync(x => x.Mute = false);
|
||||
UserUnmuted(usr, mod, MuteType.Voice, reason);
|
||||
}
|
||||
catch { }
|
||||
@@ -261,7 +261,7 @@ public class MuteService : INService
|
||||
{
|
||||
if (usr is null)
|
||||
return;
|
||||
await usr.RemoveRoleAsync(await GetMuteRole(usr.Guild).ConfigureAwait(false)).ConfigureAwait(false);
|
||||
await usr.RemoveRoleAsync(await GetMuteRole(usr.Guild));
|
||||
UserUnmuted(usr, mod, MuteType.Chat, reason);
|
||||
}
|
||||
}
|
||||
@@ -280,26 +280,25 @@ public class MuteService : INService
|
||||
{
|
||||
|
||||
//if it doesn't exist, create it
|
||||
try { muteRole = await guild.CreateRoleAsync(muteRoleName, isMentionable: false).ConfigureAwait(false); }
|
||||
try { muteRole = await guild.CreateRoleAsync(muteRoleName, isMentionable: false); }
|
||||
catch
|
||||
{
|
||||
//if creations fails, maybe the name is not correct, find default one, if doesn't work, create default one
|
||||
muteRole = guild.Roles.FirstOrDefault(r => r.Name == muteRoleName) ??
|
||||
await guild.CreateRoleAsync(defaultMuteRoleName, isMentionable: false).ConfigureAwait(false);
|
||||
await guild.CreateRoleAsync(defaultMuteRoleName, isMentionable: false);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var toOverwrite in await guild.GetTextChannelsAsync().ConfigureAwait(false))
|
||||
foreach (var toOverwrite in await guild.GetTextChannelsAsync())
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!toOverwrite.PermissionOverwrites.Any(x => x.TargetId == muteRole.Id
|
||||
&& x.TargetType == PermissionTarget.Role))
|
||||
{
|
||||
await toOverwrite.AddPermissionOverwriteAsync(muteRole, denyOverwrite)
|
||||
.ConfigureAwait(false);
|
||||
await toOverwrite.AddPermissionOverwriteAsync(muteRole, denyOverwrite);
|
||||
|
||||
await Task.Delay(200).ConfigureAwait(false);
|
||||
await Task.Delay(200);
|
||||
}
|
||||
}
|
||||
catch
|
||||
@@ -313,7 +312,7 @@ public class MuteService : INService
|
||||
|
||||
public async Task TimedMute(IGuildUser user, IUser mod, TimeSpan after, MuteType muteType = MuteType.All, string reason = "")
|
||||
{
|
||||
await MuteUser(user, mod, muteType, reason).ConfigureAwait(false); // mute the user. This will also remove any previous unmute timers
|
||||
await MuteUser(user, mod, muteType, reason); // mute the user. This will also remove any previous unmute timers
|
||||
await using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var config = uow.GuildConfigsForId(user.GuildId, set => set.Include(x => x.UnmuteTimers));
|
||||
@@ -330,7 +329,7 @@ public class MuteService : INService
|
||||
|
||||
public async Task TimedBan(IGuild guild, IUser user, TimeSpan after, string reason)
|
||||
{
|
||||
await guild.AddBanAsync(user.Id, 0, reason).ConfigureAwait(false);
|
||||
await guild.AddBanAsync(user.Id, 0, reason);
|
||||
await using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var config = uow.GuildConfigsForId(guild.Id, set => set.Include(x => x.UnbanTimer));
|
||||
@@ -347,7 +346,7 @@ public class MuteService : INService
|
||||
|
||||
public async Task TimedRole(IGuildUser user, TimeSpan after, string reason, IRole role)
|
||||
{
|
||||
await user.AddRoleAsync(role).ConfigureAwait(false);
|
||||
await user.AddRoleAsync(role);
|
||||
await using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var config = uow.GuildConfigsForId(user.GuildId, set => set.Include(x => x.UnroleTimer));
|
||||
@@ -380,7 +379,7 @@ public class MuteService : INService
|
||||
var guild = _client.GetGuild(guildId); // load the guild
|
||||
if (guild != null)
|
||||
{
|
||||
await guild.RemoveBanAsync(userId).ConfigureAwait(false);
|
||||
await guild.RemoveBanAsync(userId);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -399,7 +398,7 @@ public class MuteService : INService
|
||||
var role = guild.GetRole(roleId.Value);
|
||||
if (guild != null && user != null && user.Roles.Contains(role))
|
||||
{
|
||||
await user.RemoveRoleAsync(role).ConfigureAwait(false);
|
||||
await user.RemoveRoleAsync(role);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -412,7 +411,7 @@ public class MuteService : INService
|
||||
try
|
||||
{
|
||||
// unmute the user, this will also remove the timer from the db
|
||||
await UnmuteUser(guildId, userId, _client.CurrentUser, reason: "Timed mute expired").ConfigureAwait(false);
|
||||
await UnmuteUser(guildId, userId, _client.CurrentUser, reason: "Timed mute expired");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using System.Threading.Channels;
|
||||
using NadekoBot.Modules.Administration.Common;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
@@ -181,9 +181,9 @@ public class ProtectionService : INService
|
||||
var settings = stats.AntiRaidSettings;
|
||||
|
||||
await PunishUsers(settings.Action, ProtectionType.Raiding,
|
||||
settings.PunishDuration, null, users).ConfigureAwait(false);
|
||||
settings.PunishDuration, null, users);
|
||||
}
|
||||
await Task.Delay(1000 * stats.AntiRaidSettings.Seconds).ConfigureAwait(false);
|
||||
await Task.Delay(1000 * stats.AntiRaidSettings.Seconds);
|
||||
|
||||
stats.RaidUsers.TryRemove(user);
|
||||
--stats.UsersCount;
|
||||
@@ -228,8 +228,7 @@ public class ProtectionService : INService
|
||||
stats.Dispose();
|
||||
var settings = spamSettings.AntiSpamSettings;
|
||||
await PunishUsers(settings.Action, ProtectionType.Spamming, settings.MuteTime,
|
||||
settings.RoleId, (IGuildUser)msg.Author)
|
||||
.ConfigureAwait(false);
|
||||
settings.RoleId, (IGuildUser)msg.Author);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -270,7 +269,7 @@ public class ProtectionService : INService
|
||||
PunishmentAction action, int minutesDuration)
|
||||
{
|
||||
var g = _client.GetGuild(guildId);
|
||||
await _mute.GetMuteRole(g).ConfigureAwait(false);
|
||||
await _mute.GetMuteRole(g);
|
||||
|
||||
if (action == PunishmentAction.AddRole)
|
||||
return null;
|
||||
@@ -338,7 +337,7 @@ public class ProtectionService : INService
|
||||
int punishDurationMinutes, ulong? roleId)
|
||||
{
|
||||
var g = _client.GetGuild(guildId);
|
||||
await _mute.GetMuteRole(g).ConfigureAwait(false);
|
||||
await _mute.GetMuteRole(g);
|
||||
|
||||
if (!IsDurationAllowed(action))
|
||||
punishDurationMinutes = 0;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
namespace NadekoBot.Modules.Administration.Services;
|
||||
|
||||
public class PruneService : INService
|
||||
@@ -25,7 +25,7 @@ public class PruneService : INService
|
||||
{
|
||||
IMessage[] msgs;
|
||||
IMessage lastMessage = null;
|
||||
msgs = (await channel.GetMessagesAsync(50).FlattenAsync().ConfigureAwait(false)).Where(predicate).Take(amount).ToArray();
|
||||
msgs = (await channel.GetMessagesAsync(50).FlattenAsync()).Where(predicate).Take(amount).ToArray();
|
||||
while (amount > 0 && msgs.Any())
|
||||
{
|
||||
lastMessage = msgs[msgs.Length - 1];
|
||||
@@ -43,16 +43,20 @@ public class PruneService : INService
|
||||
}
|
||||
|
||||
if (bulkDeletable.Count > 0)
|
||||
await Task.WhenAll(Task.Delay(1000), channel.DeleteMessagesAsync(bulkDeletable)).ConfigureAwait(false);
|
||||
await Task.WhenAll(Task.Delay(1000), channel.DeleteMessagesAsync(bulkDeletable));
|
||||
|
||||
foreach (var group in singleDeletable.Chunk(5))
|
||||
await Task.WhenAll(Task.Delay(1000), Task.WhenAll(group.Select(x => x.DeleteAsync()))).ConfigureAwait(false);
|
||||
await Task.WhenAll(
|
||||
Task.Delay(1000),
|
||||
group.Select(x => x.DeleteAsync())
|
||||
.WhenAll()
|
||||
);
|
||||
|
||||
//this isn't good, because this still work as if i want to remove only specific user's messages from the last
|
||||
//100 messages, Maybe this needs to be reduced by msgs.Length instead of 100
|
||||
amount -= 50;
|
||||
if(amount > 0)
|
||||
msgs = (await channel.GetMessagesAsync(lastMessage, Direction.Before, 50).FlattenAsync().ConfigureAwait(false)).Where(predicate).Take(amount).ToArray();
|
||||
msgs = (await channel.GetMessagesAsync(lastMessage, Direction.Before, 50).FlattenAsync()).Where(predicate).Take(amount).ToArray();
|
||||
}
|
||||
}
|
||||
catch
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NadekoBot.Common.Collections;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
@@ -72,7 +72,7 @@ public class RoleCommandsService : INService
|
||||
var removeExclusiveTask = RemoveExclusiveReactionRoleAsync(msg, gusr, reaction, conf, reactionRole, CancellationToken.None);
|
||||
var addRoleTask = AddReactionRoleAsync(gusr, reactionRole);
|
||||
|
||||
await Task.WhenAll(removeExclusiveTask, addRoleTask).ConfigureAwait(false);
|
||||
await Task.WhenAll(removeExclusiveTask, addRoleTask);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -82,12 +82,12 @@ public class RoleCommandsService : INService
|
||||
}
|
||||
else
|
||||
{
|
||||
var dl = await msg.GetOrDownloadAsync().ConfigureAwait(false);
|
||||
var dl = await msg.GetOrDownloadAsync();
|
||||
await dl.RemoveReactionAsync(reaction.Emote, dl.Author,
|
||||
new()
|
||||
{
|
||||
RetryMode = RetryMode.RetryRatelimit | RetryMode.Retry502
|
||||
}).ConfigureAwait(false);
|
||||
});
|
||||
Log.Warning("User {0} is adding unrelated reactions to the reaction roles message.", dl.Author);
|
||||
}
|
||||
});
|
||||
@@ -126,7 +126,7 @@ public class RoleCommandsService : INService
|
||||
var role = gusr.Guild.GetRole(reactionRole.RoleId);
|
||||
if (role is null)
|
||||
return;
|
||||
await gusr.RemoveRoleAsync(role).ConfigureAwait(false);
|
||||
await gusr.RemoveRoleAsync(role);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
@@ -231,13 +231,13 @@ public class RoleCommandsService : INService
|
||||
|
||||
//if the role is exclusive,
|
||||
// remove all other reactions user added to the message
|
||||
var dl = await reactionMessage.GetOrDownloadAsync().ConfigureAwait(false);
|
||||
var dl = await reactionMessage.GetOrDownloadAsync();
|
||||
foreach (var r in dl.Reactions)
|
||||
{
|
||||
if (r.Key.Name == reaction.Emote.Name)
|
||||
continue;
|
||||
try { await dl.RemoveReactionAsync(r.Key, user).ConfigureAwait(false); } catch { }
|
||||
await Task.Delay(100, cToken).ConfigureAwait(false);
|
||||
try { await dl.RemoveReactionAsync(r.Key, user); } catch { }
|
||||
await Task.Delay(100, cToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NadekoBot.Db;
|
||||
@@ -99,8 +99,8 @@ public class SelfAssignedRolesService : INService
|
||||
{
|
||||
try
|
||||
{
|
||||
await guildUser.RemoveRoleAsync(sameRole).ConfigureAwait(false);
|
||||
await Task.Delay(300).ConfigureAwait(false);
|
||||
await guildUser.RemoveRoleAsync(sameRole);
|
||||
await Task.Delay(300);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -111,7 +111,7 @@ public class SelfAssignedRolesService : INService
|
||||
}
|
||||
try
|
||||
{
|
||||
await guildUser.AddRoleAsync(role).ConfigureAwait(false);
|
||||
await guildUser.AddRoleAsync(role);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -167,7 +167,7 @@ public class SelfAssignedRolesService : INService
|
||||
}
|
||||
try
|
||||
{
|
||||
await guildUser.RemoveRoleAsync(role).ConfigureAwait(false);
|
||||
await guildUser.RemoveRoleAsync(role);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using System.Collections.Immutable;
|
||||
using NadekoBot.Common.ModuleBehaviors;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@@ -79,12 +79,12 @@ public sealed class SelfService : ILateExecutor, IReadyExecutor, INService
|
||||
|
||||
if (server.OwnerId != _client.CurrentUser.Id)
|
||||
{
|
||||
await server.LeaveAsync().ConfigureAwait(false);
|
||||
await server.LeaveAsync();
|
||||
Log.Information($"Left server {server.Name} [{server.Id}]");
|
||||
}
|
||||
else
|
||||
{
|
||||
await server.DeleteAsync().ConfigureAwait(false);
|
||||
await server.DeleteAsync();
|
||||
Log.Information($"Deleted server {server.Name} [{server.Id}]");
|
||||
}
|
||||
});
|
||||
@@ -110,7 +110,7 @@ public sealed class SelfService : ILateExecutor, IReadyExecutor, INService
|
||||
{
|
||||
try
|
||||
{
|
||||
await ExecuteCommand(cmd).ConfigureAwait(false);
|
||||
await ExecuteCommand(cmd);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -119,12 +119,12 @@ public sealed class SelfService : ILateExecutor, IReadyExecutor, INService
|
||||
|
||||
if (_client.ShardId == 0)
|
||||
{
|
||||
await LoadOwnerChannels().ConfigureAwait(false);
|
||||
await LoadOwnerChannels();
|
||||
}
|
||||
}
|
||||
|
||||
private Timer TimerFromAutoCommand(AutoCommand x)
|
||||
=> new(async obj => await ExecuteCommand((AutoCommand) obj).ConfigureAwait(false),
|
||||
=> new(async obj => await ExecuteCommand((AutoCommand) obj),
|
||||
x,
|
||||
x.Interval * 1000,
|
||||
x.Interval * 1000);
|
||||
@@ -143,7 +143,7 @@ public sealed class SelfService : ILateExecutor, IReadyExecutor, INService
|
||||
//if someone already has .die as their startup command, ignore it
|
||||
if (cmd.CommandText.StartsWith(prefix + "die", StringComparison.InvariantCulture))
|
||||
return;
|
||||
await _cmdHandler.ExecuteExternal(cmd.GuildId, cmd.ChannelId, cmd.CommandText).ConfigureAwait(false);
|
||||
await _cmdHandler.ExecuteExternal(cmd.GuildId, cmd.ChannelId, cmd.CommandText);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -201,7 +201,7 @@ public sealed class SelfService : ILateExecutor, IReadyExecutor, INService
|
||||
return Task.FromResult<IDMChannel>(null);
|
||||
|
||||
return user.CreateDMChannelAsync();
|
||||
})).ConfigureAwait(false);
|
||||
}));
|
||||
|
||||
ownerChannels = channels.Where(x => x != null)
|
||||
.ToDictionary(x => x.Recipient.Id, x => x)
|
||||
@@ -244,7 +244,7 @@ public sealed class SelfService : ILateExecutor, IReadyExecutor, INService
|
||||
{
|
||||
try
|
||||
{
|
||||
await ownerCh.SendConfirmAsync(_eb, title, toSend).ConfigureAwait(false);
|
||||
await ownerCh.SendConfirmAsync(_eb, title, toSend);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -259,7 +259,7 @@ public sealed class SelfService : ILateExecutor, IReadyExecutor, INService
|
||||
{
|
||||
try
|
||||
{
|
||||
await firstOwnerChannel.SendConfirmAsync(_eb, title, toSend).ConfigureAwait(false);
|
||||
await firstOwnerChannel.SendConfirmAsync(_eb, title, toSend);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -322,14 +322,14 @@ public sealed class SelfService : ILateExecutor, IReadyExecutor, INService
|
||||
var uri = new Uri(img);
|
||||
|
||||
using var http = _httpFactory.CreateClient();
|
||||
using var sr = await http.GetAsync(uri, HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false);
|
||||
using var sr = await http.GetAsync(uri, HttpCompletionOption.ResponseHeadersRead);
|
||||
if (!sr.IsImage())
|
||||
return false;
|
||||
|
||||
// i can't just do ReadAsStreamAsync because dicord.net's image poops itself
|
||||
var imgData = await sr.Content.ReadAsByteArrayAsync().ConfigureAwait(false);
|
||||
var imgData = await sr.Content.ReadAsByteArrayAsync();
|
||||
await using var imgStream = imgData.ToStream();
|
||||
await _client.CurrentUser.ModifyAsync(u => u.Avatar = new Image(imgStream)).ConfigureAwait(false);
|
||||
await _client.CurrentUser.ModifyAsync(u => u.Avatar = new Image(imgStream));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -73,7 +73,7 @@ public class UserPunishService : INService
|
||||
|
||||
if (p != null)
|
||||
{
|
||||
var user = await guild.GetUserAsync(userId).ConfigureAwait(false);
|
||||
var user = await guild.GetUserAsync(userId);
|
||||
if (user is null)
|
||||
return null;
|
||||
|
||||
@@ -95,50 +95,45 @@ public class UserPunishService : INService
|
||||
{
|
||||
case PunishmentAction.Mute:
|
||||
if (minutes == 0)
|
||||
await _mute.MuteUser(user, mod, reason: reason).ConfigureAwait(false);
|
||||
await _mute.MuteUser(user, mod, reason: reason);
|
||||
else
|
||||
await _mute.TimedMute(user, mod, TimeSpan.FromMinutes(minutes), reason: reason)
|
||||
.ConfigureAwait(false);
|
||||
await _mute.TimedMute(user, mod, TimeSpan.FromMinutes(minutes), reason: reason);
|
||||
break;
|
||||
case PunishmentAction.VoiceMute:
|
||||
if (minutes == 0)
|
||||
await _mute.MuteUser(user, mod, MuteType.Voice, reason).ConfigureAwait(false);
|
||||
await _mute.MuteUser(user, mod, MuteType.Voice, reason);
|
||||
else
|
||||
await _mute.TimedMute(user, mod, TimeSpan.FromMinutes(minutes), MuteType.Voice, reason)
|
||||
.ConfigureAwait(false);
|
||||
await _mute.TimedMute(user, mod, TimeSpan.FromMinutes(minutes), MuteType.Voice, reason);
|
||||
break;
|
||||
case PunishmentAction.ChatMute:
|
||||
if (minutes == 0)
|
||||
await _mute.MuteUser(user, mod, MuteType.Chat, reason).ConfigureAwait(false);
|
||||
await _mute.MuteUser(user, mod, MuteType.Chat, reason);
|
||||
else
|
||||
await _mute.TimedMute(user, mod, TimeSpan.FromMinutes(minutes), MuteType.Chat, reason)
|
||||
.ConfigureAwait(false);
|
||||
await _mute.TimedMute(user, mod, TimeSpan.FromMinutes(minutes), MuteType.Chat, reason);
|
||||
break;
|
||||
case PunishmentAction.Kick:
|
||||
await user.KickAsync(reason).ConfigureAwait(false);
|
||||
await user.KickAsync(reason);
|
||||
break;
|
||||
case PunishmentAction.Ban:
|
||||
if (minutes == 0)
|
||||
await guild.AddBanAsync(user, reason: reason, pruneDays: 7).ConfigureAwait(false);
|
||||
await guild.AddBanAsync(user, reason: reason, pruneDays: 7);
|
||||
else
|
||||
await _mute.TimedBan(user.Guild, user, TimeSpan.FromMinutes(minutes), reason)
|
||||
.ConfigureAwait(false);
|
||||
await _mute.TimedBan(user.Guild, user, TimeSpan.FromMinutes(minutes), reason);
|
||||
break;
|
||||
case PunishmentAction.Softban:
|
||||
await guild.AddBanAsync(user, 7, reason: $"Softban | {reason}").ConfigureAwait(false);
|
||||
await guild.AddBanAsync(user, 7, reason: $"Softban | {reason}");
|
||||
try
|
||||
{
|
||||
await guild.RemoveBanAsync(user).ConfigureAwait(false);
|
||||
await guild.RemoveBanAsync(user);
|
||||
}
|
||||
catch
|
||||
{
|
||||
await guild.RemoveBanAsync(user).ConfigureAwait(false);
|
||||
await guild.RemoveBanAsync(user);
|
||||
}
|
||||
|
||||
break;
|
||||
case PunishmentAction.RemoveRoles:
|
||||
await user.RemoveRolesAsync(user.GetRoles().Where(x => !x.IsManaged && x != x.Guild.EveryoneRole))
|
||||
.ConfigureAwait(false);
|
||||
await user.RemoveRolesAsync(user.GetRoles().Where(x => !x.IsManaged && x != x.Guild.EveryoneRole));
|
||||
break;
|
||||
case PunishmentAction.AddRole:
|
||||
if (roleId is null)
|
||||
@@ -147,10 +142,9 @@ public class UserPunishService : INService
|
||||
if (role is not null)
|
||||
{
|
||||
if (minutes == 0)
|
||||
await user.AddRoleAsync(role).ConfigureAwait(false);
|
||||
await user.AddRoleAsync(role);
|
||||
else
|
||||
await _mute.TimedRole(user, TimeSpan.FromMinutes(minutes), reason, role)
|
||||
.ConfigureAwait(false);
|
||||
await _mute.TimedRole(user, TimeSpan.FromMinutes(minutes), reason, role);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using NadekoBot.Db;
|
||||
@@ -21,49 +21,60 @@ public class VcRoleService : INService
|
||||
_client.UserVoiceStateUpdated += ClientOnUserVoiceStateUpdated;
|
||||
VcRoles = new();
|
||||
ToAssign = new();
|
||||
var missingRoles = new ConcurrentBag<VcRoleInfo>();
|
||||
|
||||
using (var uow = db.GetDbContext())
|
||||
{
|
||||
var guildIds = client.Guilds.Select(x => x.Id).ToList();
|
||||
var configs = uow.Set<GuildConfig>()
|
||||
uow.Set<GuildConfig>()
|
||||
.AsQueryable()
|
||||
.Include(x => x.VcRoleInfos)
|
||||
.Where(x => guildIds.Contains(x.GuildId))
|
||||
.ToList();
|
||||
|
||||
Task.WhenAll(configs.Select(InitializeVcRole));
|
||||
.AsEnumerable()
|
||||
.Select(InitializeVcRole)
|
||||
.WhenAll();
|
||||
}
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
var tasks = ToAssign.Values.Select(queue => Task.Run(async () =>
|
||||
{
|
||||
while (queue.TryDequeue(out var item))
|
||||
{
|
||||
var (add, user, role) = item;
|
||||
if (add)
|
||||
Task Selector(ConcurrentQueue<(bool, IGuildUser, IRole)> queue)
|
||||
=> Task.Run(async () =>
|
||||
{
|
||||
if (!user.RoleIds.Contains(role.Id))
|
||||
while (queue.TryDequeue(out var item))
|
||||
{
|
||||
try { await user.AddRoleAsync(role).ConfigureAwait(false); } catch { }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (user.RoleIds.Contains(role.Id))
|
||||
{
|
||||
try { await user.RemoveRoleAsync(role).ConfigureAwait(false); } catch { }
|
||||
var (add, user, role) = item;
|
||||
|
||||
try
|
||||
{
|
||||
if (add)
|
||||
{
|
||||
if (!user.RoleIds.Contains(role.Id))
|
||||
{
|
||||
await user.AddRoleAsync(role);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (user.RoleIds.Contains(role.Id))
|
||||
{
|
||||
await user.RemoveRoleAsync(role);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
await Task.Delay(250);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
await Task.Delay(250).ConfigureAwait(false);
|
||||
}
|
||||
}));
|
||||
|
||||
await Task.WhenAll(tasks.Append(Task.Delay(1000))).ConfigureAwait(false);
|
||||
await ToAssign.Values.Select(Selector)
|
||||
.Append(Task.Delay(1000))
|
||||
.WhenAll();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -119,7 +130,10 @@ public class VcRoleService : INService
|
||||
if (missingRoles.Any())
|
||||
{
|
||||
await using var uow = _db.GetDbContext();
|
||||
Log.Warning($"Removing {missingRoles.Count} missing roles from {nameof(VcRoleService)}");
|
||||
Log.Warning("Removing {MissingRoleCount} missing roles from {ServiceName}",
|
||||
missingRoles.Count,
|
||||
nameof(VcRoleService)
|
||||
);
|
||||
uow.RemoveRange(missingRoles);
|
||||
await uow.SaveChangesAsync();
|
||||
}
|
||||
@@ -132,7 +146,7 @@ public class VcRoleService : INService
|
||||
|
||||
var guildVcRoles = VcRoles.GetOrAdd(guildId, new ConcurrentDictionary<ulong, IRole>());
|
||||
|
||||
guildVcRoles.AddOrUpdate(vcId, role, (key, old) => role);
|
||||
guildVcRoles.AddOrUpdate(vcId, role, (_, _) => role);
|
||||
using var uow = _db.GetDbContext();
|
||||
var conf = uow.GuildConfigsForId(guildId, set => set.Include(x => x.VcRoleInfos));
|
||||
var toDelete = conf.VcRoleInfos.FirstOrDefault(x => x.VoiceChannelId == vcId); // remove old one
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using NadekoBot.Modules.Administration.Services;
|
||||
|
||||
namespace NadekoBot.Modules.Administration;
|
||||
@@ -51,13 +51,13 @@ public partial class Administration
|
||||
.WithDescription(string.Join("\n", timezoneStrings
|
||||
.Skip(curPage * timezonesPerPage)
|
||||
.Take(timezonesPerPage))),
|
||||
timezones.Length, timezonesPerPage).ConfigureAwait(false);
|
||||
timezones.Length, timezonesPerPage);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Timezone()
|
||||
=> await ReplyConfirmLocalizedAsync(strs.timezone_guild(_service.GetTimeZoneOrUtc(ctx.Guild.Id))).ConfigureAwait(false);
|
||||
=> await ReplyConfirmLocalizedAsync(strs.timezone_guild(_service.GetTimeZoneOrUtc(ctx.Guild.Id)));
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
@@ -70,12 +70,12 @@ public partial class Administration
|
||||
|
||||
if (tz is null)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.timezone_not_found).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.timezone_not_found);
|
||||
return;
|
||||
}
|
||||
_service.SetTimeZone(ctx.Guild.Id, tz);
|
||||
|
||||
await SendConfirmAsync(tz.ToString()).ConfigureAwait(false);
|
||||
await SendConfirmAsync(tz.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -64,8 +64,7 @@ public partial class Administration
|
||||
await user.EmbedAsync(_eb.Create().WithErrorColor()
|
||||
.WithDescription(GetText(strs.warned_on(ctx.Guild.ToString())))
|
||||
.AddField(GetText(strs.moderator), ctx.User.ToString())
|
||||
.AddField(GetText(strs.reason), reason ?? "-"))
|
||||
.ConfigureAwait(false);
|
||||
.AddField(GetText(strs.reason), reason ?? "-"));
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -75,7 +74,7 @@ public partial class Administration
|
||||
WarningPunishment punishment;
|
||||
try
|
||||
{
|
||||
punishment = await _service.Warn(ctx.Guild, user.Id, ctx.User, weight, reason).ConfigureAwait(false);
|
||||
punishment = await _service.Warn(ctx.Guild, user.Id, ctx.User, weight, reason);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -150,22 +149,22 @@ public partial class Administration
|
||||
|
||||
var opts = OptionsParser.ParseFrom<WarnExpireOptions>(args);
|
||||
|
||||
await ctx.Channel.TriggerTypingAsync().ConfigureAwait(false);
|
||||
await ctx.Channel.TriggerTypingAsync();
|
||||
|
||||
await _service.WarnExpireAsync(ctx.Guild.Id, days, opts.Delete).ConfigureAwait(false);
|
||||
await _service.WarnExpireAsync(ctx.Guild.Id, days, opts.Delete);
|
||||
if(days == 0)
|
||||
{
|
||||
await ReplyConfirmLocalizedAsync(strs.warn_expire_reset).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.warn_expire_reset);
|
||||
return;
|
||||
}
|
||||
|
||||
if (opts.Delete)
|
||||
{
|
||||
await ReplyConfirmLocalizedAsync(strs.warn_expire_set_delete(Format.Bold(days.ToString()))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.warn_expire_set_delete(Format.Bold(days.ToString())));
|
||||
}
|
||||
else
|
||||
{
|
||||
await ReplyConfirmLocalizedAsync(strs.warn_expire_set_clear(Format.Bold(days.ToString()))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.warn_expire_set_clear(Format.Bold(days.ToString())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,7 +284,7 @@ public partial class Administration
|
||||
return _eb.Create().WithOkColor()
|
||||
.WithTitle(GetText(strs.warnings_list))
|
||||
.WithDescription(string.Join("\n", ws));
|
||||
}, warnings.Length, 15).ConfigureAwait(false);
|
||||
}, warnings.Length, 15);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -315,7 +314,7 @@ public partial class Administration
|
||||
}
|
||||
else
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.warning_clear_fail).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.warning_clear_fail);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -421,7 +420,7 @@ public partial class Administration
|
||||
}
|
||||
await SendConfirmAsync(
|
||||
GetText(strs.warn_punish_list),
|
||||
list).ConfigureAwait(false);
|
||||
list);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -458,7 +457,7 @@ public partial class Administration
|
||||
}
|
||||
}
|
||||
|
||||
await _mute.TimedBan(ctx.Guild, user, time.Time, (ctx.User.ToString() + " | " + msg).TrimTo(512)).ConfigureAwait(false);
|
||||
await _mute.TimedBan(ctx.Guild, user, time.Time, (ctx.User.ToString() + " | " + msg).TrimTo(512));
|
||||
var toSend = _eb.Create().WithOkColor()
|
||||
.WithTitle("⛔️ " + GetText(strs.banned_user))
|
||||
.AddField(GetText(strs.username), user.ToString(), true)
|
||||
@@ -474,8 +473,7 @@ public partial class Administration
|
||||
toSend.WithFooter("⚠️ " + GetText(strs.unable_to_dm_user));
|
||||
}
|
||||
|
||||
await ctx.Channel.EmbedAsync(toSend)
|
||||
.ConfigureAwait(false);
|
||||
await ctx.Channel.EmbedAsync(toSend);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -492,8 +490,7 @@ public partial class Administration
|
||||
|
||||
await ctx.Channel.EmbedAsync(_eb.Create().WithOkColor()
|
||||
.WithTitle("⛔️ " + GetText(strs.banned_user))
|
||||
.AddField("ID", userId.ToString(), true))
|
||||
.ConfigureAwait(false);
|
||||
.AddField("ID", userId.ToString(), true));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -527,7 +524,7 @@ public partial class Administration
|
||||
dmFailed = true;
|
||||
}
|
||||
|
||||
await ctx.Guild.AddBanAsync(user, 7, (ctx.User.ToString() + " | " + msg).TrimTo(512)).ConfigureAwait(false);
|
||||
await ctx.Guild.AddBanAsync(user, 7, (ctx.User.ToString() + " | " + msg).TrimTo(512));
|
||||
|
||||
var toSend = _eb.Create().WithOkColor()
|
||||
.WithTitle("⛔️ " + GetText(strs.banned_user))
|
||||
@@ -539,8 +536,7 @@ public partial class Administration
|
||||
toSend.WithFooter("⚠️ " + GetText(strs.unable_to_dm_user));
|
||||
}
|
||||
|
||||
await ctx.Channel.EmbedAsync(toSend)
|
||||
.ConfigureAwait(false);
|
||||
await ctx.Channel.EmbedAsync(toSend);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -627,17 +623,17 @@ public partial class Administration
|
||||
[BotPerm(GuildPerm.BanMembers)]
|
||||
public async Task Unban([Leftover] string user)
|
||||
{
|
||||
var bans = await ctx.Guild.GetBansAsync().ConfigureAwait(false);
|
||||
var bans = await ctx.Guild.GetBansAsync();
|
||||
|
||||
var bun = bans.FirstOrDefault(x => x.User.ToString().ToLowerInvariant() == user.ToLowerInvariant());
|
||||
|
||||
if (bun is null)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.user_not_found).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.user_not_found);
|
||||
return;
|
||||
}
|
||||
|
||||
await UnbanInternal(bun.User).ConfigureAwait(false);
|
||||
await UnbanInternal(bun.User);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -646,24 +642,24 @@ public partial class Administration
|
||||
[BotPerm(GuildPerm.BanMembers)]
|
||||
public async Task Unban(ulong userId)
|
||||
{
|
||||
var bans = await ctx.Guild.GetBansAsync().ConfigureAwait(false);
|
||||
var bans = await ctx.Guild.GetBansAsync();
|
||||
|
||||
var bun = bans.FirstOrDefault(x => x.User.Id == userId);
|
||||
|
||||
if (bun is null)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.user_not_found).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.user_not_found);
|
||||
return;
|
||||
}
|
||||
|
||||
await UnbanInternal(bun.User).ConfigureAwait(false);
|
||||
await UnbanInternal(bun.User);
|
||||
}
|
||||
|
||||
private async Task UnbanInternal(IUser user)
|
||||
{
|
||||
await ctx.Guild.RemoveBanAsync(user).ConfigureAwait(false);
|
||||
await ctx.Guild.RemoveBanAsync(user);
|
||||
|
||||
await ReplyConfirmLocalizedAsync(strs.unbanned_user(Format.Bold(user.ToString()))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.unbanned_user(Format.Bold(user.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -702,9 +698,9 @@ public partial class Administration
|
||||
dmFailed = true;
|
||||
}
|
||||
|
||||
await ctx.Guild.AddBanAsync(user, 7, ("Softban | " + ctx.User.ToString() + " | " + msg).TrimTo(512)).ConfigureAwait(false);
|
||||
try { await ctx.Guild.RemoveBanAsync(user).ConfigureAwait(false); }
|
||||
catch { await ctx.Guild.RemoveBanAsync(user).ConfigureAwait(false); }
|
||||
await ctx.Guild.AddBanAsync(user, 7, ("Softban | " + ctx.User.ToString() + " | " + msg).TrimTo(512));
|
||||
try { await ctx.Guild.RemoveBanAsync(user); }
|
||||
catch { await ctx.Guild.RemoveBanAsync(user); }
|
||||
|
||||
var toSend = _eb.Create().WithOkColor()
|
||||
.WithTitle("☣ " + GetText(strs.sb_user))
|
||||
@@ -716,8 +712,7 @@ public partial class Administration
|
||||
toSend.WithFooter("⚠️ " + GetText(strs.unable_to_dm_user));
|
||||
}
|
||||
|
||||
await ctx.Channel.EmbedAsync(toSend)
|
||||
.ConfigureAwait(false);
|
||||
await ctx.Channel.EmbedAsync(toSend);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -751,15 +746,14 @@ public partial class Administration
|
||||
|
||||
try
|
||||
{
|
||||
await user.SendErrorAsync(_eb, GetText(strs.kickdm(Format.Bold(ctx.Guild.Name), msg)))
|
||||
.ConfigureAwait(false);
|
||||
await user.SendErrorAsync(_eb, GetText(strs.kickdm(Format.Bold(ctx.Guild.Name), msg)));
|
||||
}
|
||||
catch
|
||||
{
|
||||
dmFailed = true;
|
||||
}
|
||||
|
||||
await user.KickAsync((ctx.User.ToString() + " | " + msg).TrimTo(512)).ConfigureAwait(false);
|
||||
await user.KickAsync((ctx.User.ToString() + " | " + msg).TrimTo(512));
|
||||
|
||||
var toSend = _eb.Create().WithOkColor()
|
||||
.WithTitle(GetText(strs.kicked_user))
|
||||
@@ -771,8 +765,7 @@ public partial class Administration
|
||||
toSend.WithFooter("⚠️ " + GetText(strs.unable_to_dm_user));
|
||||
}
|
||||
|
||||
await ctx.Channel.EmbedAsync(toSend)
|
||||
.ConfigureAwait(false);
|
||||
await ctx.Channel.EmbedAsync(toSend);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -853,7 +846,7 @@ public partial class Administration
|
||||
.WithDescription(GetText(strs.mass_ban_completed(banning.Count())))
|
||||
.AddField(GetText(strs.invalid(missing.Count)), missStr)
|
||||
.WithOkColor()
|
||||
.Build()).ConfigureAwait(false);
|
||||
.Build());
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -884,17 +877,16 @@ public partial class Administration
|
||||
.Select(x => ctx.Guild.AddBanAsync(x.Id.Value, 7, x.Reason, new()
|
||||
{
|
||||
RetryMode = RetryMode.AlwaysRetry,
|
||||
})))
|
||||
.ConfigureAwait(false);
|
||||
})));
|
||||
|
||||
//wait for the message and edit it
|
||||
var banningMessage = await banningMessageTask.ConfigureAwait(false);
|
||||
var banningMessage = await banningMessageTask;
|
||||
|
||||
await banningMessage.ModifyAsync(x => x.Embed = _eb.Create()
|
||||
.WithDescription(GetText(strs.mass_kill_completed(bans.Count())))
|
||||
.AddField(GetText(strs.invalid(missing)), missStr)
|
||||
.WithOkColor()
|
||||
.Build()).ConfigureAwait(false);
|
||||
.Build());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using NadekoBot.Modules.Administration.Services;
|
||||
|
||||
namespace NadekoBot.Modules.Administration;
|
||||
@@ -16,11 +16,11 @@ public partial class Administration
|
||||
{
|
||||
if (_service.RemoveVcRole(ctx.Guild.Id, vcId))
|
||||
{
|
||||
await ReplyConfirmLocalizedAsync(strs.vcrole_removed(Format.Bold(vcId.ToString()))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.vcrole_removed(Format.Bold(vcId.ToString())));
|
||||
}
|
||||
else
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.vcrole_not_found).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.vcrole_not_found);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public partial class Administration
|
||||
|
||||
if (vc is null || vc.GuildId != user.GuildId)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.must_be_in_voice).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.must_be_in_voice);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -44,13 +44,13 @@ public partial class Administration
|
||||
{
|
||||
if (_service.RemoveVcRole(ctx.Guild.Id, vc.Id))
|
||||
{
|
||||
await ReplyConfirmLocalizedAsync(strs.vcrole_removed(Format.Bold(vc.Name))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.vcrole_removed(Format.Bold(vc.Name)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_service.AddVcRole(ctx.Guild.Id, role, vc.Id);
|
||||
await ReplyConfirmLocalizedAsync(strs.vcrole_added(Format.Bold(vc.Name), Format.Bold(role.Name))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.vcrole_added(Format.Bold(vc.Name), Format.Bold(role.Name)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,8 +78,7 @@ public partial class Administration
|
||||
}
|
||||
await ctx.Channel.EmbedAsync(_eb.Create().WithOkColor()
|
||||
.WithTitle(GetText(strs.vc_role_list))
|
||||
.WithDescription(text))
|
||||
.ConfigureAwait(false);
|
||||
.WithDescription(text));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user