.logevents now shows where are you logging the event, if you are
This commit is contained in:
parent
96b86e83b9
commit
8c278fd1bd
@ -106,11 +106,60 @@ namespace NadekoBot.Modules.Administration
|
|||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
public async Task LogEvents()
|
public async Task LogEvents()
|
||||||
{
|
{
|
||||||
|
_service.GuildLogSettings.TryGetValue(Context.Guild.Id, out LogSetting l);
|
||||||
|
var str = string.Join("\n", Enum.GetNames(typeof(LogType))
|
||||||
|
.Select(x =>
|
||||||
|
{
|
||||||
|
var val = l == null ? null : GetLogProperty(l, Enum.Parse<LogType>(x));
|
||||||
|
if (val != null)
|
||||||
|
return $"{Format.Bold(x)} <#{val}>";
|
||||||
|
return Format.Bold(x);
|
||||||
|
}));
|
||||||
|
|
||||||
await Context.Channel.SendConfirmAsync(Format.Bold(GetText("log_events")) + "\n" +
|
await Context.Channel.SendConfirmAsync(Format.Bold(GetText("log_events")) + "\n" +
|
||||||
$"```fix\n{string.Join(", ", Enum.GetNames(typeof(LogType)).Cast<string>())}```")
|
str)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ulong? GetLogProperty(LogSetting l, LogType type)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case LogType.Other:
|
||||||
|
return l.LogOtherId;
|
||||||
|
case LogType.MessageUpdated:
|
||||||
|
return l.MessageUpdatedId;
|
||||||
|
case LogType.MessageDeleted:
|
||||||
|
return l.MessageDeletedId;
|
||||||
|
case LogType.UserJoined:
|
||||||
|
return l.UserJoinedId;
|
||||||
|
case LogType.UserLeft:
|
||||||
|
return l.UserLeftId;
|
||||||
|
case LogType.UserBanned:
|
||||||
|
return l.UserBannedId;
|
||||||
|
case LogType.UserUnbanned:
|
||||||
|
return l.UserUnbannedId;
|
||||||
|
case LogType.UserUpdated:
|
||||||
|
return l.UserUpdatedId;
|
||||||
|
case LogType.ChannelCreated:
|
||||||
|
return l.ChannelCreatedId;
|
||||||
|
case LogType.ChannelDestroyed:
|
||||||
|
return l.ChannelDestroyedId;
|
||||||
|
case LogType.ChannelUpdated:
|
||||||
|
return l.ChannelUpdatedId;
|
||||||
|
case LogType.UserPresence:
|
||||||
|
return l.LogUserPresenceId;
|
||||||
|
case LogType.VoicePresence:
|
||||||
|
return l.LogVoicePresenceId;
|
||||||
|
case LogType.VoicePresenceTTS:
|
||||||
|
return l.LogVoicePresenceTTSId;
|
||||||
|
case LogType.UserMuted:
|
||||||
|
return l.UserMutedId;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
[RequireUserPermission(GuildPermission.Administrator)]
|
[RequireUserPermission(GuildPermission.Administrator)]
|
||||||
|
Loading…
Reference in New Issue
Block a user