lot of changes

- added colors
- added emojis
- changes few others
- added css to server info
This commit is contained in:
samvaio 2016-11-21 05:54:15 +05:30 committed by GitHub
parent 51fd22c291
commit caa1666ef7

View File

@ -37,9 +37,9 @@ namespace NadekoBot.Modules.Utility
int i = 0; int i = 0;
if (!arr.Any()) if (!arr.Any())
await channel.SendMessageAsync(_l["`Nobody is playing that game.`"]).ConfigureAwait(false); await channel.SendMessageAsync(_l["🚧 `Nobody is playing that game.`"]).ConfigureAwait(false);
else else
await channel.SendMessageAsync("```xl\n" + string.Join("\n", arr.GroupBy(item => (i++) / 3).Select(ig => string.Concat(ig.Select(el => $"• {el,-35}")))) + "\n```").ConfigureAwait(false); await channel.SendMessageAsync("```css\n" + string.Join("\n", arr.GroupBy(item => (i++) / 3).Select(ig => string.Concat(ig.Select(el => $"• {el,-35}")))) + "\n```").ConfigureAwait(false);
} }
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
@ -50,20 +50,20 @@ namespace NadekoBot.Modules.Utility
return; return;
var channel = (ITextChannel)umsg.Channel; var channel = (ITextChannel)umsg.Channel;
var arg = roles.Split(',').Select(r => r.Trim().ToUpperInvariant()); var arg = roles.Split(',').Select(r => r.Trim().ToUpperInvariant());
string send = _l["`Here is a list of users in a specfic role:`"]; string send = _l[" **Here is a list of users in a specfic role:**"];
foreach (var roleStr in arg.Where(str => !string.IsNullOrWhiteSpace(str) && str != "@EVERYONE" && str != "EVERYONE")) foreach (var roleStr in arg.Where(str => !string.IsNullOrWhiteSpace(str) && str != "@EVERYONE" && str != "EVERYONE"))
{ {
var role = channel.Guild.Roles.Where(r => r.Name.ToUpperInvariant() == roleStr).FirstOrDefault(); var role = channel.Guild.Roles.Where(r => r.Name.ToUpperInvariant() == roleStr).FirstOrDefault();
if (role == null) continue; if (role == null) continue;
send += $"\n`{role.Name}`\n"; send += $"__**{role.Name}**__\n```css\n";
send += string.Join(", ", channel.Guild.GetUsers().Where(u => u.Roles.Contains(role)).Select(u => u.ToString())); send += string.Join(", ```", channel.Guild.GetUsers().Where(u => u.Roles.Contains(role)).Select(u => u.ToString()));
} }
var usr = umsg.Author as IGuildUser; var usr = umsg.Author as IGuildUser;
while (send.Length > 2000) while (send.Length > 2000)
{ {
if (!usr.GetPermissions(channel).ManageMessages) if (!usr.GetPermissions(channel).ManageMessages)
{ {
await channel.SendMessageAsync($"{usr.Mention} you are not allowed to use this command on roles with a lot of users in them to prevent abuse.").ConfigureAwait(false); await channel.SendMessageAsync($"⚠️ {usr.Mention} **you are not allowed to use this command on roles with a lot of users in them to prevent abuse.**").ConfigureAwait(false);
return; return;
} }
var curstr = send.Substring(0, 2000); var curstr = send.Substring(0, 2000);
@ -80,7 +80,7 @@ namespace NadekoBot.Modules.Utility
public async Task CheckMyPerms(IUserMessage msg) public async Task CheckMyPerms(IUserMessage msg)
{ {
StringBuilder builder = new StringBuilder("```\n"); StringBuilder builder = new StringBuilder("```http\n");
var user = msg.Author as IGuildUser; var user = msg.Author as IGuildUser;
var perms = user.GetPermissions((ITextChannel)msg.Channel); var perms = user.GetPermissions((ITextChannel)msg.Channel);
foreach (var p in perms.GetType().GetProperties().Where(p => !p.GetGetMethod().GetParameters().Any())) foreach (var p in perms.GetType().GetProperties().Where(p => !p.GetGetMethod().GetParameters().Any()))
@ -97,20 +97,20 @@ namespace NadekoBot.Modules.Utility
public async Task UserId(IUserMessage msg, IGuildUser target = null) public async Task UserId(IUserMessage msg, IGuildUser target = null)
{ {
var usr = target ?? msg.Author; var usr = target ?? msg.Author;
await msg.Reply($"Id of the user { usr.Username } is { usr.Id }").ConfigureAwait(false); await msg.Reply($"🆔 of the user **{ usr.Username }** is `{ usr.Id }`").ConfigureAwait(false);
} }
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
public async Task ChannelId(IUserMessage msg) public async Task ChannelId(IUserMessage msg)
{ {
await msg.Reply($"This Channel's ID is {msg.Channel.Id}").ConfigureAwait(false); await msg.Reply($" This **Channel's ID** is `{msg.Channel.Id}`").ConfigureAwait(false);
} }
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
public async Task ServerId(IUserMessage msg) public async Task ServerId(IUserMessage msg)
{ {
await msg.Reply($"This server's ID is {((ITextChannel)msg.Channel).Guild.Id}").ConfigureAwait(false); await msg.Reply($" This **Server's ID** is `{((ITextChannel)msg.Channel).Guild.Id}`").ConfigureAwait(false);
} }
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
@ -126,11 +126,11 @@ namespace NadekoBot.Modules.Utility
return; return;
if (target != null) if (target != null)
{ {
await msg.Reply($"`Page #{page} of roles for **{target.Username}**:` \n• " + string.Join("\n• ", target.Roles.Except(new[] { guild.EveryoneRole }).OrderBy(r => r.Position).Skip((page - 1) * RolesPerPage).Take(RolesPerPage)).SanitizeMentions()); await msg.Reply($"⚔ **Page #{page} of roles for {target.Username}:** ```css\n• " + string.Join("\n• ```", target.Roles.Except(new[] { guild.EveryoneRole }).OrderBy(r => r.Position).Skip((page - 1) * RolesPerPage).Take(RolesPerPage)).SanitizeMentions());
} }
else else
{ {
await msg.Reply($"`Page #{page} of all roles on this server:` \n• " + string.Join("\n• ", guild.Roles.Except(new[] { guild.EveryoneRole }).OrderBy(r => r.Position).Skip((page - 1) * RolesPerPage).Take(RolesPerPage)).SanitizeMentions()); await msg.Reply($"⚔ **Page #{page} of all roles on this server:** ```css\n• " + string.Join("\n• ```", guild.Roles.Except(new[] { guild.EveryoneRole }).OrderBy(r => r.Position).Skip((page - 1) * RolesPerPage).Take(RolesPerPage)).SanitizeMentions());
} }
} }
@ -147,9 +147,9 @@ namespace NadekoBot.Modules.Utility
var topic = channel.Topic; var topic = channel.Topic;
if (string.IsNullOrWhiteSpace(topic)) if (string.IsNullOrWhiteSpace(topic))
await channel.SendMessageAsync("`No topic set.`"); await channel.SendMessageAsync("❎ **No topic set.**");
else else
await channel.SendMessageAsync("`Topic:` " + topic); await channel.SendMessageAsync(" **Topic:** " + topic);
} }
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
@ -167,7 +167,7 @@ namespace NadekoBot.Modules.Utility
var matches = emojiFinder.Matches(emojis); var matches = emojiFinder.Matches(emojis);
var result = string.Join("\n", matches.Cast<Match>() var result = string.Join("\n", matches.Cast<Match>()
.Select(m => $"`Name:` {m.Groups["name"]} `Link:` http://discordapp.com/api/emojis/{m.Groups["id"]}.png")); .Select(m => $"**Name:** {m.Groups["name"]} **Link:** http://discordapp.com/api/emojis/{m.Groups["id"]}.png"));
await msg.Channel.SendMessageAsync(result).ConfigureAwait(false); await msg.Channel.SendMessageAsync(result).ConfigureAwait(false);
} }
@ -188,11 +188,11 @@ namespace NadekoBot.Modules.Utility
if (!guilds.Any()) if (!guilds.Any())
{ {
await channel.SendMessageAsync("`No servers found on that page.`").ConfigureAwait(false); await channel.SendMessageAsync("❎ No servers found on that page.").ConfigureAwait(false);
return; 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); await channel.SendMessageAsync(String.Join("\n", guilds.Select(g => $"```css\n Name: {g.Name} ID: {g.Id} Members: #{g.GetUsers().Count} OwnerID:{g.OwnerId} ```"))).ConfigureAwait(false);
} }
//[NadekoCommand, Usage, Description, Aliases] //[NadekoCommand, Usage, Description, Aliases]