added emojis to logcommands, thx to Manuel

This commit is contained in:
Kwoth 2017-01-09 11:56:40 +01:00
parent 018f43e50c
commit a97900add6

View File

@ -119,8 +119,8 @@ namespace NadekoBot.Modules.Administration
if (before.Username != after.Username) if (before.Username != after.Username)
{ {
embed.WithAuthor(eab => eab.WithName("Username Changed")) embed.WithTitle("👥 Username Changed")
.WithTitle($"{before.Username}#{before.Discriminator} | {before.Id}") .WithDescription($"{before.Username}#{before.Discriminator} | {before.Id}")
.AddField(fb => fb.WithName("Old Name").WithValue($"{before.Username}").WithIsInline(true)) .AddField(fb => fb.WithName("Old Name").WithValue($"{before.Username}").WithIsInline(true))
.AddField(fb => fb.WithName("New Name").WithValue($"{after.Username}").WithIsInline(true)) .AddField(fb => fb.WithName("New Name").WithValue($"{after.Username}").WithIsInline(true))
.WithFooter(fb => fb.WithText(currentTime)) .WithFooter(fb => fb.WithText(currentTime))
@ -128,7 +128,8 @@ namespace NadekoBot.Modules.Administration
} }
else if (before.AvatarUrl != after.AvatarUrl) else if (before.AvatarUrl != after.AvatarUrl)
{ {
embed.WithAuthor(eab => eab.WithName("Avatar Changed")) embed.WithTitle("👥 Avatar Changed")
.WithDescription($"{before.Username}#{before.Discriminator} | {before.Id}")
.WithTitle($"{before.Username}#{before.Discriminator} | {before.Id}") .WithTitle($"{before.Username}#{before.Discriminator} | {before.Id}")
.WithThumbnailUrl(before.AvatarUrl) .WithThumbnailUrl(before.AvatarUrl)
.WithImageUrl(after.AvatarUrl) .WithImageUrl(after.AvatarUrl)
@ -229,7 +230,7 @@ namespace NadekoBot.Modules.Administration
break; break;
} }
var embed = new EmbedBuilder().WithAuthor(eab => eab.WithName("User Muted from " + mutes)) var embed = new EmbedBuilder().WithAuthor(eab => eab.WithName("🔇 User Muted from " + mutes))
.WithTitle($"{usr.Username}#{usr.Discriminator} | {usr.Id}") .WithTitle($"{usr.Username}#{usr.Discriminator} | {usr.Id}")
.WithFooter(fb => fb.WithText(currentTime)) .WithFooter(fb => fb.WithText(currentTime))
.WithOkColor(); .WithOkColor();
@ -266,7 +267,7 @@ namespace NadekoBot.Modules.Administration
break; break;
} }
var embed = new EmbedBuilder().WithAuthor(eab => eab.WithName("User Unmuted from " + mutes)) var embed = new EmbedBuilder().WithAuthor(eab => eab.WithName("🔊 User Unmuted from " + mutes))
.WithTitle($"{usr.Username}#{usr.Discriminator} | {usr.Id}") .WithTitle($"{usr.Username}#{usr.Discriminator} | {usr.Id}")
.WithFooter(fb => fb.WithText($"{currentTime}")) .WithFooter(fb => fb.WithText($"{currentTime}"))
.WithOkColor(); .WithOkColor();
@ -305,7 +306,7 @@ namespace NadekoBot.Modules.Administration
punishment = "⛔️ BANNED"; punishment = "⛔️ BANNED";
} }
var embed = new EmbedBuilder().WithAuthor(eab => eab.WithName($"Anti-{protection}")) var embed = new EmbedBuilder().WithAuthor(eab => eab.WithName($"🛡 Anti-{protection}"))
.WithTitle($"Users " + punishment) .WithTitle($"Users " + punishment)
.WithDescription(String.Join("\n", users.Select(u => u.ToString()))) .WithDescription(String.Join("\n", users.Select(u => u.ToString())))
.WithFooter(fb => fb.WithText($"{currentTime}")) .WithFooter(fb => fb.WithText($"{currentTime}"))
@ -332,7 +333,7 @@ namespace NadekoBot.Modules.Administration
.WithTitle($"{before.Username}#{before.Discriminator} | {before.Id}"); .WithTitle($"{before.Username}#{before.Discriminator} | {before.Id}");
if (before.Nickname != after.Nickname) if (before.Nickname != after.Nickname)
{ {
embed.WithAuthor(eab => eab.WithName("Nickname Changed")) embed.WithAuthor(eab => eab.WithName("👥 Nickname Changed"))
.AddField(efb => efb.WithName("Old Nickname").WithValue($"{before.Nickname}#{before.Discriminator}")) .AddField(efb => efb.WithName("Old Nickname").WithValue($"{before.Nickname}#{before.Discriminator}"))
.AddField(efb => efb.WithName("New Nickname").WithValue($"{after.Nickname}#{after.Discriminator}")); .AddField(efb => efb.WithName("New Nickname").WithValue($"{after.Nickname}#{after.Discriminator}"));
@ -342,13 +343,13 @@ namespace NadekoBot.Modules.Administration
if (before.RoleIds.Count < after.RoleIds.Count) if (before.RoleIds.Count < after.RoleIds.Count)
{ {
var diffRoles = after.RoleIds.Where(r => !before.RoleIds.Contains(r)).Select(r => before.Guild.GetRole(r).Name); var diffRoles = after.RoleIds.Where(r => !before.RoleIds.Contains(r)).Select(r => before.Guild.GetRole(r).Name);
embed.WithAuthor(eab => eab.WithName("User's Role Added")) embed.WithAuthor(eab => eab.WithName("User's Role Added"))
.WithDescription(string.Join(", ", diffRoles).SanitizeMentions()); .WithDescription(string.Join(", ", diffRoles).SanitizeMentions());
} }
else if (before.RoleIds.Count > after.RoleIds.Count) else if (before.RoleIds.Count > after.RoleIds.Count)
{ {
var diffRoles = before.RoleIds.Where(r => !after.RoleIds.Contains(r)).Select(r => before.Guild.GetRole(r).Name); var diffRoles = before.RoleIds.Where(r => !after.RoleIds.Contains(r)).Select(r => before.Guild.GetRole(r).Name);
embed.WithAuthor(eab => eab.WithName("User's Role Removed")) embed.WithAuthor(eab => eab.WithName("User's Role Removed"))
.WithDescription(string.Join(", ", diffRoles).SanitizeMentions()); .WithDescription(string.Join(", ", diffRoles).SanitizeMentions());
} }
} }
@ -385,15 +386,14 @@ namespace NadekoBot.Modules.Administration
if (before.Name != after.Name) if (before.Name != after.Name)
{ {
embed.WithTitle("Channel Name Changed") embed.WithTitle(" Channel Name Changed")
.AddField(efb => efb.WithName("Id").WithValue(before.Id.ToString())) .WithDescription($"{after} | {after.Id}")
.AddField(efb => efb.WithName("Old Name").WithValue(before.Name)) .AddField(efb => efb.WithName("Old Name").WithValue(before.Name));
.AddField(efb => efb.WithName("New name").WithValue(after.Name));
} }
else if (beforeTextChannel?.Topic != afterTextChannel?.Topic) else if (beforeTextChannel?.Topic != afterTextChannel?.Topic)
{ {
embed.WithTitle("Channel Topic Changed") embed.WithTitle(" Channel Topic Changed")
.AddField(efb => efb.WithName("Id").WithValue(before.Id.ToString())) .WithDescription($"{after} | {after.Id}")
.AddField(efb => efb.WithName("Old Topic").WithValue(beforeTextChannel.Topic)) .AddField(efb => efb.WithName("Old Topic").WithValue(beforeTextChannel.Topic))
.AddField(efb => efb.WithName("New Topic").WithValue(afterTextChannel.Topic)); .AddField(efb => efb.WithName("New Topic").WithValue(afterTextChannel.Topic));
} }
@ -423,7 +423,7 @@ namespace NadekoBot.Modules.Administration
await logChannel.EmbedAsync(new EmbedBuilder() await logChannel.EmbedAsync(new EmbedBuilder()
.WithOkColor() .WithOkColor()
.WithTitle((ch is IVoiceChannel ? "Voice" : "Text") + " Channel Destroyed") .WithTitle("🆕 " + (ch is IVoiceChannel ? "Voice" : "Text") + " Channel Destroyed")
.WithDescription($"{ch.Name} | {ch.Id}") .WithDescription($"{ch.Name} | {ch.Id}")
.WithFooter(efb => efb.WithText(currentTime))).ConfigureAwait(false); .WithFooter(efb => efb.WithText(currentTime))).ConfigureAwait(false);
} }
@ -449,7 +449,7 @@ namespace NadekoBot.Modules.Administration
await logChannel.EmbedAsync(new EmbedBuilder() await logChannel.EmbedAsync(new EmbedBuilder()
.WithOkColor() .WithOkColor()
.WithTitle((ch is IVoiceChannel ? "Voice" : "Text") + " Channel Created") .WithTitle("🆕 " + (ch is IVoiceChannel ? "Voice" : "Text") + " Channel Created")
.WithDescription($"{ch.Name} | {ch.Id}") .WithDescription($"{ch.Name} | {ch.Id}")
.WithFooter(efb => efb.WithText(currentTime))).ConfigureAwait(false); .WithFooter(efb => efb.WithText(currentTime))).ConfigureAwait(false);
} }
@ -502,7 +502,7 @@ namespace NadekoBot.Modules.Administration
{ {
try try
{ {
var guild = optGuild.IsSpecified ? optGuild.Value : null; var guild = optGuild.GetValueOrDefault() ?? (usr as SocketGuildUser)?.Guild;
if (guild == null) if (guild == null)
return; return;
@ -516,11 +516,16 @@ namespace NadekoBot.Modules.Administration
ITextChannel logChannel; ITextChannel logChannel;
if ((logChannel = await TryGetLogChannel(guild, logSetting, LogType.UserPresence)) == null) if ((logChannel = await TryGetLogChannel(guild, logSetting, LogType.UserPresence)) == null)
return; return;
string str; string str = "";
if (before.Status != after.Status) if (before.Status != after.Status)
str = $"🎭`{prettyCurrentTime}`👤__**{usr.Username}**__ is now **{after.Status}**."; str = $"🎭`{prettyCurrentTime}`👤__**{usr.Username}**__ is now **{after.Status}**.";
else
str = $"👾`{prettyCurrentTime}`👤__**{usr.Username}**__ is now playing **{after.Game}**."; //if (before.Game?.Name != after.Game?.Name)
//{
// if (str != "")
// str += "\n";
// str += $"👾`{prettyCurrentTime}`👤__**{usr.Username}**__ is now playing **{after.Game?.Name}**.";
//}
PresenceUpdates.AddOrUpdate(logChannel, new List<string>() { str }, (id, list) => { list.Add(str); return list; }); PresenceUpdates.AddOrUpdate(logChannel, new List<string>() { str }, (id, list) => { list.Add(str); return list; });
} }
@ -542,9 +547,10 @@ namespace NadekoBot.Modules.Administration
await logChannel.EmbedAsync(new EmbedBuilder() await logChannel.EmbedAsync(new EmbedBuilder()
.WithOkColor() .WithOkColor()
.WithTitle("User Left") .WithTitle("User Left")
.WithThumbnailUrl(usr.AvatarUrl) .WithThumbnailUrl(usr.AvatarUrl)
.WithDescription($"{usr} | {usr.Id}") .WithDescription(usr.ToString())
.AddField(efb => efb.WithName("Id").WithValue(usr.Id.ToString()))
.WithFooter(efb => efb.WithText(currentTime))).ConfigureAwait(false); .WithFooter(efb => efb.WithText(currentTime))).ConfigureAwait(false);
} }
catch { } catch { }
@ -565,9 +571,10 @@ namespace NadekoBot.Modules.Administration
await logChannel.EmbedAsync(new EmbedBuilder() await logChannel.EmbedAsync(new EmbedBuilder()
.WithOkColor() .WithOkColor()
.WithTitle("User Joined") .WithTitle("User Joined")
.WithThumbnailUrl(usr.AvatarUrl) .WithThumbnailUrl(usr.AvatarUrl)
.WithDescription($"{usr} | {usr.Id}") .WithDescription($"{usr}")
.AddField(efb => efb.WithName("Id").WithValue(usr.Id.ToString()))
.WithFooter(efb => efb.WithText(currentTime))).ConfigureAwait(false); .WithFooter(efb => efb.WithText(currentTime))).ConfigureAwait(false);
} }
catch (Exception ex) { _log.Warn(ex); } catch (Exception ex) { _log.Warn(ex); }
@ -588,8 +595,10 @@ namespace NadekoBot.Modules.Administration
await logChannel.EmbedAsync(new EmbedBuilder() await logChannel.EmbedAsync(new EmbedBuilder()
.WithOkColor() .WithOkColor()
.WithTitle("User Unbanned") .WithTitle("♻️ User Unbanned")
.WithDescription($"{usr} | {usr.Id}") .WithThumbnailUrl(usr.AvatarUrl)
.WithDescription(usr.ToString())
.AddField(efb => efb.WithName("Id").WithValue(usr.Id.ToString()))
.WithFooter(efb => efb.WithText(currentTime))).ConfigureAwait(false); .WithFooter(efb => efb.WithText(currentTime))).ConfigureAwait(false);
} }
catch (Exception ex) { _log.Warn(ex); } catch (Exception ex) { _log.Warn(ex); }
@ -609,8 +618,10 @@ namespace NadekoBot.Modules.Administration
return; return;
await logChannel.EmbedAsync(new EmbedBuilder() await logChannel.EmbedAsync(new EmbedBuilder()
.WithOkColor() .WithOkColor()
.WithTitle("User Banned") .WithTitle("🚫 User Banned")
.WithDescription($"{usr} | {usr.Id}") .WithThumbnailUrl(usr.AvatarUrl)
.WithDescription(usr.ToString())
.AddField(efb => efb.WithName("Id").WithValue(usr.Id.ToString()))
.WithFooter(efb => efb.WithText(currentTime))).ConfigureAwait(false); .WithFooter(efb => efb.WithText(currentTime))).ConfigureAwait(false);
} }
catch (Exception ex) { _log.Warn(ex); } catch (Exception ex) { _log.Warn(ex); }
@ -640,10 +651,10 @@ namespace NadekoBot.Modules.Administration
return; return;
var embed = new EmbedBuilder() var embed = new EmbedBuilder()
.WithOkColor() .WithOkColor()
.WithAuthor(eab => eab.WithName("Message Deleted")) .WithTitle("🗑 Message Deleted")
.WithTitle($"{msg.Author}") .WithDescription($"{msg.Author}")
.WithDescription($"{msg.Resolve(userHandling: TagHandling.FullName)}") .AddField(efb => efb.WithName("Content").WithValue(msg.Resolve(userHandling: TagHandling.FullName)).WithIsInline(false))
.AddField(efb => efb.WithName("Message Id").WithValue(msg.Id.ToString()).WithIsInline(false)) .AddField(efb => efb.WithName("Id").WithValue(msg.Id.ToString()).WithIsInline(false))
.WithFooter(efb => efb.WithText(currentTime)); .WithFooter(efb => efb.WithText(currentTime));
if (msg.Attachments.Any()) if (msg.Attachments.Any())
embed.AddField(efb => efb.WithName("Attachments").WithValue(string.Join(", ", msg.Attachments.Select(a => a.ProxyUrl))).WithIsInline(false)); embed.AddField(efb => efb.WithName("Attachments").WithValue(string.Join(", ", msg.Attachments.Select(a => a.ProxyUrl))).WithIsInline(false));
@ -684,11 +695,11 @@ namespace NadekoBot.Modules.Administration
var embed = new EmbedBuilder() var embed = new EmbedBuilder()
.WithOkColor() .WithOkColor()
.WithAuthor(eab => eab.WithName("Message Updated")) .WithTitle("📝 Message Updated")
.WithTitle($"{after.Author}") .WithDescription(after.Author.ToString())
.AddField(efb => efb.WithName("Old Message").WithValue(before.Resolve(userHandling: TagHandling.FullName)).WithIsInline(false)) .AddField(efb => efb.WithName("Old Message").WithValue(before.Resolve(userHandling: TagHandling.FullName)).WithIsInline(false))
.AddField(efb => efb.WithName("New Message").WithValue(after.Resolve(userHandling: TagHandling.FullName)).WithIsInline(false)) .AddField(efb => efb.WithName("New Message").WithValue(after.Resolve(userHandling: TagHandling.FullName)).WithIsInline(false))
.AddField(efb => efb.WithName("Message Id").WithValue(after.Id.ToString()).WithIsInline(false)) .AddField(efb => efb.WithName("Id").WithValue(after.Id.ToString()).WithIsInline(false))
.WithFooter(efb => efb.WithText(currentTime)); .WithFooter(efb => efb.WithText(currentTime));
await logChannel.EmbedAsync(embed).ConfigureAwait(false); await logChannel.EmbedAsync(embed).ConfigureAwait(false);