mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 17:58:26 -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:
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using System.Reflection;
|
||||
|
||||
namespace NadekoBot.Modules.Utility;
|
||||
@@ -15,9 +15,9 @@ public partial class Utility
|
||||
expr.EvaluateParameter += Expr_EvaluateParameter;
|
||||
var result = expr.Evaluate();
|
||||
if (!expr.HasErrors())
|
||||
await SendConfirmAsync("⚙ " + GetText(strs.result), result.ToString()).ConfigureAwait(false);
|
||||
await SendConfirmAsync("⚙ " + GetText(strs.result), result.ToString());
|
||||
else
|
||||
await SendErrorAsync("⚙ " + GetText(strs.error), expr.Error).ConfigureAwait(false);
|
||||
await SendErrorAsync("⚙ " + GetText(strs.error), expr.Error);
|
||||
}
|
||||
|
||||
private static void Expr_EvaluateParameter(string name, NCalc.ParameterArgs args)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using NadekoBot.Db;
|
||||
@@ -46,7 +46,7 @@ public partial class Utility
|
||||
if (!_service.AliasMaps.TryGetValue(ctx.Guild.Id, out var maps) ||
|
||||
!maps.TryRemove(trigger, out _))
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.alias_remove_fail(Format.Code(trigger))).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.alias_remove_fail(Format.Code(trigger)));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public partial class Utility
|
||||
uow.SaveChanges();
|
||||
}
|
||||
|
||||
await ReplyConfirmLocalizedAsync(strs.alias_removed(Format.Code(trigger))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.alias_removed(Format.Code(trigger)));
|
||||
return;
|
||||
}
|
||||
_service.AliasMaps.AddOrUpdate(ctx.Guild.Id, _ =>
|
||||
@@ -102,7 +102,7 @@ public partial class Utility
|
||||
return map;
|
||||
});
|
||||
|
||||
await ReplyConfirmLocalizedAsync(strs.alias_added(Format.Code(trigger), Format.Code(mapping))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.alias_added(Format.Code(trigger), Format.Code(mapping)));
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ public partial class Utility
|
||||
|
||||
if (!_service.AliasMaps.TryGetValue(ctx.Guild.Id, out var maps) || !maps.Any())
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.aliases_none).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.aliases_none);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ public partial class Utility
|
||||
.WithDescription(string.Join("\n",
|
||||
arr.Skip(curPage * 10).Take(10).Select(x => $"`{x.Key}` => `{x.Value}`")));
|
||||
|
||||
}, arr.Length, 10).ConfigureAwait(false);
|
||||
}, arr.Length, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -67,7 +67,7 @@ public partial class Utility
|
||||
.Select(e => $"{e.Name} {e.ToString()}"))
|
||||
.TrimTo(1020));
|
||||
}
|
||||
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -78,7 +78,7 @@ public partial class Utility
|
||||
if (ch is null)
|
||||
return;
|
||||
var createdAt = new DateTime(2015, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds(ch.Id >> 22);
|
||||
var usercount = (await ch.GetUsersAsync().FlattenAsync().ConfigureAwait(false)).Count();
|
||||
var usercount = (await ch.GetUsersAsync().FlattenAsync()).Count();
|
||||
var embed = _eb.Create()
|
||||
.WithTitle(ch.Name)
|
||||
.WithDescription(ch.Topic?.SanitizeMentions(true))
|
||||
@@ -86,7 +86,7 @@ public partial class Utility
|
||||
.AddField(GetText(strs.created_at), $"{createdAt:dd.MM.yyyy HH:mm}", true)
|
||||
.AddField(GetText(strs.users), usercount.ToString(), true)
|
||||
.WithOkColor();
|
||||
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -113,7 +113,7 @@ public partial class Utility
|
||||
var av = user.RealAvatarUrl();
|
||||
if (av != null && av.IsAbsoluteUri)
|
||||
embed.WithThumbnailUrl(av.ToString());
|
||||
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -142,7 +142,7 @@ public partial class Utility
|
||||
.WithTitle(GetText(strs.activity_page(page + 1)))
|
||||
.WithOkColor()
|
||||
.WithFooter(GetText(strs.activity_users_total(CmdHandler.UserMessagesSent.Count)))
|
||||
.WithDescription(str.ToString())).ConfigureAwait(false);
|
||||
.WithDescription(str.ToString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using NadekoBot.Modules.Utility.Services;
|
||||
|
||||
namespace NadekoBot.Modules.Utility;
|
||||
@@ -20,9 +20,9 @@ public partial class Utility
|
||||
return;
|
||||
|
||||
var ch = (ITextChannel)ctx.Channel;
|
||||
var invite = await ch.CreateInviteAsync(opts.Expire, opts.MaxUses, isTemporary: opts.Temporary, isUnique: opts.Unique).ConfigureAwait(false);
|
||||
var invite = await ch.CreateInviteAsync(opts.Expire, opts.MaxUses, isTemporary: opts.Temporary, isUnique: opts.Unique);
|
||||
|
||||
await SendConfirmAsync($"{ctx.User.Mention} https://discord.gg/{invite.Code}").ConfigureAwait(false);
|
||||
await SendConfirmAsync($"{ctx.User.Mention} https://discord.gg/{invite.Code}");
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -35,7 +35,7 @@ public partial class Utility
|
||||
return;
|
||||
var channel = ch ?? (ITextChannel)ctx.Channel;
|
||||
|
||||
var invites = await channel.GetInvitesAsync().ConfigureAwait(false);
|
||||
var invites = await channel.GetInvitesAsync();
|
||||
|
||||
await ctx.SendPaginatedConfirmAsync(page, cur =>
|
||||
{
|
||||
@@ -71,7 +71,7 @@ public partial class Utility
|
||||
|
||||
return embed;
|
||||
|
||||
}, invites.Count, 9).ConfigureAwait(false);
|
||||
}, invites.Count, 9);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -85,12 +85,12 @@ public partial class Utility
|
||||
|
||||
var ch = (ITextChannel)ctx.Channel;
|
||||
|
||||
var invites = await ch.GetInvitesAsync().ConfigureAwait(false);
|
||||
var invites = await ch.GetInvitesAsync();
|
||||
|
||||
if (invites.Count <= index)
|
||||
return;
|
||||
var inv = invites.ElementAt(index);
|
||||
await inv.DeleteAsync().ConfigureAwait(false);
|
||||
await inv.DeleteAsync();
|
||||
|
||||
await ReplyAsync(GetText(strs.invite_deleted(Format.Bold(inv.Code))));
|
||||
}
|
||||
|
@@ -43,10 +43,9 @@ public partial class Utility
|
||||
|
||||
if (quotes.Any())
|
||||
await SendConfirmAsync(GetText(strs.quotes_page(page + 1)),
|
||||
string.Join("\n", quotes.Select(q => $"`#{q.Id}` {Format.Bold(q.Keyword.SanitizeAllMentions()),-20} by {q.AuthorName.SanitizeAllMentions()}")))
|
||||
.ConfigureAwait(false);
|
||||
string.Join("\n", quotes.Select(q => $"`#{q.Id}` {Format.Bold(q.Keyword.SanitizeAllMentions()),-20} by {q.AuthorName.SanitizeAllMentions()}")));
|
||||
else
|
||||
await ReplyErrorLocalizedAsync(strs.quotes_page_none).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.quotes_page_none);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -110,7 +109,7 @@ public partial class Utility
|
||||
.AddField(GetText(strs.trigger), data.Keyword)
|
||||
.AddField(GetText(strs.response), Format.Sanitize(data.Text).Replace("](", "]\\("))
|
||||
.WithFooter(GetText(strs.created_by($"{data.AuthorName} ({data.AuthorId})")))
|
||||
).ConfigureAwait(false);
|
||||
);
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
@@ -131,7 +130,7 @@ public partial class Utility
|
||||
return;
|
||||
|
||||
await ctx.Channel.SendMessageAsync($"`#{keywordquote.Id}` 💬 " + keyword.ToLowerInvariant() + ": " +
|
||||
keywordquote.Text.SanitizeAllMentions()).ConfigureAwait(false);
|
||||
keywordquote.Text.SanitizeAllMentions());
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -154,7 +153,7 @@ public partial class Utility
|
||||
|
||||
if (quote is null || quote.GuildId != ctx.Guild.Id)
|
||||
{
|
||||
await SendErrorAsync(GetText(strs.quotes_notfound)).ConfigureAwait(false);
|
||||
await SendErrorAsync(GetText(strs.quotes_notfound));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -188,7 +187,7 @@ public partial class Utility
|
||||
});
|
||||
await uow.SaveChangesAsync();
|
||||
}
|
||||
await ReplyConfirmLocalizedAsync(strs.quote_added_new(Format.Code(q.Id.ToString()))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.quote_added_new(Format.Code(q.Id.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -216,9 +215,9 @@ public partial class Utility
|
||||
}
|
||||
}
|
||||
if (success)
|
||||
await SendConfirmAsync(response).ConfigureAwait(false);
|
||||
await SendConfirmAsync(response);
|
||||
else
|
||||
await SendErrorAsync(response).ConfigureAwait(false);
|
||||
await SendErrorAsync(response);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -238,7 +237,7 @@ public partial class Utility
|
||||
await uow.SaveChangesAsync();
|
||||
}
|
||||
|
||||
await ReplyConfirmLocalizedAsync(strs.quotes_deleted(Format.Bold(keyword.SanitizeAllMentions()))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.quotes_deleted(Format.Bold(keyword.SanitizeAllMentions())));
|
||||
}
|
||||
|
||||
public class ExportedQuote
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using Humanizer.Localisation;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using NadekoBot.Db;
|
||||
@@ -39,10 +39,9 @@ public partial class Utility
|
||||
|
||||
ulong target;
|
||||
target = meorhere == MeOrHere.Me ? ctx.User.Id : ctx.Channel.Id;
|
||||
if (!await RemindInternal(target, meorhere == MeOrHere.Me || ctx.Guild is null, remindData.Time, remindData.What)
|
||||
.ConfigureAwait(false))
|
||||
if (!await RemindInternal(target, meorhere == MeOrHere.Me || ctx.Guild is null, remindData.Time, remindData.What))
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.remind_too_long).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.remind_too_long);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +54,7 @@ public partial class Utility
|
||||
var perms = ((IGuildUser) ctx.User).GetPermissions(channel);
|
||||
if (!perms.SendMessages || !perms.ViewChannel)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.cant_read_or_send).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.cant_read_or_send);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -66,10 +65,9 @@ public partial class Utility
|
||||
}
|
||||
|
||||
|
||||
if (!await RemindInternal(channel.Id, false, remindData.Time, remindData.What)
|
||||
.ConfigureAwait(false))
|
||||
if (!await RemindInternal(channel.Id, false, remindData.Time, remindData.What))
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.remind_too_long).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.remind_too_long);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +138,7 @@ public partial class Utility
|
||||
}
|
||||
|
||||
embed.AddPaginatedFooter(page + 1, null);
|
||||
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -182,7 +180,7 @@ public partial class Utility
|
||||
|
||||
if (rem is null)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.reminder_not_exist).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.reminder_not_exist);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -232,7 +230,7 @@ public partial class Utility
|
||||
Format.Bold(!isPrivate ? $"<#{targetId}>" : ctx.User.Username),
|
||||
Format.Bold(message),
|
||||
ts.Humanize(3, minUnit: TimeUnit.Second, culture: Culture),
|
||||
gTime, gTime))).ConfigureAwait(false);
|
||||
gTime, gTime)));
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@@ -20,7 +20,7 @@ public partial class Utility
|
||||
var success = await _service.TriggerExternal(ctx.Guild.Id, index);
|
||||
if (!success)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.repeat_invoke_none).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.repeat_invoke_none);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public partial class Utility
|
||||
var removed = await _service.RemoveByIndexAsync(ctx.Guild.Id, index);
|
||||
if (removed is null)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.repeater_remove_fail).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.repeater_remove_fail);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public partial class Utility
|
||||
|
||||
if (result is null)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.index_out_of_range).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.index_out_of_range);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ public partial class Utility
|
||||
var repeaters = _service.GetRepeaters(ctx.Guild.Id);
|
||||
if (repeaters.Count == 0)
|
||||
{
|
||||
await ReplyConfirmLocalizedAsync(strs.repeaters_none).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.repeaters_none);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ public partial class Utility
|
||||
);
|
||||
}
|
||||
|
||||
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
private string GetRepeaterInfoString(RunningRepeater runner)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using NadekoBot.Common.ModuleBehaviors;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
@@ -75,14 +75,14 @@ public class CommandMapService : IInputTransformer, INService
|
||||
|
||||
try
|
||||
{
|
||||
var toDelete = await channel.SendConfirmAsync(_eb, $"{input} => {newInput}").ConfigureAwait(false);
|
||||
var toDelete = await channel.SendConfirmAsync(_eb, $"{input} => {newInput}");
|
||||
var _ = Task.Run(async () =>
|
||||
{
|
||||
await Task.Delay(1500).ConfigureAwait(false);
|
||||
await Task.Delay(1500);
|
||||
await toDelete.DeleteAsync(new()
|
||||
{
|
||||
RetryMode = RetryMode.AlwaysRetry
|
||||
}).ConfigureAwait(false);
|
||||
});
|
||||
});
|
||||
}
|
||||
catch { }
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using NadekoBot.Modules.Utility.Common;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
@@ -27,7 +27,7 @@ public class ConverterService : INService
|
||||
|
||||
if (client.ShardId == 0)
|
||||
{
|
||||
_currencyUpdater = new(async shouldLoad => await UpdateCurrency((bool)shouldLoad).ConfigureAwait(false),
|
||||
_currencyUpdater = new(async shouldLoad => await UpdateCurrency((bool)shouldLoad),
|
||||
client.ShardId == 0,
|
||||
TimeSpan.Zero,
|
||||
_updateInterval);
|
||||
@@ -37,7 +37,7 @@ public class ConverterService : INService
|
||||
private async Task<Rates> GetCurrencyRates()
|
||||
{
|
||||
using var http = _httpFactory.CreateClient();
|
||||
var res = await http.GetStringAsync("https://convertapi.nadeko.bot/latest").ConfigureAwait(false);
|
||||
var res = await http.GetStringAsync("https://convertapi.nadeko.bot/latest");
|
||||
return JsonConvert.DeserializeObject<Rates>(res);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class ConverterService : INService
|
||||
var unitTypeString = "currency";
|
||||
if (shouldLoad)
|
||||
{
|
||||
var currencyRates = await GetCurrencyRates().ConfigureAwait(false);
|
||||
var currencyRates = await GetCurrencyRates();
|
||||
var baseType = new ConvertUnit()
|
||||
{
|
||||
Triggers = new[] { currencyRates.Base },
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using NadekoBot.Modules.Utility.Common.Patreon;
|
||||
using System.Net.Http.Json;
|
||||
@@ -49,7 +49,7 @@ public class PatreonRewardsService : INService
|
||||
_client = client;
|
||||
|
||||
if (client.ShardId == 0)
|
||||
_updater = new(async _ => await RefreshPledges(_credsProvider.GetCreds()).ConfigureAwait(false),
|
||||
_updater = new(async _ => await RefreshPledges(_credsProvider.GetCreds()),
|
||||
null, TimeSpan.Zero, Interval);
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ public class PatreonRewardsService : INService
|
||||
}
|
||||
|
||||
LastUpdate = DateTime.UtcNow;
|
||||
await getPledgesLocker.WaitAsync().ConfigureAwait(false);
|
||||
await getPledgesLocker.WaitAsync();
|
||||
try
|
||||
{
|
||||
|
||||
@@ -170,7 +170,7 @@ public class PatreonRewardsService : INService
|
||||
PatreonResponse data = null;
|
||||
do
|
||||
{
|
||||
var res = await http.GetStringAsync(page).ConfigureAwait(false);
|
||||
var res = await http.GetStringAsync(page);
|
||||
data = JsonSerializer.Deserialize<PatreonResponse>(res);
|
||||
|
||||
if (data is null)
|
||||
@@ -218,7 +218,7 @@ public class PatreonRewardsService : INService
|
||||
|
||||
public async Task<int> ClaimReward(ulong userId, string patreonUserId, int cents)
|
||||
{
|
||||
await claimLockJustInCase.WaitAsync().ConfigureAwait(false);
|
||||
await claimLockJustInCase.WaitAsync();
|
||||
var settings = _gamblingConfigService.Data;
|
||||
var now = DateTime.UtcNow;
|
||||
try
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using System.Text.RegularExpressions;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@@ -42,7 +42,7 @@ public class RemindService : INService
|
||||
foreach (var group in reminders.Chunk(5))
|
||||
{
|
||||
var executedReminders = group.ToList();
|
||||
await Task.WhenAll(executedReminders.Select(ReminderTimerAction));
|
||||
await executedReminders.Select(ReminderTimerAction).WhenAll();
|
||||
await RemoveReminders(executedReminders);
|
||||
await Task.Delay(1500);
|
||||
}
|
||||
@@ -161,8 +161,8 @@ public class RemindService : INService
|
||||
.WithOkColor()
|
||||
.WithTitle("Reminder")
|
||||
.AddField("Created At", r.DateAdded.HasValue ? r.DateAdded.Value.ToLongDateString() : "?")
|
||||
.AddField("By", (await ch.GetUserAsync(r.UserId).ConfigureAwait(false))?.ToString() ?? r.UserId.ToString()),
|
||||
msg: r.Message).ConfigureAwait(false);
|
||||
.AddField("By", (await ch.GetUserAsync(r.UserId))?.ToString() ?? r.UserId.ToString()),
|
||||
msg: r.Message);
|
||||
}
|
||||
catch (Exception ex) { Log.Information(ex.Message + $"({r.Id})"); }
|
||||
}
|
||||
|
@@ -90,7 +90,7 @@ where ((guildid >> 22) % {_creds.TotalShards}) == {_client.ShardId};")
|
||||
// execute
|
||||
foreach (var chunk in toExecute.Chunk(5))
|
||||
{
|
||||
await Task.WhenAll(chunk.Select(Trigger));
|
||||
await chunk.Select(Trigger).WhenAll();
|
||||
}
|
||||
|
||||
// reinsert
|
||||
@@ -245,7 +245,7 @@ where ((guildid >> 22) % {_creds.TotalShards}) == {_client.ShardId};")
|
||||
var oldMsg = await channel.GetMessageAsync(lastMessageId);
|
||||
if (oldMsg != null)
|
||||
{
|
||||
await oldMsg.DeleteAsync().ConfigureAwait(false);
|
||||
await oldMsg.DeleteAsync();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using NadekoBot.Common.TypeReaders;
|
||||
using NadekoBot.Modules.Utility.Common;
|
||||
@@ -29,7 +29,7 @@ public class StreamRoleService : INService
|
||||
{
|
||||
try
|
||||
{
|
||||
await Task.WhenAll(client.Guilds.Select(g => RescanUsers(g))).ConfigureAwait(false);
|
||||
await client.Guilds.Select(g => RescanUsers(g)).WhenAll();
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -45,7 +45,7 @@ public class StreamRoleService : INService
|
||||
//if user wasn't streaming or didn't have a game status at all
|
||||
if (guildSettings.TryGetValue(after.Guild.Id, out var setting))
|
||||
{
|
||||
await RescanUser(after, setting).ConfigureAwait(false);
|
||||
await RescanUser(after, setting);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -114,7 +114,7 @@ public class StreamRoleService : INService
|
||||
}
|
||||
if (success)
|
||||
{
|
||||
await RescanUsers(guild).ConfigureAwait(false);
|
||||
await RescanUsers(guild);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
@@ -138,7 +138,7 @@ public class StreamRoleService : INService
|
||||
uow.SaveChanges();
|
||||
}
|
||||
|
||||
await RescanUsers(guild).ConfigureAwait(false);
|
||||
await RescanUsers(guild);
|
||||
return keyword;
|
||||
}
|
||||
|
||||
@@ -189,10 +189,10 @@ public class StreamRoleService : INService
|
||||
|
||||
UpdateCache(fromRole.Guild.Id, setting);
|
||||
|
||||
foreach (var usr in await fromRole.GetMembersAsync().ConfigureAwait(false))
|
||||
foreach (var usr in await fromRole.GetMembersAsync())
|
||||
{
|
||||
if (usr is { } x)
|
||||
await RescanUser(x, setting, addRole).ConfigureAwait(false);
|
||||
await RescanUser(x, setting, addRole);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ public class StreamRoleService : INService
|
||||
}
|
||||
|
||||
if (guildSettings.TryRemove(guild.Id, out var setting) && cleanup)
|
||||
await RescanUsers(guild).ConfigureAwait(false);
|
||||
await RescanUsers(guild);
|
||||
}
|
||||
|
||||
private async Task RescanUser(IGuildUser user, StreamRoleSettings setting, IRole addRole = null)
|
||||
@@ -236,7 +236,7 @@ public class StreamRoleService : INService
|
||||
addRole ??= user.Guild.GetRole(setting.AddRoleId);
|
||||
if (addRole is null)
|
||||
{
|
||||
await StopStreamRole(user.Guild).ConfigureAwait(false);
|
||||
await StopStreamRole(user.Guild);
|
||||
Log.Warning("Stream role in server {0} no longer exists. Stopping.", setting.AddRoleId);
|
||||
return;
|
||||
}
|
||||
@@ -244,14 +244,14 @@ public class StreamRoleService : INService
|
||||
//check if he doesn't have addrole already, to avoid errors
|
||||
if (!user.RoleIds.Contains(addRole.Id))
|
||||
{
|
||||
await user.AddRoleAsync(addRole).ConfigureAwait(false);
|
||||
await user.AddRoleAsync(addRole);
|
||||
Log.Information("Added stream role to user {0} in {1} server", user.ToString(),
|
||||
user.Guild.ToString());
|
||||
}
|
||||
}
|
||||
catch (HttpException ex) when (ex.HttpCode == System.Net.HttpStatusCode.Forbidden)
|
||||
{
|
||||
await StopStreamRole(user.Guild).ConfigureAwait(false);
|
||||
await StopStreamRole(user.Guild);
|
||||
Log.Warning(ex, "Error adding stream role(s). Forcibly disabling stream role feature");
|
||||
throw new StreamRolePermissionException();
|
||||
}
|
||||
@@ -271,12 +271,12 @@ public class StreamRoleService : INService
|
||||
if (addRole is null)
|
||||
throw new StreamRoleNotFoundException();
|
||||
|
||||
await user.RemoveRoleAsync(addRole).ConfigureAwait(false);
|
||||
await user.RemoveRoleAsync(addRole);
|
||||
Log.Information("Removed stream role from the user {0} in {1} server", user.ToString(), user.Guild.ToString());
|
||||
}
|
||||
catch (HttpException ex) when (ex.HttpCode == System.Net.HttpStatusCode.Forbidden)
|
||||
{
|
||||
await StopStreamRole(user.Guild).ConfigureAwait(false);
|
||||
await StopStreamRole(user.Guild);
|
||||
Log.Warning(ex, "Error removing stream role(s). Forcibly disabling stream role feature");
|
||||
throw new StreamRolePermissionException();
|
||||
}
|
||||
@@ -295,11 +295,11 @@ public class StreamRoleService : INService
|
||||
|
||||
if (setting.Enabled)
|
||||
{
|
||||
var users = await guild.GetUsersAsync(CacheMode.CacheOnly).ConfigureAwait(false);
|
||||
var users = await guild.GetUsersAsync(CacheMode.CacheOnly);
|
||||
foreach (var usr in users.Where(x => x.RoleIds.Contains(setting.FromRoleId) || x.RoleIds.Contains(addRole.Id)))
|
||||
{
|
||||
if (usr is { } x)
|
||||
await RescanUser(x, setting, addRole).ConfigureAwait(false);
|
||||
await RescanUser(x, setting, addRole);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using NadekoBot.Modules.Help.Services;
|
||||
using NadekoBot.Db;
|
||||
|
||||
@@ -37,7 +37,7 @@ public class VerboseErrorsService : INService
|
||||
.WithDescription(reason)
|
||||
.WithErrorColor();
|
||||
|
||||
await channel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
await channel.EmbedAsync(embed);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using NadekoBot.Modules.Utility.Services;
|
||||
using NadekoBot.Common.TypeReaders;
|
||||
using NadekoBot.Modules.Utility.Common;
|
||||
@@ -15,9 +15,9 @@ public partial class Utility
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task StreamRole(IRole fromRole, IRole addRole)
|
||||
{
|
||||
await this._service.SetStreamRole(fromRole, addRole).ConfigureAwait(false);
|
||||
await this._service.SetStreamRole(fromRole, addRole);
|
||||
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_role_enabled(Format.Bold(fromRole.ToString()), Format.Bold(addRole.ToString()))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_role_enabled(Format.Bold(fromRole.ToString()), Format.Bold(addRole.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -26,8 +26,8 @@ public partial class Utility
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task StreamRole()
|
||||
{
|
||||
await this._service.StopStreamRole(ctx.Guild).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_role_disabled).ConfigureAwait(false);
|
||||
await this._service.StopStreamRole(ctx.Guild);
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_role_disabled);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -36,12 +36,12 @@ public partial class Utility
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task StreamRoleKeyword([Leftover]string keyword = null)
|
||||
{
|
||||
var kw = await this._service.SetKeyword(ctx.Guild, keyword).ConfigureAwait(false);
|
||||
var kw = await this._service.SetKeyword(ctx.Guild, keyword);
|
||||
|
||||
if(string.IsNullOrWhiteSpace(keyword))
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_role_kw_reset).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_role_kw_reset);
|
||||
else
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_role_kw_set(Format.Bold(kw))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_role_kw_set(Format.Bold(kw)));
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -50,19 +50,18 @@ public partial class Utility
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task StreamRoleBlacklist(AddRemove action, [Leftover] IGuildUser user)
|
||||
{
|
||||
var success = await this._service.ApplyListAction(StreamRoleListType.Blacklist, ctx.Guild, action, user.Id, user.ToString())
|
||||
.ConfigureAwait(false);
|
||||
var success = await this._service.ApplyListAction(StreamRoleListType.Blacklist, ctx.Guild, action, user.Id, user.ToString());
|
||||
|
||||
if(action == AddRemove.Add)
|
||||
if(success)
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_role_bl_add(Format.Bold(user.ToString()))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_role_bl_add(Format.Bold(user.ToString())));
|
||||
else
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_role_bl_add_fail(Format.Bold(user.ToString()))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_role_bl_add_fail(Format.Bold(user.ToString())));
|
||||
else
|
||||
if (success)
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_role_bl_rem(Format.Bold(user.ToString()))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_role_bl_rem(Format.Bold(user.ToString())));
|
||||
else
|
||||
await ReplyErrorLocalizedAsync(strs.stream_role_bl_rem_fail(Format.Bold(user.ToString()))).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.stream_role_bl_rem_fail(Format.Bold(user.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -71,19 +70,18 @@ public partial class Utility
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task StreamRoleWhitelist(AddRemove action, [Leftover] IGuildUser user)
|
||||
{
|
||||
var success = await this._service.ApplyListAction(StreamRoleListType.Whitelist, ctx.Guild, action, user.Id, user.ToString())
|
||||
.ConfigureAwait(false);
|
||||
var success = await this._service.ApplyListAction(StreamRoleListType.Whitelist, ctx.Guild, action, user.Id, user.ToString());
|
||||
|
||||
if (action == AddRemove.Add)
|
||||
if(success)
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_role_wl_add(Format.Bold(user.ToString()))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_role_wl_add(Format.Bold(user.ToString())));
|
||||
else
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_role_wl_add_fail(Format.Bold(user.ToString()))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_role_wl_add_fail(Format.Bold(user.ToString())));
|
||||
else
|
||||
if (success)
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_role_wl_rem(Format.Bold(user.ToString()))).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_role_wl_rem(Format.Bold(user.ToString())));
|
||||
else
|
||||
await ReplyErrorLocalizedAsync(strs.stream_role_wl_rem_fail(Format.Bold(user.ToString()))).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.stream_role_wl_rem_fail(Format.Bold(user.ToString())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using NadekoBot.Modules.Utility.Services;
|
||||
|
||||
namespace NadekoBot.Modules.Utility;
|
||||
@@ -24,7 +24,7 @@ public partial class Utility
|
||||
String.Join(", ", g.Select(x => x.Triggers.FirstOrDefault()).OrderBy(x => x)));
|
||||
}
|
||||
|
||||
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -35,12 +35,12 @@ public partial class Utility
|
||||
var targetUnit = _service.Units.FirstOrDefault(x => x.Triggers.Select(y => y.ToUpperInvariant()).Contains(target.ToUpperInvariant()));
|
||||
if (originUnit is null || targetUnit is null)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.convert_not_found(Format.Bold(origin), Format.Bold(target))).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.convert_not_found(Format.Bold(origin), Format.Bold(target)));
|
||||
return;
|
||||
}
|
||||
if (originUnit.UnitType != targetUnit.UnitType)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.convert_type_error(Format.Bold(originUnit.Triggers.First()), Format.Bold(targetUnit.Triggers.First()))).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.convert_type_error(Format.Bold(originUnit.Triggers.First()), Format.Bold(targetUnit.Triggers.First())));
|
||||
return;
|
||||
}
|
||||
decimal res;
|
||||
|
@@ -70,16 +70,15 @@ public partial class Utility : NadekoModule
|
||||
.Select(u => u.Username)
|
||||
.OrderBy(x => rng.Next())
|
||||
.Take(60)
|
||||
.ToArray()).ConfigureAwait(false);
|
||||
.ToArray());
|
||||
|
||||
var i = 0;
|
||||
if (arr.Length == 0)
|
||||
await ReplyErrorLocalizedAsync(strs.nobody_playing_game).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.nobody_playing_game);
|
||||
else
|
||||
{
|
||||
await SendConfirmAsync("```css\n" + string.Join("\n", arr.GroupBy(item => i++ / 2)
|
||||
.Select(ig => string.Concat(ig.Select(el => $"• {el,-27}")))) + "\n```")
|
||||
.ConfigureAwait(false);
|
||||
.Select(ig => string.Concat(ig.Select(el => $"• {el,-27}")))) + "\n```");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,8 +90,8 @@ public partial class Utility : NadekoModule
|
||||
if (--page < 0)
|
||||
return;
|
||||
|
||||
await ctx.Channel.TriggerTypingAsync().ConfigureAwait(false);
|
||||
await _tracker.EnsureUsersDownloadedAsync(ctx.Guild).ConfigureAwait(false);
|
||||
await ctx.Channel.TriggerTypingAsync();
|
||||
await _tracker.EnsureUsersDownloadedAsync(ctx.Guild);
|
||||
|
||||
var users = await ctx.Guild.GetUsersAsync(
|
||||
#if GLOBAL_NADEKO
|
||||
@@ -116,7 +115,7 @@ public partial class Utility : NadekoModule
|
||||
return _eb.Create().WithOkColor()
|
||||
.WithTitle(GetText(strs.inrole_list(Format.Bold(role?.Name ?? "No Role"), roleUsers.Length)))
|
||||
.WithDescription(string.Join("\n", pageUsers));
|
||||
}, roleUsers.Length, 20).ConfigureAwait(false);
|
||||
}, roleUsers.Length, 20);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -140,7 +139,7 @@ public partial class Utility : NadekoModule
|
||||
{
|
||||
builder.AppendLine($"{p.Name} : {p.GetValue(perms, null)}");
|
||||
}
|
||||
await SendConfirmAsync(builder.ToString()).ConfigureAwait(false);
|
||||
await SendConfirmAsync(builder.ToString());
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -183,13 +182,13 @@ public partial class Utility : NadekoModule
|
||||
var roles = target.GetRoles().Except(new[] { guild.EveryoneRole }).OrderBy(r => -r.Position).Skip((page - 1) * rolesPerPage).Take(rolesPerPage).ToArray();
|
||||
if (!roles.Any())
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.no_roles_on_page).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.no_roles_on_page);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
await SendConfirmAsync(GetText(strs.roles_page(page, Format.Bold(target.ToString()))),
|
||||
"\n• " + string.Join("\n• ", (IEnumerable<IRole>)roles).SanitizeMentions(true)).ConfigureAwait(false);
|
||||
"\n• " + string.Join("\n• ", (IEnumerable<IRole>)roles).SanitizeMentions(true));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -197,12 +196,12 @@ public partial class Utility : NadekoModule
|
||||
var roles = guild.Roles.Except(new[] { guild.EveryoneRole }).OrderBy(r => -r.Position).Skip((page - 1) * rolesPerPage).Take(rolesPerPage).ToArray();
|
||||
if (!roles.Any())
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.no_roles_on_page).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.no_roles_on_page);
|
||||
}
|
||||
else
|
||||
{
|
||||
await SendConfirmAsync(GetText(strs.roles_all_page(page)),
|
||||
"\n• " + string.Join("\n• ", (IEnumerable<IRole>)roles).SanitizeMentions(true)).ConfigureAwait(false);
|
||||
"\n• " + string.Join("\n• ", (IEnumerable<IRole>)roles).SanitizeMentions(true));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -221,9 +220,9 @@ public partial class Utility : NadekoModule
|
||||
|
||||
var topic = channel.Topic;
|
||||
if (string.IsNullOrWhiteSpace(topic))
|
||||
await ReplyErrorLocalizedAsync(strs.no_topic_set).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.no_topic_set);
|
||||
else
|
||||
await SendConfirmAsync(GetText(strs.channel_topic), topic).ConfigureAwait(false);
|
||||
await SendConfirmAsync(GetText(strs.channel_topic), topic);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -252,8 +251,7 @@ public partial class Utility : NadekoModule
|
||||
_coord.GetGuildCount(),
|
||||
_stats.TextChannels,
|
||||
_stats.VoiceChannels)),
|
||||
true))
|
||||
.ConfigureAwait(false);
|
||||
true));
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -264,9 +262,9 @@ public partial class Utility : NadekoModule
|
||||
var result = string.Join("\n", tags.Select(m => GetText(strs.showemojis(m, m.Url))));
|
||||
|
||||
if (string.IsNullOrWhiteSpace(result))
|
||||
await ReplyErrorLocalizedAsync(strs.showemojis_none).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.showemojis_none);
|
||||
else
|
||||
await ctx.Channel.SendMessageAsync(result.TrimTo(2000)).ConfigureAwait(false);
|
||||
await ctx.Channel.SendMessageAsync(result.TrimTo(2000));
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -332,11 +330,11 @@ public partial class Utility : NadekoModule
|
||||
if (page < 0)
|
||||
return;
|
||||
|
||||
var guilds = await Task.Run(() => _client.Guilds.OrderBy(g => g.Name).Skip(page * 15).Take(15)).ConfigureAwait(false);
|
||||
var guilds = await Task.Run(() => _client.Guilds.OrderBy(g => g.Name).Skip(page * 15).Take(15));
|
||||
|
||||
if (!guilds.Any())
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.listservers_none).ConfigureAwait(false);
|
||||
await ReplyErrorLocalizedAsync(strs.listservers_none);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -398,7 +396,7 @@ public partial class Utility : NadekoModule
|
||||
public async Task SaveChat(int cnt)
|
||||
{
|
||||
var msgs = new List<IMessage>(cnt);
|
||||
await ctx.Channel.GetMessagesAsync(cnt).ForEachAsync(dled => msgs.AddRange(dled)).ConfigureAwait(false);
|
||||
await ctx.Channel.GetMessagesAsync(cnt).ForEachAsync(dled => msgs.AddRange(dled));
|
||||
|
||||
var title = $"Chatlog-{ctx.Guild.Name}/#{ctx.Channel.Name}-{DateTime.Now}.txt";
|
||||
var grouping = msgs.GroupBy(x => $"{x.CreatedAt.Date:dd.MM.yyyy}")
|
||||
@@ -426,8 +424,8 @@ public partial class Utility : NadekoModule
|
||||
return msg;
|
||||
})
|
||||
});
|
||||
await using var stream = await JsonConvert.SerializeObject(grouping, Formatting.Indented).ToStream().ConfigureAwait(false);
|
||||
await ctx.User.SendFileAsync(stream, title, title, false).ConfigureAwait(false);
|
||||
await using var stream = await JsonConvert.SerializeObject(grouping, Formatting.Indented).ToStream();
|
||||
await ctx.User.SendFileAsync(stream, title, title, false);
|
||||
}
|
||||
private static SemaphoreSlim sem = new(1, 1);
|
||||
|
||||
@@ -437,15 +435,15 @@ public partial class Utility : NadekoModule
|
||||
#endif
|
||||
public async Task Ping()
|
||||
{
|
||||
await sem.WaitAsync(5000).ConfigureAwait(false);
|
||||
await sem.WaitAsync(5000);
|
||||
try
|
||||
{
|
||||
var sw = Stopwatch.StartNew();
|
||||
var msg = await ctx.Channel.SendMessageAsync("🏓").ConfigureAwait(false);
|
||||
var msg = await ctx.Channel.SendMessageAsync("🏓");
|
||||
sw.Stop();
|
||||
msg.DeleteAfter(0);
|
||||
|
||||
await SendConfirmAsync($"{Format.Bold(ctx.User.ToString())} 🏓 {(int)sw.Elapsed.TotalMilliseconds}ms").ConfigureAwait(false);
|
||||
await SendConfirmAsync($"{Format.Bold(ctx.User.ToString())} 🏓 {(int)sw.Elapsed.TotalMilliseconds}ms");
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using NadekoBot.Modules.Utility.Services;
|
||||
|
||||
namespace NadekoBot.Modules.Utility;
|
||||
@@ -16,9 +16,9 @@ public partial class Utility
|
||||
var state = _service.ToggleVerboseErrors(ctx.Guild.Id, newstate);
|
||||
|
||||
if (state)
|
||||
await ReplyConfirmLocalizedAsync(strs.verbose_errors_enabled).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.verbose_errors_enabled);
|
||||
else
|
||||
await ReplyConfirmLocalizedAsync(strs.verbose_errors_disabled).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.verbose_errors_disabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user