From 468f0402eda5a193edc6dd861573646dc01d8ecc Mon Sep 17 00:00:00 2001 From: Zeptaxis Date: Sat, 27 Aug 2016 13:37:33 +0200 Subject: [PATCH 1/9] Updating unclear instructions with tmux I had to google because I thought the Ctrl+B+D thing wasnt' working, so I propose this small update to make it more clear that you need to press Ctrl+B and then D and not all at the same time. --- LinuxSetup.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LinuxSetup.md b/LinuxSetup.md index 0272affc..6446c7ac 100644 --- a/LinuxSetup.md +++ b/LinuxSetup.md @@ -227,7 +227,7 @@ Type/ Copy and hit **Enter**. **CHECK THE BOT IN DISCORD, IF EVERYTHING IS WORKING** -Now time to **move bot to background** and to do that, press **CTRL+B+D** (this will ditach the nadeko session using TMUX), and you can finally close PuTTY now. +Now time to **move bot to background** and to do that, press **CTRL+B**,release and press **D** (this will ditach the nadeko session using TMUX), and you can finally close PuTTY now. Copy your CLIENT ID (that's in the same Developer page where you brought your token) and replace `12345678` in this link: `https://discordapp.com/oauth2/authorize?client_id=12345678&scope=bot&permissions=66186303` with it. Go to that link and you will be able to add your bot to your server. @@ -256,7 +256,7 @@ Open **PuTTY** and login as you have before, type `reboot` and hit Enter. - **-18** - **-20** -HIT **CTRL+B+D** and close **PuTTY** +HIT **CTRL+B**,release, press **D** and close **PuTTY** `IF YOU FACE ANY TROUBLE ANYWHERE IN THE GUIDE JUST FIND US IN NADEKO'S DISCORD SERVER` From 9e2b2d4a306d271aec63a8a5291d6ddef77865ef Mon Sep 17 00:00:00 2001 From: Zeptaxis Date: Sat, 27 Aug 2016 14:48:07 +0200 Subject: [PATCH 2/9] fixed a typo --- LinuxSetup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LinuxSetup.md b/LinuxSetup.md index 6446c7ac..48704088 100644 --- a/LinuxSetup.md +++ b/LinuxSetup.md @@ -227,7 +227,7 @@ Type/ Copy and hit **Enter**. **CHECK THE BOT IN DISCORD, IF EVERYTHING IS WORKING** -Now time to **move bot to background** and to do that, press **CTRL+B**,release and press **D** (this will ditach the nadeko session using TMUX), and you can finally close PuTTY now. +Now time to **move bot to background** and to do that, press **CTRL+B**,release and press **D** (this will detach the nadeko session using TMUX), and you can finally close PuTTY now. Copy your CLIENT ID (that's in the same Developer page where you brought your token) and replace `12345678` in this link: `https://discordapp.com/oauth2/authorize?client_id=12345678&scope=bot&permissions=66186303` with it. Go to that link and you will be able to add your bot to your server. From 7cad5c47b4284af086ab4b8915bfac6eabb76634 Mon Sep 17 00:00:00 2001 From: miraai Date: Mon, 29 Aug 2016 01:17:45 +0200 Subject: [PATCH 3/9] Fixed a spelling mistake --- docs/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index e2ba4343..84cdb82e 100644 --- a/docs/index.md +++ b/docs/index.md @@ -24,7 +24,7 @@ If you want to contribute, be sure to PR on the **[dev][dev]** branch. - [Commands List](Commands List.md) - [Permissions System](Permissions System.md) - [JSON Explanations](JSON Explanations.md) -- [Custiom Reactions](Custom Reactions.md) +- [Custom Reactions](Custom Reactions.md) - [Frequently Asked Questions](Frequently Asked Questions.md) - [Contribution Guide](Contribution Guide.md) - [Donate](Donate.md) From 022da6bee5fccb08f20a03fe1b1026d4e8d25864 Mon Sep 17 00:00:00 2001 From: ritsu Date: Mon, 29 Aug 2016 10:21:47 -0400 Subject: [PATCH 4/9] Fix typo in docs for Installing Mono on CentOS --- LinuxSetup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LinuxSetup.md b/LinuxSetup.md index 48704088..39acd7be 100644 --- a/LinuxSetup.md +++ b/LinuxSetup.md @@ -48,7 +48,7 @@ Note if the command is not being initiated, hit **Enter** **2.6)** *ONLY CentOS 7, Fedora 19 (and later)* -`yum install yum-util` +`yum install yum-utils` `rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF"` From 9a8829eb12b1d351aa66de0fdfbad92a84da5efb Mon Sep 17 00:00:00 2001 From: Kwoth Date: Mon, 5 Sep 2016 21:17:03 +0200 Subject: [PATCH 5/9] fix serverinfo emojis --- NadekoBot/Modules/Utility/Commands/InfoCommands.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NadekoBot/Modules/Utility/Commands/InfoCommands.cs b/NadekoBot/Modules/Utility/Commands/InfoCommands.cs index da1bcd0c..4a19b990 100644 --- a/NadekoBot/Modules/Utility/Commands/InfoCommands.cs +++ b/NadekoBot/Modules/Utility/Commands/InfoCommands.cs @@ -39,7 +39,7 @@ namespace NadekoBot.Modules.Utility.Commands sb.AppendLine($"`Roles:` **{server.Roles.Count()}**"); sb.AppendLine($"`Created At:` **{createdAt}**"); if (server.CustomEmojis.Count() > 0) - sb.AppendLine($"`Custom Emojis:` **{string.Join(", ", server.CustomEmojis)}**"); + sb.AppendLine($"`Custom Emojis:` **{string.Join(", ", server.CustomEmojis.Select(em => em.Name))}**"); if (server.Features.Count() > 0) sb.AppendLine($"`Features:` **{string.Join(", ", server.Features)}**"); if (!string.IsNullOrWhiteSpace(server.SplashId)) From 3e06c647658c3779aebce9e51b42b86087f4756c Mon Sep 17 00:00:00 2001 From: Kwoth Date: Mon, 5 Sep 2016 21:17:19 +0200 Subject: [PATCH 6/9] Added patreon reward custom reactions --- NadekoBot/_Models/JSONModels/Configuration.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/NadekoBot/_Models/JSONModels/Configuration.cs b/NadekoBot/_Models/JSONModels/Configuration.cs index 04a4895e..e01da5cf 100644 --- a/NadekoBot/_Models/JSONModels/Configuration.cs +++ b/NadekoBot/_Models/JSONModels/Configuration.cs @@ -90,6 +90,15 @@ namespace NadekoBot.Classes.JSONModels } }, { "%mention% archer", new List() { "http://i.imgur.com/Bha9NhL.jpg" + } }, + { "%mention% formuoli", new List() { + "http://i.imgur.com/sCHYQhl.jpg" + } }, + { "%mention% mei", new List() { + "http://i.imgur.com/Xkrf5y7.png" + } }, + { "%mention% omega yato", new List() { + "https://cdn.discordapp.com/attachments/168617088892534784/221047921410310144/Yato_Animated.gif" } } }; From d8182a663a9979bde9f42d2c8d837b6f6133b515 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Mon, 5 Sep 2016 21:19:08 +0200 Subject: [PATCH 7/9] Streams have 60 second delay after starting up, refresh every 60 seconds --- .../Modules/Searches/Commands/StreamNotifications.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/NadekoBot/Modules/Searches/Commands/StreamNotifications.cs b/NadekoBot/Modules/Searches/Commands/StreamNotifications.cs index 153c48db..1513d0e7 100644 --- a/NadekoBot/Modules/Searches/Commands/StreamNotifications.cs +++ b/NadekoBot/Modules/Searches/Commands/StreamNotifications.cs @@ -18,8 +18,11 @@ namespace NadekoBot.Modules.Searches.Commands public StreamNotifications(DiscordModule module) : base(module) { //start checking only after ready, because we need all servers to be initialized - NadekoBot.OnReady += () => Task.Run(async () => + NadekoBot.OnReady += () => { + Task.Run(async () => + { + await Task.Delay(60000); while (true) { cachedStatuses.Clear(); @@ -80,12 +83,13 @@ namespace NadekoBot.Modules.Searches.Commands catch { } finally { - await Task.Delay(TimeSpan.FromSeconds(15)); + await Task.Delay(TimeSpan.FromSeconds(60)); } } }); - } + }; + } private async Task> GetStreamStatus(StreamNotificationConfig stream, bool checkCache = true) { bool isLive; From 55221b7bf5c78d9f71045f9624388c7a0cebd1e0 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Mon, 5 Sep 2016 21:34:59 +0200 Subject: [PATCH 8/9] cleanup --- NadekoBot/Classes/ServerSpecificConfig.cs | 2 +- .../Administration/Commands/LogCommand.cs | 55 ++++++++++--------- .../ClashOfClans/ClashOfClansModule.cs | 5 +- .../Permissions/Classes/PermissionChecker.cs | 19 ++++--- .../Permissions/Classes/PermissionsHandler.cs | 12 ++-- 5 files changed, 52 insertions(+), 41 deletions(-) diff --git a/NadekoBot/Classes/ServerSpecificConfig.cs b/NadekoBot/Classes/ServerSpecificConfig.cs index c2680e4a..1642f75e 100644 --- a/NadekoBot/Classes/ServerSpecificConfig.cs +++ b/NadekoBot/Classes/ServerSpecificConfig.cs @@ -278,7 +278,7 @@ namespace NadekoBot.Classes } public bool Equals(StreamNotificationConfig other) => - this.Username.ToLower().Trim() == other.Username.ToLower().Trim() && + this.Username.ToUpperInvariant().Trim() == other.Username.ToUpperInvariant().Trim() && this.Type == other.Type && this.ServerId == other.ServerId; diff --git a/NadekoBot/Modules/Administration/Commands/LogCommand.cs b/NadekoBot/Modules/Administration/Commands/LogCommand.cs index 5956840c..87a0723e 100644 --- a/NadekoBot/Modules/Administration/Commands/LogCommand.cs +++ b/NadekoBot/Modules/Administration/Commands/LogCommand.cs @@ -56,33 +56,36 @@ namespace NadekoBot.Modules.Administration.Commands // start the userpresence queue - NadekoBot.OnReady += () => Task.Run(async () => - { - while (true) - { - var toSend = new Dictionary(); - //take everything from the queue and merge the messages which are going to the same channel - KeyValuePair item; - while (voicePresenceUpdates.TryTake(out item)) - { - if (toSend.ContainsKey(item.Key)) - { - toSend[item.Key] = toSend[item.Key] + Environment.NewLine + item.Value; - } - else - { - toSend.Add(item.Key, item.Value); - } - } - //send merged messages to each channel - foreach (var k in toSend) - { - try { await k.Key.SendMessage(Environment.NewLine + k.Value).ConfigureAwait(false); } catch { } - } + NadekoBot.OnReady += () => + { + Task.Run(async () => + { + while (true) + { + var toSend = new Dictionary(); + //take everything from the queue and merge the messages which are going to the same channel + KeyValuePair item; + while (voicePresenceUpdates.TryTake(out item)) + { + if (toSend.ContainsKey(item.Key)) + { + toSend[item.Key] = toSend[item.Key] + Environment.NewLine + item.Value; + } + else + { + toSend.Add(item.Key, item.Value); + } + } + //send merged messages to each channel + foreach (var k in toSend) + { + try { await k.Key.SendMessage(Environment.NewLine + k.Value).ConfigureAwait(false); } catch { } + } - await Task.Delay(5000); - } - }); + await Task.Delay(5000); + } + }); + }; } private async void ChannelUpdated(object sender, ChannelUpdatedEventArgs e) diff --git a/NadekoBot/Modules/ClashOfClans/ClashOfClansModule.cs b/NadekoBot/Modules/ClashOfClans/ClashOfClansModule.cs index e14e48b4..07db4f98 100644 --- a/NadekoBot/Modules/ClashOfClans/ClashOfClansModule.cs +++ b/NadekoBot/Modules/ClashOfClans/ClashOfClansModule.cs @@ -23,7 +23,9 @@ namespace NadekoBot.Modules.ClashOfClans public ClashOfClansModule() { - NadekoBot.OnReady += () => Task.Run(async () => + NadekoBot.OnReady += () => + { + Task.Run(async () => { if (File.Exists("data/clashofclans/wars.json")) { @@ -109,6 +111,7 @@ namespace NadekoBot.Modules.ClashOfClans await Task.Delay(5000); } }); + }; } private static void Save() diff --git a/NadekoBot/Modules/Permissions/Classes/PermissionChecker.cs b/NadekoBot/Modules/Permissions/Classes/PermissionChecker.cs index 0c6aa79b..53c874c1 100644 --- a/NadekoBot/Modules/Permissions/Classes/PermissionChecker.cs +++ b/NadekoBot/Modules/Permissions/Classes/PermissionChecker.cs @@ -4,7 +4,6 @@ using Discord.Commands.Permissions; using NadekoBot.Classes.JSONModels; using System; using System.Collections.Concurrent; -using System.Collections.Generic; using System.Threading.Tasks; namespace NadekoBot.Modules.Permissions.Classes @@ -14,10 +13,8 @@ namespace NadekoBot.Modules.Permissions.Classes { public static PermissionChecker Instance { get; } = new PermissionChecker(); - //key - sid:command - //value - userid private ConcurrentDictionary commandCooldowns = new ConcurrentDictionary(); - private HashSet timeBlackList { get; } = new HashSet(); + private ConcurrentDictionary timeBlackList { get; } = new ConcurrentDictionary(); static PermissionChecker() { } private PermissionChecker() @@ -26,7 +23,6 @@ namespace NadekoBot.Modules.Permissions.Classes { while (true) { - //blacklist is cleared every 1.00 seconds. That is the most time anyone will be blocked await Task.Delay(1000).ConfigureAwait(false); timeBlackList.Clear(); } @@ -43,21 +39,28 @@ namespace NadekoBot.Modules.Permissions.Classes if (channel.IsPrivate || channel.Server == null) return command.Category == "Help"; + if (user == null) + return false; + if (ConfigHandler.IsUserBlacklisted(user.Id) || (!channel.IsPrivate && (ConfigHandler.IsServerBlacklisted(channel.Server.Id) || ConfigHandler.IsChannelBlacklisted(channel.Id)))) { return false; } - if (timeBlackList.Contains(user.Id)) - return false; + try + { + if (timeBlackList.ContainsKey(user.Id)) + return false; + } + catch { return false; } if (!channel.IsPrivate && !channel.Server.CurrentUser.GetPermissions(channel).SendMessages) { return false; } - timeBlackList.Add(user.Id); + timeBlackList.TryAdd(user.Id, true); ServerPermissions perms; PermissionsHandler.PermissionsDict.TryGetValue(user.Server.Id, out perms); diff --git a/NadekoBot/Modules/Permissions/Classes/PermissionsHandler.cs b/NadekoBot/Modules/Permissions/Classes/PermissionsHandler.cs index d7c9e784..9c00c7c6 100644 --- a/NadekoBot/Modules/Permissions/Classes/PermissionsHandler.cs +++ b/NadekoBot/Modules/Permissions/Classes/PermissionsHandler.cs @@ -22,7 +22,7 @@ namespace NadekoBot.Modules.Permissions.Classes } - public static void Initialize() + public static Task Initialize() => Task.Run(() => { Console.WriteLine("Reading from the permission files."); Directory.CreateDirectory("data/permissions"); @@ -39,7 +39,7 @@ namespace NadekoBot.Modules.Permissions.Classes catch { } } Console.WriteLine("Permission initialization complete."); - } + }); internal static Permissions GetRolePermissionsById(Server server, ulong id) { @@ -157,7 +157,7 @@ namespace NadekoBot.Modules.Permissions.Classes Newtonsoft.Json.JsonConvert.SerializeObject(serverPerms, Newtonsoft.Json.Formatting.Indented)); }); - public static Task WriteToJson() => Task.Run(() => + public static Task WriteToJson() => Task.Run(() => { Directory.CreateDirectory("data/permissions/"); foreach (var kvp in PermissionsDict) @@ -428,11 +428,13 @@ namespace NadekoBot.Modules.Permissions.Classes { var serverPerms = PermissionsDict.GetOrAdd(server.Id, new ServerPermissions(server.Id, server.Name)); - if (value == 0) { + if (value == 0) + { int throwaway; serverPerms.CommandCooldowns.TryRemove(commandName, out throwaway); } - else { + else + { serverPerms.CommandCooldowns.AddOrUpdate(commandName, value, (str, v) => value); } From 267a04cc25370d2840e078644743f2383c147ed0 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Mon, 5 Sep 2016 22:26:01 +0200 Subject: [PATCH 9/9] Some changes to make nadeko survive until 1.0 --- NadekoBot.sln | 64 +++++++++++++++++++++--------------------- NadekoBot/NadekoBot.cs | 28 +++++++++++++----- discord.net | 2 +- 3 files changed, 54 insertions(+), 40 deletions(-) diff --git a/NadekoBot.sln b/NadekoBot.sln index eb9860d0..d41210c6 100644 --- a/NadekoBot.sln +++ b/NadekoBot.sln @@ -49,68 +49,68 @@ Global {27A886F5-CDDA-4F4A-81EE-6DAFCCE9DE46}.Release|x64.Build.0 = Release|x64 {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Debug|x64.ActiveCfg = Debug|x64 - {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Debug|x64.Build.0 = Debug|x64 + {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Debug|x64.ActiveCfg = Debug|Any CPU + {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Debug|x64.Build.0 = Debug|Any CPU {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.FullDebug|Any CPU.ActiveCfg = Debug|Any CPU {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.FullDebug|Any CPU.Build.0 = Debug|Any CPU - {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.FullDebug|x64.ActiveCfg = Debug|x64 - {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.FullDebug|x64.Build.0 = Debug|x64 + {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.FullDebug|x64.ActiveCfg = Debug|Any CPU + {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.FullDebug|x64.Build.0 = Debug|Any CPU {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.NadekoRelease|Any CPU.ActiveCfg = Release|Any CPU {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.NadekoRelease|Any CPU.Build.0 = Release|Any CPU - {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.NadekoRelease|x64.ActiveCfg = Release|x64 - {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.NadekoRelease|x64.Build.0 = Release|x64 + {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.NadekoRelease|x64.ActiveCfg = Release|Any CPU + {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.NadekoRelease|x64.Build.0 = Release|Any CPU {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Release|Any CPU.ActiveCfg = Release|Any CPU {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Release|Any CPU.Build.0 = Release|Any CPU - {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Release|x64.ActiveCfg = Release|x64 - {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Release|x64.Build.0 = Release|x64 + {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Release|x64.ActiveCfg = Release|Any CPU + {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Release|x64.Build.0 = Release|Any CPU {8D71A857-879A-4A10-859E-5FF824ED6688}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8D71A857-879A-4A10-859E-5FF824ED6688}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8D71A857-879A-4A10-859E-5FF824ED6688}.Debug|x64.ActiveCfg = Debug|x64 - {8D71A857-879A-4A10-859E-5FF824ED6688}.Debug|x64.Build.0 = Debug|x64 + {8D71A857-879A-4A10-859E-5FF824ED6688}.Debug|x64.ActiveCfg = Debug|Any CPU + {8D71A857-879A-4A10-859E-5FF824ED6688}.Debug|x64.Build.0 = Debug|Any CPU {8D71A857-879A-4A10-859E-5FF824ED6688}.FullDebug|Any CPU.ActiveCfg = Debug|Any CPU {8D71A857-879A-4A10-859E-5FF824ED6688}.FullDebug|Any CPU.Build.0 = Debug|Any CPU - {8D71A857-879A-4A10-859E-5FF824ED6688}.FullDebug|x64.ActiveCfg = Debug|x64 - {8D71A857-879A-4A10-859E-5FF824ED6688}.FullDebug|x64.Build.0 = Debug|x64 + {8D71A857-879A-4A10-859E-5FF824ED6688}.FullDebug|x64.ActiveCfg = Debug|Any CPU + {8D71A857-879A-4A10-859E-5FF824ED6688}.FullDebug|x64.Build.0 = Debug|Any CPU {8D71A857-879A-4A10-859E-5FF824ED6688}.NadekoRelease|Any CPU.ActiveCfg = Release|Any CPU {8D71A857-879A-4A10-859E-5FF824ED6688}.NadekoRelease|Any CPU.Build.0 = Release|Any CPU - {8D71A857-879A-4A10-859E-5FF824ED6688}.NadekoRelease|x64.ActiveCfg = Release|x64 - {8D71A857-879A-4A10-859E-5FF824ED6688}.NadekoRelease|x64.Build.0 = Release|x64 + {8D71A857-879A-4A10-859E-5FF824ED6688}.NadekoRelease|x64.ActiveCfg = Release|Any CPU + {8D71A857-879A-4A10-859E-5FF824ED6688}.NadekoRelease|x64.Build.0 = Release|Any CPU {8D71A857-879A-4A10-859E-5FF824ED6688}.Release|Any CPU.ActiveCfg = Release|Any CPU {8D71A857-879A-4A10-859E-5FF824ED6688}.Release|Any CPU.Build.0 = Release|Any CPU - {8D71A857-879A-4A10-859E-5FF824ED6688}.Release|x64.ActiveCfg = Release|x64 - {8D71A857-879A-4A10-859E-5FF824ED6688}.Release|x64.Build.0 = Release|x64 + {8D71A857-879A-4A10-859E-5FF824ED6688}.Release|x64.ActiveCfg = Release|Any CPU + {8D71A857-879A-4A10-859E-5FF824ED6688}.Release|x64.Build.0 = Release|Any CPU {3091164F-66AE-4543-A63D-167C1116241D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3091164F-66AE-4543-A63D-167C1116241D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3091164F-66AE-4543-A63D-167C1116241D}.Debug|x64.ActiveCfg = Debug|x64 - {3091164F-66AE-4543-A63D-167C1116241D}.Debug|x64.Build.0 = Debug|x64 + {3091164F-66AE-4543-A63D-167C1116241D}.Debug|x64.ActiveCfg = Debug|Any CPU + {3091164F-66AE-4543-A63D-167C1116241D}.Debug|x64.Build.0 = Debug|Any CPU {3091164F-66AE-4543-A63D-167C1116241D}.FullDebug|Any CPU.ActiveCfg = Debug|Any CPU {3091164F-66AE-4543-A63D-167C1116241D}.FullDebug|Any CPU.Build.0 = Debug|Any CPU - {3091164F-66AE-4543-A63D-167C1116241D}.FullDebug|x64.ActiveCfg = Debug|x64 - {3091164F-66AE-4543-A63D-167C1116241D}.FullDebug|x64.Build.0 = Debug|x64 + {3091164F-66AE-4543-A63D-167C1116241D}.FullDebug|x64.ActiveCfg = Debug|Any CPU + {3091164F-66AE-4543-A63D-167C1116241D}.FullDebug|x64.Build.0 = Debug|Any CPU {3091164F-66AE-4543-A63D-167C1116241D}.NadekoRelease|Any CPU.ActiveCfg = Release|Any CPU {3091164F-66AE-4543-A63D-167C1116241D}.NadekoRelease|Any CPU.Build.0 = Release|Any CPU - {3091164F-66AE-4543-A63D-167C1116241D}.NadekoRelease|x64.ActiveCfg = Release|x64 - {3091164F-66AE-4543-A63D-167C1116241D}.NadekoRelease|x64.Build.0 = Release|x64 + {3091164F-66AE-4543-A63D-167C1116241D}.NadekoRelease|x64.ActiveCfg = Release|Any CPU + {3091164F-66AE-4543-A63D-167C1116241D}.NadekoRelease|x64.Build.0 = Release|Any CPU {3091164F-66AE-4543-A63D-167C1116241D}.Release|Any CPU.ActiveCfg = Release|Any CPU {3091164F-66AE-4543-A63D-167C1116241D}.Release|Any CPU.Build.0 = Release|Any CPU - {3091164F-66AE-4543-A63D-167C1116241D}.Release|x64.ActiveCfg = Release|x64 - {3091164F-66AE-4543-A63D-167C1116241D}.Release|x64.Build.0 = Release|x64 + {3091164F-66AE-4543-A63D-167C1116241D}.Release|x64.ActiveCfg = Release|Any CPU + {3091164F-66AE-4543-A63D-167C1116241D}.Release|x64.Build.0 = Release|Any CPU {1B5603B4-6F8F-4289-B945-7BAAE523D740}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1B5603B4-6F8F-4289-B945-7BAAE523D740}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1B5603B4-6F8F-4289-B945-7BAAE523D740}.Debug|x64.ActiveCfg = Debug|x64 - {1B5603B4-6F8F-4289-B945-7BAAE523D740}.Debug|x64.Build.0 = Debug|x64 + {1B5603B4-6F8F-4289-B945-7BAAE523D740}.Debug|x64.ActiveCfg = Debug|Any CPU + {1B5603B4-6F8F-4289-B945-7BAAE523D740}.Debug|x64.Build.0 = Debug|Any CPU {1B5603B4-6F8F-4289-B945-7BAAE523D740}.FullDebug|Any CPU.ActiveCfg = Debug|Any CPU {1B5603B4-6F8F-4289-B945-7BAAE523D740}.FullDebug|Any CPU.Build.0 = Debug|Any CPU - {1B5603B4-6F8F-4289-B945-7BAAE523D740}.FullDebug|x64.ActiveCfg = Debug|x64 - {1B5603B4-6F8F-4289-B945-7BAAE523D740}.FullDebug|x64.Build.0 = Debug|x64 + {1B5603B4-6F8F-4289-B945-7BAAE523D740}.FullDebug|x64.ActiveCfg = Debug|Any CPU + {1B5603B4-6F8F-4289-B945-7BAAE523D740}.FullDebug|x64.Build.0 = Debug|Any CPU {1B5603B4-6F8F-4289-B945-7BAAE523D740}.NadekoRelease|Any CPU.ActiveCfg = Release|Any CPU {1B5603B4-6F8F-4289-B945-7BAAE523D740}.NadekoRelease|Any CPU.Build.0 = Release|Any CPU - {1B5603B4-6F8F-4289-B945-7BAAE523D740}.NadekoRelease|x64.ActiveCfg = Release|x64 - {1B5603B4-6F8F-4289-B945-7BAAE523D740}.NadekoRelease|x64.Build.0 = Release|x64 + {1B5603B4-6F8F-4289-B945-7BAAE523D740}.NadekoRelease|x64.ActiveCfg = Release|Any CPU + {1B5603B4-6F8F-4289-B945-7BAAE523D740}.NadekoRelease|x64.Build.0 = Release|Any CPU {1B5603B4-6F8F-4289-B945-7BAAE523D740}.Release|Any CPU.ActiveCfg = Release|Any CPU {1B5603B4-6F8F-4289-B945-7BAAE523D740}.Release|Any CPU.Build.0 = Release|Any CPU - {1B5603B4-6F8F-4289-B945-7BAAE523D740}.Release|x64.ActiveCfg = Release|x64 - {1B5603B4-6F8F-4289-B945-7BAAE523D740}.Release|x64.Build.0 = Release|x64 + {1B5603B4-6F8F-4289-B945-7BAAE523D740}.Release|x64.ActiveCfg = Release|Any CPU + {1B5603B4-6F8F-4289-B945-7BAAE523D740}.Release|x64.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/NadekoBot/NadekoBot.cs b/NadekoBot/NadekoBot.cs index 829fc263..a66de25d 100644 --- a/NadekoBot/NadekoBot.cs +++ b/NadekoBot/NadekoBot.cs @@ -2,6 +2,7 @@ using Discord.Audio; using Discord.Commands; using Discord.Modules; +using NadekoBot.Classes; using NadekoBot.Classes.Help.Commands; using NadekoBot.Classes.JSONModels; using NadekoBot.Modules.Administration; @@ -117,7 +118,7 @@ namespace NadekoBot Client = new DiscordClient(new DiscordConfigBuilder() { MessageCacheSize = 10, - ConnectionTimeout = 200000, + ConnectionTimeout = int.MaxValue, LogLevel = LogSeverity.Warning, LogHandler = (s, e) => Console.WriteLine($"Severity: {e.Severity}" + @@ -145,9 +146,6 @@ namespace NadekoBot } }); - //reply to personal messages and forward if enabled. - Client.MessageReceived += Client_MessageReceived; - //add command service Client.AddService(commandService); @@ -185,9 +183,18 @@ namespace NadekoBot //run the bot Client.ExecuteAndWait(async () => { + await Task.Run(() => + { + Console.WriteLine("Specific config started initializing."); + var x = SpecificConfigurations.Default; + Console.WriteLine("Specific config done initializing."); + }); + + await PermissionsHandler.Initialize(); + try { - await Client.Connect(Creds.Token).ConfigureAwait(false); + await Client.Connect(Creds.Token, TokenType.Bot).ConfigureAwait(false); } catch (Exception ex) { @@ -197,7 +204,7 @@ namespace NadekoBot return; } #if NADEKO_RELEASE - await Task.Delay(180000).ConfigureAwait(false); + await Task.Delay(220000).ConfigureAwait(false); #else await Task.Delay(1000).ConfigureAwait(false); #endif @@ -232,11 +239,18 @@ namespace NadekoBot Client.ClientAPI.SentRequest += (s, e) => { Console.WriteLine($"[Request of type {e.Request.GetType()} sent in {e.Milliseconds}]"); + + var request = e.Request as Discord.API.Client.Rest.SendMessageRequest; + if (request == null) return; + + Console.WriteLine($"[Content: { request.Content }"); }; #endif - PermissionsHandler.Initialize(); NadekoBot.Ready = true; NadekoBot.OnReady(); + Console.WriteLine("Ready!"); + //reply to personal messages and forward if enabled. + Client.MessageReceived += Client_MessageReceived; }); Console.WriteLine("Exiting..."); Console.ReadKey(); diff --git a/discord.net b/discord.net index f90cf4ae..f7655320 160000 --- a/discord.net +++ b/discord.net @@ -1 +1 @@ -Subproject commit f90cf4ae5c9fd3c049663f46dcbf366412caba8b +Subproject commit f7655320bc2b90ddb8bc9d17ae999aa76e9f5f38