Fixed .fwtoall and .fwmsgs, ~ow level bugfix
This commit is contained in:
@@ -12,6 +12,9 @@ using Discord.WebSocket;
|
||||
using NadekoBot.Services;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Immutable;
|
||||
using NadekoBot.DataStructures;
|
||||
using NLog;
|
||||
|
||||
namespace NadekoBot.Modules.Administration
|
||||
{
|
||||
@@ -25,8 +28,11 @@ namespace NadekoBot.Modules.Administration
|
||||
|
||||
private static readonly object _locker = new object();
|
||||
|
||||
private new static readonly Logger _log;
|
||||
|
||||
static SelfCommands()
|
||||
{
|
||||
_log = LogManager.GetCurrentClassLogger();
|
||||
using (var uow = DbHandler.UnitOfWork())
|
||||
{
|
||||
var config = uow.BotConfig.GetOrCreate();
|
||||
@@ -36,7 +42,7 @@ namespace NadekoBot.Modules.Administration
|
||||
|
||||
var _ = Task.Run(async () =>
|
||||
{
|
||||
while(!NadekoBot.Ready)
|
||||
while (!NadekoBot.Ready)
|
||||
await Task.Delay(1000);
|
||||
|
||||
foreach (var cmd in NadekoBot.BotConfig.StartupCommands)
|
||||
@@ -128,7 +134,7 @@ namespace NadekoBot.Modules.Administration
|
||||
{Format.Code(GetText("channel"))}: {x.ChannelName}/{x.ChannelId}
|
||||
{Format.Code(GetText("command_text"))}: {x.CommandText}";
|
||||
return str;
|
||||
})),footer: GetText("page", page + 1))
|
||||
})), footer: GetText("page", page + 1))
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
@@ -138,7 +144,7 @@ namespace NadekoBot.Modules.Administration
|
||||
public async Task Wait(int miliseconds)
|
||||
{
|
||||
if (miliseconds <= 0)
|
||||
return;
|
||||
return;
|
||||
Context.Message.DeleteAfter(0);
|
||||
try
|
||||
{
|
||||
@@ -172,7 +178,7 @@ namespace NadekoBot.Modules.Administration
|
||||
}
|
||||
}
|
||||
|
||||
if(cmd == null)
|
||||
if (cmd == null)
|
||||
await ReplyErrorLocalized("scrm_fail").ConfigureAwait(false);
|
||||
else
|
||||
await ReplyConfirmLocalized("scrm").ConfigureAwait(false);
|
||||
@@ -230,9 +236,9 @@ namespace NadekoBot.Modules.Administration
|
||||
|
||||
}
|
||||
|
||||
public static async Task HandleDmForwarding(IUserMessage msg, List<IDMChannel> ownerChannels)
|
||||
public static async Task HandleDmForwarding(IUserMessage msg, ImmutableArray<AsyncLazy<IDMChannel>> ownerChannels)
|
||||
{
|
||||
if (_forwardDMs && ownerChannels.Any())
|
||||
if (_forwardDMs && ownerChannels.Length > 0)
|
||||
{
|
||||
var title = GetTextStatic("dm_from",
|
||||
NadekoBot.Localization.DefaultCultureInfo,
|
||||
@@ -253,26 +259,39 @@ namespace NadekoBot.Modules.Administration
|
||||
|
||||
if (_forwardDMsToAllOwners)
|
||||
{
|
||||
await Task.WhenAll(ownerChannels.Where(ch => ch.Recipient.Id != msg.Author.Id)
|
||||
.Select(ch => ch.SendConfirmAsync(title, toSend))).ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
var firstOwnerChannel = ownerChannels.First();
|
||||
if (firstOwnerChannel.Recipient.Id != msg.Author.Id)
|
||||
var allOwnerChannels = await Task.WhenAll(ownerChannels
|
||||
.Select(x => x.Value))
|
||||
.ConfigureAwait(false);
|
||||
|
||||
foreach (var ownerCh in allOwnerChannels.Where(ch => ch.Recipient.Id != msg.Author.Id))
|
||||
{
|
||||
try
|
||||
{
|
||||
await firstOwnerChannel.SendConfirmAsync(title, toSend).ConfigureAwait(false);
|
||||
await ownerCh.SendConfirmAsync(title, toSend).ConfigureAwait(false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
_log.Warn("Can't contact owner with id {0}", ownerCh.Recipient.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var firstOwnerChannel = await ownerChannels[0];
|
||||
if (firstOwnerChannel.Recipient.Id != msg.Author.Id)
|
||||
{
|
||||
try
|
||||
{
|
||||
await firstOwnerChannel.SendConfirmAsync(title, toSend).ConfigureAwait(false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
|
@@ -42,7 +42,7 @@ namespace NadekoBot.Modules.Searches
|
||||
.WithUrl($"https://www.overbuff.com/players/pc/{battletag}")
|
||||
.WithIconUrl("https://cdn.discordapp.com/attachments/155726317222887425/255653487512256512/YZ4w2ey.png"))
|
||||
.WithThumbnailUrl(qp.OverallStats.avatar)
|
||||
.AddField(fb => fb.WithName(GetText("level")).WithValue(qp.OverallStats.level.ToString()).WithIsInline(true))
|
||||
.AddField(fb => fb.WithName(GetText("level")).WithValue((qp.OverallStats.level + (qp.OverallStats.prestige * 100)).ToString()).WithIsInline(true))
|
||||
.AddField(fb => fb.WithName(GetText("quick_wins")).WithValue(qp.OverallStats.wins.ToString()).WithIsInline(true))
|
||||
.AddField(fb => fb.WithName(GetText("compet_rank")).WithValue("0").WithIsInline(true))
|
||||
.AddField(fb => fb.WithName(GetText("quick_playtime")).WithValue($"{qp.GameStats.timePlayed}hrs").WithIsInline(true))
|
||||
@@ -58,7 +58,7 @@ namespace NadekoBot.Modules.Searches
|
||||
.WithUrl($"https://www.overbuff.com/players/pc/{battletag}")
|
||||
.WithIconUrl(compet.OverallStats.rank_image))
|
||||
.WithThumbnailUrl(compet.OverallStats.avatar)
|
||||
.AddField(fb => fb.WithName(GetText("level")).WithValue((compet.OverallStats.level + (compet.OverallStats.prestige * 100)).ToString()).WithIsInline(true))
|
||||
.AddField(fb => fb.WithName(GetText("level")).WithValue((qp.OverallStats.level + (qp.OverallStats.prestige * 100)).ToString()).WithIsInline(true))
|
||||
.AddField(fb => fb.WithName(GetText("quick_wins")).WithValue(qp.OverallStats.wins.ToString()).WithIsInline(true))
|
||||
.AddField(fb => fb.WithName(GetText("compet_wins")).WithValue(compet.OverallStats.wins.ToString()).WithIsInline(true))
|
||||
.AddField(fb => fb.WithName(GetText("compet_loses")).WithValue(compet.OverallStats.losses.ToString()).WithIsInline(true))
|
||||
|
Reference in New Issue
Block a user