disabled private poll, removed shardid command

This commit is contained in:
Master Kwoth
2017-06-21 23:12:24 +02:00
parent c709680413
commit 4862564c74
6 changed files with 56 additions and 48 deletions

View File

@@ -44,9 +44,14 @@ namespace NadekoBot.Modules.Games
await Context.Channel.EmbedAsync(poll.GetStats(GetText("current_poll_results")));
}
//todo enable private polls, or completely remove them
private async Task InternalStartPoll(string arg, bool isPublic = false)
{
if (isPublic == false)
{
await ReplyErrorLocalized($"Temporarily disabled. Use `{Prefix}ppoll`");
return;
}
if(await _polls.StartPoll((ITextChannel)Context.Channel, Context.Message, arg, isPublic) == false)
await ReplyErrorLocalized("poll_already_running").ConfigureAwait(false);
}

View File

@@ -18,6 +18,7 @@ using Discord.WebSocket;
using System.Diagnostics;
using Color = Discord.Color;
using NadekoBot.Services;
using NadekoBot.DataStructures;
namespace NadekoBot.Modules.Utility
{
@@ -277,48 +278,41 @@ namespace NadekoBot.Modules.Utility
await Context.Channel.SendConfirmAsync($"{Context.User.Mention} https://discord.gg/{invite.Code}");
}
//todo 2 shard commands
//[NadekoCommand, Usage, Description, Aliases]
//public async Task ShardStats(int page = 1)
//{
// if (--page < 0)
// return;
// var status = string.Join(", ", _client.Shards.GroupBy(x => x.ConnectionState)
// .Select(x => $"{x.Count()} {x.Key}")
// .ToArray());
[NadekoCommand, Usage, Description, Aliases]
[Shard0Precondition]
public async Task ShardStats(int page = 1)
{
if (--page < 0)
return;
// var allShardStrings = _client.Shards
// .Select(x =>
// GetText("shard_stats_txt", x.ShardId.ToString(),
// Format.Bold(x.ConnectionState.ToString()), Format.Bold(x.Guilds.Count.ToString())))
// .ToArray();
var status = string.Join(", ", _bot.ShardCoord.Statuses.GroupBy(x => x.ConnectionState)
.Select(x => $"{x.Count()} {x.Key}")
.ToArray());
var allShardStrings = _bot.ShardCoord.Statuses
.Select(x =>
GetText("shard_stats_txt", x.ShardId.ToString(),
Format.Bold(x.ConnectionState.ToString()), Format.Bold(x.Guilds.ToString())))
.ToArray();
// await Context.Channel.SendPaginatedConfirmAsync(_client, page, (curPage) =>
// {
await Context.Channel.SendPaginatedConfirmAsync(_client, page, (curPage) =>
{
// var str = string.Join("\n", allShardStrings.Skip(25 * curPage).Take(25));
var str = string.Join("\n", allShardStrings.Skip(25 * curPage).Take(25));
// if (string.IsNullOrWhiteSpace(str))
// str = GetText("no_shards_on_page");
if (string.IsNullOrWhiteSpace(str))
str = GetText("no_shards_on_page");
// return new EmbedBuilder()
// .WithAuthor(a => a.WithName(GetText("shard_stats")))
// .WithTitle(status)
// .WithOkColor()
// .WithDescription(str);
// }, allShardStrings.Length / 25);
//}
//[NadekoCommand, Usage, Description, Aliases]
//public async Task ShardId(IGuild guild)
//{
// var shardId = _client.GetShardIdFor(guild);
// await Context.Channel.SendConfirmAsync(shardId.ToString()).ConfigureAwait(false);
//}
return new EmbedBuilder()
.WithAuthor(a => a.WithName(GetText("shard_stats")))
.WithTitle(status)
.WithOkColor()
.WithDescription(str);
}, allShardStrings.Length / 25);
}
[NadekoCommand, Usage, Description, Aliases]
public async Task Stats()