Fixes to remind and shardstats
This commit is contained in:
parent
2cad7f4475
commit
0aa65b2953
@ -33,7 +33,7 @@ namespace NadekoBot.Modules.Utility
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(1)]
|
||||
[Priority(0)]
|
||||
public async Task Remind(MeOrHere meorhere, string timeStr, [Remainder] string message)
|
||||
{
|
||||
ulong target;
|
||||
@ -44,7 +44,7 @@ namespace NadekoBot.Modules.Utility
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[RequireUserPermission(GuildPermission.ManageMessages)]
|
||||
[Priority(0)]
|
||||
[Priority(1)]
|
||||
public async Task Remind(ITextChannel channel, string timeStr, [Remainder] string message)
|
||||
{
|
||||
var perms = ((IGuildUser)Context.User).GetPermissions((ITextChannel)channel);
|
||||
|
@ -363,11 +363,14 @@ namespace NadekoBot
|
||||
public async Task RunAndBlockAsync(params string[] args)
|
||||
{
|
||||
await RunAsync(args).ConfigureAwait(false);
|
||||
StartSendingData();
|
||||
if (ShardCoord != null)
|
||||
await ShardCoord.RunAndBlockAsync();
|
||||
else
|
||||
{
|
||||
await Task.Delay(-1).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void TerribleElevatedPermissionCheck()
|
||||
{
|
||||
|
@ -72,39 +72,39 @@ namespace NadekoBot.Services.Administration
|
||||
});
|
||||
}
|
||||
|
||||
private void LoadOwnerChannels()
|
||||
{
|
||||
var hs = new HashSet<ulong>(_creds.OwnerIds);
|
||||
var channels = new Dictionary<ulong, AsyncLazy<IDMChannel>>();
|
||||
//private void LoadOwnerChannels()
|
||||
//{
|
||||
// var hs = new HashSet<ulong>(_creds.OwnerIds);
|
||||
// var channels = new Dictionary<ulong, AsyncLazy<IDMChannel>>();
|
||||
|
||||
if (hs.Count > 0)
|
||||
{
|
||||
foreach (var g in _client.Guilds)
|
||||
{
|
||||
if (hs.Count == 0)
|
||||
break;
|
||||
// if (hs.Count > 0)
|
||||
// {
|
||||
// foreach (var g in _client.Guilds)
|
||||
// {
|
||||
// if (hs.Count == 0)
|
||||
// break;
|
||||
|
||||
foreach (var u in g.Users)
|
||||
{
|
||||
if (hs.Remove(u.Id))
|
||||
{
|
||||
channels.Add(u.Id, new AsyncLazy<IDMChannel>(async () => await u.CreateDMChannelAsync()));
|
||||
if (hs.Count == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// foreach (var u in g.Users)
|
||||
// {
|
||||
// if (hs.Remove(u.Id))
|
||||
// {
|
||||
// channels.Add(u.Id, new AsyncLazy<IDMChannel>(async () => await u.CreateDMChannelAsync()));
|
||||
// if (hs.Count == 0)
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
ownerChannels = channels.OrderBy(x => _creds.OwnerIds.IndexOf(x.Key))
|
||||
.Select(x => x.Value)
|
||||
.ToImmutableArray();
|
||||
// ownerChannels = channels.OrderBy(x => _creds.OwnerIds.IndexOf(x.Key))
|
||||
// .Select(x => x.Value)
|
||||
// .ToImmutableArray();
|
||||
|
||||
if (!ownerChannels.Any())
|
||||
_log.Warn("No owner channels created! Make sure you've specified correct OwnerId in the credentials.json file.");
|
||||
else
|
||||
_log.Info($"Created {ownerChannels.Length} out of {_creds.OwnerIds.Length} owner message channels.");
|
||||
}
|
||||
// if (!ownerChannels.Any())
|
||||
// _log.Warn("No owner channels created! Make sure you've specified correct OwnerId in the credentials.json file.");
|
||||
// else
|
||||
// _log.Info($"Created {ownerChannels.Length} out of {_creds.OwnerIds.Length} owner message channels.");
|
||||
//}
|
||||
|
||||
// forwards dms
|
||||
public async Task LateExecute(DiscordSocketClient client, IGuild guild, IUserMessage msg)
|
||||
|
@ -78,7 +78,10 @@ namespace NadekoBot
|
||||
.Where(x => x != null)
|
||||
.GroupBy(x => x.ConnectionState)
|
||||
.Select(x => x.Count() + " " + x.Key));
|
||||
_log.Info(string.Join("\n", Statuses.Select(x => $"Shard {x.ShardId} is in {x.ConnectionState.ToString()} state with {x.Guilds} servers")) + "\n" + groupStr);
|
||||
_log.Info(string.Join("\n", Statuses
|
||||
.ToArray()
|
||||
.Where(x => x != null)
|
||||
.Select(x => $"Shard {x.ShardId} is in {x.ConnectionState.ToString()} state with {x.Guilds} servers")) + "\n" + groupStr);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user