.stats now show music stats, filter commands cleaned up
This commit is contained in:
parent
937f775db4
commit
82704166ab
@ -2,6 +2,7 @@
|
|||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using NadekoBot.Attributes;
|
using NadekoBot.Attributes;
|
||||||
|
using NadekoBot.Extensions;
|
||||||
using NadekoBot.Services;
|
using NadekoBot.Services;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -77,12 +78,12 @@ namespace NadekoBot.Modules.Permissions
|
|||||||
if (enabled)
|
if (enabled)
|
||||||
{
|
{
|
||||||
InviteFilteringServers.Add(channel.Guild.Id);
|
InviteFilteringServers.Add(channel.Guild.Id);
|
||||||
await channel.SendMessageAsync("✅ `Invite filtering enabled on this server.`").ConfigureAwait(false);
|
await channel.SendConfirmAsync("Invite filtering enabled on this server.").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
InviteFilteringServers.TryRemove(channel.Guild.Id);
|
InviteFilteringServers.TryRemove(channel.Guild.Id);
|
||||||
await channel.SendMessageAsync("ℹ️ `Invite filtering disabled on this server.`").ConfigureAwait(false);
|
await channel.SendConfirmAsync("Invite filtering disabled on this server.").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,12 +111,12 @@ namespace NadekoBot.Modules.Permissions
|
|||||||
if (removed == 0)
|
if (removed == 0)
|
||||||
{
|
{
|
||||||
InviteFilteringChannels.Add(channel.Id);
|
InviteFilteringChannels.Add(channel.Id);
|
||||||
await channel.SendMessageAsync("✅ `Invite filtering enabled on this channel.`").ConfigureAwait(false);
|
await channel.SendConfirmAsync("Invite filtering enabled on this channel.").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
InviteFilteringChannels.TryRemove(channel.Id);
|
InviteFilteringChannels.TryRemove(channel.Id);
|
||||||
await channel.SendMessageAsync("ℹ️ `Invite filtering disabled on this channel.`").ConfigureAwait(false);
|
await channel.SendConfirmAsync("Invite filtering disabled on this channel.").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,12 +137,12 @@ namespace NadekoBot.Modules.Permissions
|
|||||||
if (enabled)
|
if (enabled)
|
||||||
{
|
{
|
||||||
WordFilteringServers.Add(channel.Guild.Id);
|
WordFilteringServers.Add(channel.Guild.Id);
|
||||||
await channel.SendMessageAsync("✅ `Word filtering enabled on this server.`").ConfigureAwait(false);
|
await channel.SendConfirmAsync("Word filtering enabled on this server.").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WordFilteringServers.TryRemove(channel.Guild.Id);
|
WordFilteringServers.TryRemove(channel.Guild.Id);
|
||||||
await channel.SendMessageAsync("ℹ️ `Word filtering disabled on this server.`").ConfigureAwait(false);
|
await channel.SendConfirmAsync("Word filtering disabled on this server.").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,12 +170,12 @@ namespace NadekoBot.Modules.Permissions
|
|||||||
if (removed == 0)
|
if (removed == 0)
|
||||||
{
|
{
|
||||||
WordFilteringChannels.Add(channel.Id);
|
WordFilteringChannels.Add(channel.Id);
|
||||||
await channel.SendMessageAsync("✅ `Word filtering enabled on this channel.`").ConfigureAwait(false);
|
await channel.SendConfirmAsync("Word filtering enabled on this channel.").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WordFilteringChannels.TryRemove(channel.Id);
|
WordFilteringChannels.TryRemove(channel.Id);
|
||||||
await channel.SendMessageAsync("ℹ️ `Word filtering disabled on this channel.`").ConfigureAwait(false);
|
await channel.SendConfirmAsync("Word filtering disabled on this channel.").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,13 +208,13 @@ namespace NadekoBot.Modules.Permissions
|
|||||||
if (removed == 0)
|
if (removed == 0)
|
||||||
{
|
{
|
||||||
filteredWords.Add(word);
|
filteredWords.Add(word);
|
||||||
await channel.SendMessageAsync($"✅ Word `{word}` successfully added to the list of filtered words.")
|
await channel.SendConfirmAsync($"Word `{word}` successfully added to the list of filtered words.")
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
filteredWords.TryRemove(word);
|
filteredWords.TryRemove(word);
|
||||||
await channel.SendMessageAsync($"ℹ️ Word `{word}` removed from the list of filtered words.")
|
await channel.SendConfirmAsync($"Word `{word}` removed from the list of filtered words.")
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -227,7 +228,7 @@ namespace NadekoBot.Modules.Permissions
|
|||||||
ConcurrentHashSet<string> filteredWords;
|
ConcurrentHashSet<string> filteredWords;
|
||||||
ServerFilteredWords.TryGetValue(channel.Guild.Id, out filteredWords);
|
ServerFilteredWords.TryGetValue(channel.Guild.Id, out filteredWords);
|
||||||
|
|
||||||
await channel.SendMessageAsync($"ℹ️ `List of banned words:`\n" + string.Join(",\n", filteredWords))
|
await channel.SendConfirmAsync($"List of filtered words", string.Join("\n", filteredWords))
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -207,64 +207,21 @@ namespace NadekoBot.Modules.Utility
|
|||||||
var stats = NadekoBot.Stats;
|
var stats = NadekoBot.Stats;
|
||||||
|
|
||||||
await channel.EmbedAsync(
|
await channel.EmbedAsync(
|
||||||
new Embed()
|
new EmbedBuilder().WithOkColor()
|
||||||
{
|
.WithAuthor(eab => eab.WithName($"NadekoBot v{StatsService.BotVersion}")
|
||||||
Author = new EmbedAuthor()
|
.WithUrl("http://nadekobot.readthedocs.io/en/latest/")
|
||||||
{
|
.WithIconUrl("https://cdn.discordapp.com/avatars/116275390695079945/b21045e778ef21c96d175400e779f0fb.jpg"))
|
||||||
Name = $"NadekoBot v{StatsService.BotVersion}",
|
.AddField(efb => efb.WithName(Format.Bold("Author")).WithValue(stats.Author).WithIsInline(true))
|
||||||
Url = "http://nadekobot.readthedocs.io/en/latest/",
|
.AddField(efb => efb.WithName(Format.Bold("Library")).WithValue(stats.Library).WithIsInline(true))
|
||||||
IconUrl = "https://cdn.discordapp.com/avatars/116275390695079945/b21045e778ef21c96d175400e779f0fb.jpg"
|
.AddField(efb => efb.WithName(Format.Bold("Bot ID")).WithValue(NadekoBot.Client.GetCurrentUser().Id.ToString()).WithIsInline(true))
|
||||||
},
|
.AddField(efb => efb.WithName(Format.Bold("Commands Ran")).WithValue(stats.CommandsRan.ToString()).WithIsInline(true))
|
||||||
Fields = new[] {
|
.AddField(efb => efb.WithName(Format.Bold("Messages")).WithValue($"{stats.MessageCounter} ({stats.MessagesPerSecond:F2}/sec)").WithIsInline(true))
|
||||||
new EmbedField() {
|
.AddField(efb => efb.WithName(Format.Bold("Memory")).WithValue($"{stats.Heap} MB").WithIsInline(true))
|
||||||
Name = Format.Bold("Author"),
|
.AddField(efb => efb.WithName(Format.Bold("Owner ID(s)")).WithValue(stats.OwnerIds).WithIsInline(true))
|
||||||
Value = stats.Author,
|
.AddField(efb => efb.WithName(Format.Bold("Uptime")).WithValue(stats.GetUptimeString("\n")).WithIsInline(true))
|
||||||
Inline = true
|
.AddField(efb => efb.WithName(Format.Bold("Presence")).WithValue($"{NadekoBot.Client.GetGuilds().Count} Servers\n{stats.TextChannels} Text Channels\n{stats.VoiceChannels} Voice Channels").WithIsInline(true))
|
||||||
},
|
.WithFooter(efb => efb.WithText($"Playing {Music.Music.MusicPlayers.Where(mp => mp.Value.CurrentSong != null).Count()} songs, {Music.Music.MusicPlayers.Sum(mp => mp.Value.Playlist.Count)} queued."))
|
||||||
new EmbedField() {
|
.Build());
|
||||||
Name = Format.Bold("Library"),
|
|
||||||
Value = stats.Library,
|
|
||||||
Inline = true
|
|
||||||
},
|
|
||||||
new EmbedField() {
|
|
||||||
Name = Format.Bold("Bot ID"),
|
|
||||||
Value = NadekoBot.Client.GetCurrentUser().Id.ToString(),
|
|
||||||
Inline = true
|
|
||||||
},
|
|
||||||
new EmbedField() {
|
|
||||||
Name = Format.Bold("Commands Ran"),
|
|
||||||
Value = stats.CommandsRan.ToString(),
|
|
||||||
Inline = true
|
|
||||||
},
|
|
||||||
new EmbedField() {
|
|
||||||
Name = Format.Bold("Messages"),
|
|
||||||
Value = $"{stats.MessageCounter} ({stats.MessagesPerSecond:F2}/sec)",
|
|
||||||
Inline = true
|
|
||||||
},
|
|
||||||
new EmbedField() {
|
|
||||||
Name = Format.Bold("Memory"),
|
|
||||||
Value = $"{stats.Heap} MB",
|
|
||||||
Inline = true
|
|
||||||
},
|
|
||||||
new EmbedField() {
|
|
||||||
Name = Format.Bold("Owner ID(s)"),
|
|
||||||
Value = stats.OwnerIds,
|
|
||||||
Inline = true
|
|
||||||
},
|
|
||||||
new EmbedField() {
|
|
||||||
Name = Format.Bold("Uptime"),
|
|
||||||
Value = stats.GetUptimeString("\n"),
|
|
||||||
Inline = true
|
|
||||||
},
|
|
||||||
new EmbedField() {
|
|
||||||
Name = Format.Bold("Presence"),
|
|
||||||
Value = $"{NadekoBot.Client.GetGuilds().Count} Servers\n{stats.TextChannels} Text Channels\n{stats.VoiceChannels} Voice Channels",
|
|
||||||
Inline = true
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
|
||||||
Color = 0x00bbd6
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Regex emojiFinder { get; } = new Regex(@"<:(?<name>.+?):(?<id>\d*)>", RegexOptions.Compiled);
|
private Regex emojiFinder { get; } = new Regex(@"<:(?<name>.+?):(?<id>\d*)>", RegexOptions.Compiled);
|
||||||
|
Loading…
Reference in New Issue
Block a user