diff --git a/NadekoBot/Modules/Music.cs b/NadekoBot/Modules/Music.cs index 5773dc03..ab1d344e 100644 --- a/NadekoBot/Modules/Music.cs +++ b/NadekoBot/Modules/Music.cs @@ -206,6 +206,7 @@ namespace NadekoBot.Modules { cgb.CreateCommand("lopl") .Description("Queues up to 50 songs from a directory.") .Parameter("directory", ParameterType.Unparsed) + .AddCheck(Classes.Permissions.SimpleCheckers.OwnerOnly()) .Do(async e => { var arg = e.GetArg("directory"); if(string.IsNullOrWhiteSpace(e.GetArg("directory"))) @@ -234,6 +235,7 @@ namespace NadekoBot.Modules { cgb.CreateCommand("lo") .Description("Queues a local file by specifying a full path. BOT OWNER ONLY.") .Parameter("path", ParameterType.Unparsed) + .AddCheck(Classes.Permissions.SimpleCheckers.OwnerOnly()) .Do(async e => { var arg = e.GetArg("path"); if (string.IsNullOrWhiteSpace(arg)) diff --git a/NadekoBot/NadekoBot.cs b/NadekoBot/NadekoBot.cs index e080b8dc..8c2fb4aa 100644 --- a/NadekoBot/NadekoBot.cs +++ b/NadekoBot/NadekoBot.cs @@ -75,9 +75,14 @@ namespace NadekoBot { CustomPrefixHandler = m => 0, HelpMode = HelpMode.Disabled, ErrorHandler = async (s, e) => { - if (e.ErrorType != CommandErrorType.BadPermissions) - return; - await e.Channel.SendMessage(e.Exception.Message); + try { + if (e.ErrorType != CommandErrorType.BadPermissions) + return; + if (string.IsNullOrWhiteSpace(e.Exception.Message)) + return; + await e.Channel.SendMessage(e.Exception.Message); + } + catch { } } }); @@ -141,9 +146,18 @@ namespace NadekoBot { if (request != null) { if (string.IsNullOrWhiteSpace(request.Content)) e.Cancel = true; + //else + // Console.WriteLine("Sending request."); request.Content = request.Content.Replace("@everyone", "@everyοne"); } }; + + //client.ClientAPI.SentRequest += (s, e) => { + // var request = e.Request as Discord.API.Client.Rest.SendMessageRequest; + // if (request != null) { + // Console.WriteLine("Sent."); + // } + //}; }); Console.WriteLine("Exiting..."); Console.ReadKey(); @@ -151,45 +165,48 @@ namespace NadekoBot { static bool repliedRecently = false; private static async void Client_MessageReceived(object sender, MessageEventArgs e) { - if (e.Server != null || e.User.Id == client.CurrentUser.Id) return; - if (PollCommand.ActivePolls.SelectMany(kvp => kvp.Key.Users.Select(u => u.Id)).Contains(e.User.Id)) return; - // just ban this trash AutoModerator - // and cancer christmass spirit - // and crappy shotaslave - if (e.User.Id == 105309315895693312 || - e.User.Id == 119174277298782216 || - e.User.Id == 143515953525817344) - return; // FU + try { + if (e.Server != null || e.User.Id == client.CurrentUser.Id) return; + if (PollCommand.ActivePolls.SelectMany(kvp => kvp.Key.Users.Select(u => u.Id)).Contains(e.User.Id)) return; + // just ban this trash AutoModerator + // and cancer christmass spirit + // and crappy shotaslave + if (e.User.Id == 105309315895693312 || + e.User.Id == 119174277298782216 || + e.User.Id == 143515953525817344) + return; // FU - if (!NadekoBot.creds.DontJoinServers) { - try { - await (await client.GetInvite(e.Message.Text)).Accept(); - await e.Channel.SendMessage("I got in!"); - return; - } - catch { - if (e.User.Id == 109338686889476096) { //carbonitex invite - await e.Channel.SendMessage("Failed to join the server."); + if (!NadekoBot.creds.DontJoinServers) { + try { + await (await client.GetInvite(e.Message.Text)).Accept(); + await e.Channel.SendMessage("I got in!"); return; } + catch { + if (e.User.Id == 109338686889476096) { //carbonitex invite + await e.Channel.SendMessage("Failed to join the server."); + return; + } + } + } + + if (ForwardMessages && OwnerPrivateChannel != null) + await OwnerPrivateChannel.SendMessage(e.User + ": ```\n" + e.Message.Text + "\n```"); + + if (!repliedRecently) { + repliedRecently = true; + await e.Channel.SendMessage("**FULL LIST OF COMMANDS**:\n❤ ❤\n\n⚠**COMMANDS DO NOT WORK IN PERSONAL MESSAGES**\n\n\n**Bot Creator's server:** "); + Timer t = new Timer(); + t.Interval = 2000; + t.Start(); + t.Elapsed += (s, ev) => { + repliedRecently = false; + t.Stop(); + t.Dispose(); + }; } } - - if (ForwardMessages && OwnerPrivateChannel != null) - await OwnerPrivateChannel.SendMessage(e.User + ": ```\n" + e.Message.Text + "\n```"); - - if (!repliedRecently) { - repliedRecently = true; - await e.Channel.SendMessage("**FULL LIST OF COMMANDS**:\n❤ ❤\n\n⚠**COMMANDS DO NOT WORK IN PERSONAL MESSAGES**\n\n\n**Bot Creator's server:** "); - Timer t = new Timer(); - t.Interval = 2000; - t.Start(); - t.Elapsed += (s, ev) => { - repliedRecently = false; - t.Stop(); - t.Dispose(); - }; - } + catch { } } } }