.listservers command added

This commit is contained in:
Kwoth 2016-10-28 13:31:21 +02:00
parent bc4d37c0fa
commit 2f82ae2821
3 changed files with 59 additions and 0 deletions

View File

@ -177,6 +177,29 @@ namespace NadekoBot.Modules.Utility
await msg.Channel.SendMessageAsync(result).ConfigureAwait(false); await msg.Channel.SendMessageAsync(result).ConfigureAwait(false);
} }
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
[OwnerOnly]
public async Task ListServers(IUserMessage imsg, int page = 1)
{
var channel = (ITextChannel)imsg.Channel;
page -= 1;
if (page < 0)
return;
var guilds = NadekoBot.Client.GetGuilds().OrderBy(g => g.Name).Skip((page - 1) * 15).Take(15);
if (!guilds.Any())
{
await channel.SendMessageAsync("`No servers found on that page.`").ConfigureAwait(false);
return;
}
await channel.SendMessageAsync(String.Join("\n", guilds.Select(g => $"`Name:` {g.Name} `Id:` {g.Id} `Members:` {g.GetUsers().Count} `OwnerId:`{g.OwnerId}"))).ConfigureAwait(false);
}
//[NadekoCommand, Usage, Description, Aliases] //[NadekoCommand, Usage, Description, Aliases]
//[RequireContext(ContextType.Guild)] //[RequireContext(ContextType.Guild)]
//public async Task TextToImage(IUserMessage msg, [Remainder] string arg) //public async Task TextToImage(IUserMessage msg, [Remainder] string arg)

View File

@ -3434,6 +3434,33 @@ namespace NadekoBot.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to listservers.
/// </summary>
public static string listservers_cmd {
get {
return ResourceManager.GetString("listservers_cmd", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Lists servers the bot is on with some basic info. 15 per page..
/// </summary>
public static string listservers_desc {
get {
return ResourceManager.GetString("listservers_desc", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to `{0}listservers 3`.
/// </summary>
public static string listservers_usage {
get {
return ResourceManager.GetString("listservers_usage", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to liststreams ls. /// Looks up a localized string similar to liststreams ls.
/// </summary> /// </summary>

View File

@ -2592,4 +2592,13 @@
<data name="typelist_usage" xml:space="preserve"> <data name="typelist_usage" xml:space="preserve">
<value>`{0}typelist` or `{0}typelist 3`</value> <value>`{0}typelist` or `{0}typelist 3`</value>
</data> </data>
<data name="listservers_cmd" xml:space="preserve">
<value>listservers</value>
</data>
<data name="listservers_desc" xml:space="preserve">
<value>Lists servers the bot is on with some basic info. 15 per page.</value>
</data>
<data name="listservers_usage" xml:space="preserve">
<value>`{0}listservers 3`</value>
</data>
</root> </root>