diff --git a/src/NadekoBot/Modules/Utility/Utility.cs b/src/NadekoBot/Modules/Utility/Utility.cs index 8634c721..6933be88 100644 --- a/src/NadekoBot/Modules/Utility/Utility.cs +++ b/src/NadekoBot/Modules/Utility/Utility.cs @@ -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) diff --git a/src/NadekoBot/Resources/CommandStrings.Designer.cs b/src/NadekoBot/Resources/CommandStrings.Designer.cs index 542b2cb8..abb53dd0 100644 --- a/src/NadekoBot/Resources/CommandStrings.Designer.cs +++ b/src/NadekoBot/Resources/CommandStrings.Designer.cs @@ -3434,6 +3434,33 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to listservers. + /// + public static string listservers_cmd { + get { + return ResourceManager.GetString("listservers_cmd", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Lists servers the bot is on with some basic info. 15 per page.. + /// + public static string listservers_desc { + get { + return ResourceManager.GetString("listservers_desc", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to `{0}listservers 3`. + /// + public static string listservers_usage { + get { + return ResourceManager.GetString("listservers_usage", resourceCulture); + } + } + /// /// Looks up a localized string similar to liststreams ls. /// diff --git a/src/NadekoBot/Resources/CommandStrings.resx b/src/NadekoBot/Resources/CommandStrings.resx index 10c72d72..99877fdd 100644 --- a/src/NadekoBot/Resources/CommandStrings.resx +++ b/src/NadekoBot/Resources/CommandStrings.resx @@ -2592,4 +2592,13 @@ `{0}typelist` or `{0}typelist 3` + + listservers + + + Lists servers the bot is on with some basic info. 15 per page. + + + `{0}listservers 3` + \ No newline at end of file