.listservers command added
This commit is contained in:
parent
bc4d37c0fa
commit
2f82ae2821
@ -177,6 +177,29 @@ namespace NadekoBot.Modules.Utility
|
||||
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]
|
||||
//[RequireContext(ContextType.Guild)]
|
||||
//public async Task TextToImage(IUserMessage msg, [Remainder] string arg)
|
||||
|
27
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
27
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
@ -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>
|
||||
/// Looks up a localized string similar to liststreams ls.
|
||||
/// </summary>
|
||||
|
@ -2592,4 +2592,13 @@
|
||||
<data name="typelist_usage" xml:space="preserve">
|
||||
<value>`{0}typelist` or `{0}typelist 3`</value>
|
||||
</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>
|
Loading…
Reference in New Issue
Block a user