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