added .cleanv+t, upgraded discord.net to 0.93

This commit is contained in:
Master Kwoth 2016-05-24 23:58:13 +02:00
parent a52108d32d
commit f56cddb86a
4 changed files with 19 additions and 3 deletions

View File

@ -986,7 +986,7 @@ namespace NadekoBot.Modules.Administration
if (string.IsNullOrWhiteSpace(game)) if (string.IsNullOrWhiteSpace(game))
return; return;
var en = e.Server.Users var en = e.Server.Users
.Where(u => u.CurrentGame?.ToUpperInvariant() == game) .Where(u => u.CurrentGame?.Name.ToUpperInvariant() == game)
.Select(u => $"{u.Name}"); .Select(u => $"{u.Name}");
var arr = en as string[] ?? en.ToArray(); var arr = en as string[] ?? en.ToArray();

View File

@ -86,7 +86,7 @@ namespace NadekoBot.Modules.Administration.Commands
if (!string.IsNullOrWhiteSpace(user.Nickname)) if (!string.IsNullOrWhiteSpace(user.Nickname))
sb.AppendLine($"`Nickname:` **{user.Nickname}**"); sb.AppendLine($"`Nickname:` **{user.Nickname}**");
sb.AppendLine($"`Id:` **{user.Id}**"); sb.AppendLine($"`Id:` **{user.Id}**");
sb.AppendLine($"`Current Game:` **{(string.IsNullOrWhiteSpace(user.CurrentGame) ? "-" : user.CurrentGame)}**"); sb.AppendLine($"`Current Game:` **{(user.CurrentGame == null ? "-" : user.CurrentGame.Value.Name)}**");
if (user.LastOnlineAt != null) if (user.LastOnlineAt != null)
sb.AppendLine($"`Last Online:` **{user.LastOnlineAt:HH:mm:ss}**"); sb.AppendLine($"`Last Online:` **{user.LastOnlineAt:HH:mm:ss}**");
sb.AppendLine($"`Joined At:` **{user.JoinedAt}**"); sb.AppendLine($"`Joined At:` **{user.JoinedAt}**");

View File

@ -85,6 +85,22 @@ namespace NadekoBot.Modules.Administration.Commands
internal override void Init(CommandGroupBuilder cgb) internal override void Init(CommandGroupBuilder cgb)
{ {
cgb.CreateCommand(Module.Prefix + "cleanv+t")
.Description("Deletes all text channels ending in `-voice` for which voicechannels are not found. **Use at your own risk.**")
.AddCheck(SimpleCheckers.CanManageRoles)
.AddCheck(SimpleCheckers.ManageChannels())
.Do(async e =>
{
var allTxtChannels = e.Server.TextChannels.Where(c => c.Name.EndsWith("-voice"));
var validTxtChannelNames = e.Server.VoiceChannels.Select(c => GetChannelName(c.Name));
var invalidTxtChannels = allTxtChannels.Where(c => !validTxtChannelNames.Contains(c.Name));
invalidTxtChannels.ForEach(async c => await c.Delete());
await e.Channel.SendMessage("`Done.`");
});
cgb.CreateCommand(Module.Prefix + "v+t") cgb.CreateCommand(Module.Prefix + "v+t")
.Alias(Module.Prefix + "voice+text") .Alias(Module.Prefix + "voice+text")
.Description("Creates a text channel for each voice channel only users in that voice channel can see." + .Description("Creates a text channel for each voice channel only users in that voice channel can see." +

@ -1 +1 @@
Subproject commit 64d4b0af324f12d2130b4d16b1900c2a6457adf4 Subproject commit 80f9d6f2de25355a245bf93d4019d16e3fd033ca