Merge pull request #1 from Kwoth/dev

Dev
This commit is contained in:
miraai 2016-09-13 15:11:37 +02:00 committed by GitHub
commit f415529c8d
13 changed files with 127 additions and 89 deletions

View File

@ -48,7 +48,7 @@ Note if the command is not being initiated, hit **Enter**
**2.6)** **2.6)**
*ONLY CentOS 7, Fedora 19 (and later)* *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"` `rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF"`
@ -227,7 +227,7 @@ Type/ Copy and hit **Enter**.
**CHECK THE BOT IN DISCORD, IF EVERYTHING IS WORKING** **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 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. 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** - **-18**
- **-20** - **-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` `IF YOU FACE ANY TROUBLE ANYWHERE IN THE GUIDE JUST FIND US IN NADEKO'S DISCORD SERVER`

View File

@ -49,68 +49,68 @@ Global
{27A886F5-CDDA-4F4A-81EE-6DAFCCE9DE46}.Release|x64.Build.0 = Release|x64 {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.ActiveCfg = Debug|Any CPU
{7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Debug|Any CPU.Build.0 = 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.ActiveCfg = Debug|Any CPU
{7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Debug|x64.Build.0 = Debug|x64 {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.ActiveCfg = Debug|Any CPU
{7BFEF748-B934-4621-9B11-6302E3A9F6B3}.FullDebug|Any CPU.Build.0 = 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.ActiveCfg = Debug|Any CPU
{7BFEF748-B934-4621-9B11-6302E3A9F6B3}.FullDebug|x64.Build.0 = Debug|x64 {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.ActiveCfg = Release|Any CPU
{7BFEF748-B934-4621-9B11-6302E3A9F6B3}.NadekoRelease|Any CPU.Build.0 = 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.ActiveCfg = Release|Any CPU
{7BFEF748-B934-4621-9B11-6302E3A9F6B3}.NadekoRelease|x64.Build.0 = Release|x64 {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.ActiveCfg = Release|Any CPU
{7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Release|Any CPU.Build.0 = 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.ActiveCfg = Release|Any CPU
{7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Release|x64.Build.0 = Release|x64 {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.ActiveCfg = Debug|Any CPU
{8D71A857-879A-4A10-859E-5FF824ED6688}.Debug|Any CPU.Build.0 = 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.ActiveCfg = Debug|Any CPU
{8D71A857-879A-4A10-859E-5FF824ED6688}.Debug|x64.Build.0 = Debug|x64 {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.ActiveCfg = Debug|Any CPU
{8D71A857-879A-4A10-859E-5FF824ED6688}.FullDebug|Any CPU.Build.0 = 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.ActiveCfg = Debug|Any CPU
{8D71A857-879A-4A10-859E-5FF824ED6688}.FullDebug|x64.Build.0 = Debug|x64 {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.ActiveCfg = Release|Any CPU
{8D71A857-879A-4A10-859E-5FF824ED6688}.NadekoRelease|Any CPU.Build.0 = 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.ActiveCfg = Release|Any CPU
{8D71A857-879A-4A10-859E-5FF824ED6688}.NadekoRelease|x64.Build.0 = Release|x64 {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.ActiveCfg = Release|Any CPU
{8D71A857-879A-4A10-859E-5FF824ED6688}.Release|Any CPU.Build.0 = 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.ActiveCfg = Release|Any CPU
{8D71A857-879A-4A10-859E-5FF824ED6688}.Release|x64.Build.0 = Release|x64 {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.ActiveCfg = Debug|Any CPU
{3091164F-66AE-4543-A63D-167C1116241D}.Debug|Any CPU.Build.0 = 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.ActiveCfg = Debug|Any CPU
{3091164F-66AE-4543-A63D-167C1116241D}.Debug|x64.Build.0 = Debug|x64 {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.ActiveCfg = Debug|Any CPU
{3091164F-66AE-4543-A63D-167C1116241D}.FullDebug|Any CPU.Build.0 = 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.ActiveCfg = Debug|Any CPU
{3091164F-66AE-4543-A63D-167C1116241D}.FullDebug|x64.Build.0 = Debug|x64 {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.ActiveCfg = Release|Any CPU
{3091164F-66AE-4543-A63D-167C1116241D}.NadekoRelease|Any CPU.Build.0 = 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.ActiveCfg = Release|Any CPU
{3091164F-66AE-4543-A63D-167C1116241D}.NadekoRelease|x64.Build.0 = Release|x64 {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.ActiveCfg = Release|Any CPU
{3091164F-66AE-4543-A63D-167C1116241D}.Release|Any CPU.Build.0 = 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.ActiveCfg = Release|Any CPU
{3091164F-66AE-4543-A63D-167C1116241D}.Release|x64.Build.0 = Release|x64 {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.ActiveCfg = Debug|Any CPU
{1B5603B4-6F8F-4289-B945-7BAAE523D740}.Debug|Any CPU.Build.0 = 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.ActiveCfg = Debug|Any CPU
{1B5603B4-6F8F-4289-B945-7BAAE523D740}.Debug|x64.Build.0 = Debug|x64 {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.ActiveCfg = Debug|Any CPU
{1B5603B4-6F8F-4289-B945-7BAAE523D740}.FullDebug|Any CPU.Build.0 = 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.ActiveCfg = Debug|Any CPU
{1B5603B4-6F8F-4289-B945-7BAAE523D740}.FullDebug|x64.Build.0 = Debug|x64 {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.ActiveCfg = Release|Any CPU
{1B5603B4-6F8F-4289-B945-7BAAE523D740}.NadekoRelease|Any CPU.Build.0 = 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.ActiveCfg = Release|Any CPU
{1B5603B4-6F8F-4289-B945-7BAAE523D740}.NadekoRelease|x64.Build.0 = Release|x64 {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.ActiveCfg = Release|Any CPU
{1B5603B4-6F8F-4289-B945-7BAAE523D740}.Release|Any CPU.Build.0 = 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.ActiveCfg = Release|Any CPU
{1B5603B4-6F8F-4289-B945-7BAAE523D740}.Release|x64.Build.0 = Release|x64 {1B5603B4-6F8F-4289-B945-7BAAE523D740}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -278,7 +278,7 @@ namespace NadekoBot.Classes
} }
public bool Equals(StreamNotificationConfig other) => 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.Type == other.Type &&
this.ServerId == other.ServerId; this.ServerId == other.ServerId;

View File

@ -56,33 +56,36 @@ namespace NadekoBot.Modules.Administration.Commands
// start the userpresence queue // start the userpresence queue
NadekoBot.OnReady += () => Task.Run(async () => NadekoBot.OnReady += () =>
{ {
while (true) Task.Run(async () =>
{ {
var toSend = new Dictionary<Channel, string>(); while (true)
//take everything from the queue and merge the messages which are going to the same channel {
KeyValuePair<Channel, string> item; var toSend = new Dictionary<Channel, string>();
while (voicePresenceUpdates.TryTake(out item)) //take everything from the queue and merge the messages which are going to the same channel
{ KeyValuePair<Channel, string> item;
if (toSend.ContainsKey(item.Key)) while (voicePresenceUpdates.TryTake(out item))
{ {
toSend[item.Key] = toSend[item.Key] + Environment.NewLine + item.Value; if (toSend.ContainsKey(item.Key))
} {
else toSend[item.Key] = toSend[item.Key] + Environment.NewLine + item.Value;
{ }
toSend.Add(item.Key, item.Value); else
} {
} toSend.Add(item.Key, item.Value);
//send merged messages to each channel }
foreach (var k in toSend) }
{ //send merged messages to each channel
try { await k.Key.SendMessage(Environment.NewLine + k.Value).ConfigureAwait(false); } catch { } 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) private async void ChannelUpdated(object sender, ChannelUpdatedEventArgs e)

View File

@ -23,7 +23,9 @@ namespace NadekoBot.Modules.ClashOfClans
public ClashOfClansModule() public ClashOfClansModule()
{ {
NadekoBot.OnReady += () => Task.Run(async () => NadekoBot.OnReady += () =>
{
Task.Run(async () =>
{ {
if (File.Exists("data/clashofclans/wars.json")) if (File.Exists("data/clashofclans/wars.json"))
{ {
@ -109,6 +111,7 @@ namespace NadekoBot.Modules.ClashOfClans
await Task.Delay(5000); await Task.Delay(5000);
} }
}); });
};
} }
private static void Save() private static void Save()

View File

@ -4,7 +4,6 @@ using Discord.Commands.Permissions;
using NadekoBot.Classes.JSONModels; using NadekoBot.Classes.JSONModels;
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace NadekoBot.Modules.Permissions.Classes namespace NadekoBot.Modules.Permissions.Classes
@ -14,10 +13,8 @@ namespace NadekoBot.Modules.Permissions.Classes
{ {
public static PermissionChecker Instance { get; } = new PermissionChecker(); public static PermissionChecker Instance { get; } = new PermissionChecker();
//key - sid:command
//value - userid
private ConcurrentDictionary<string, ulong> commandCooldowns = new ConcurrentDictionary<string, ulong>(); private ConcurrentDictionary<string, ulong> commandCooldowns = new ConcurrentDictionary<string, ulong>();
private HashSet<ulong> timeBlackList { get; } = new HashSet<ulong>(); private ConcurrentDictionary<ulong, bool> timeBlackList { get; } = new ConcurrentDictionary<ulong, bool>();
static PermissionChecker() { } static PermissionChecker() { }
private PermissionChecker() private PermissionChecker()
@ -26,7 +23,6 @@ namespace NadekoBot.Modules.Permissions.Classes
{ {
while (true) while (true)
{ {
//blacklist is cleared every 1.00 seconds. That is the most time anyone will be blocked
await Task.Delay(1000).ConfigureAwait(false); await Task.Delay(1000).ConfigureAwait(false);
timeBlackList.Clear(); timeBlackList.Clear();
} }
@ -43,21 +39,28 @@ namespace NadekoBot.Modules.Permissions.Classes
if (channel.IsPrivate || channel.Server == null) if (channel.IsPrivate || channel.Server == null)
return command.Category == "Help"; return command.Category == "Help";
if (user == null)
return false;
if (ConfigHandler.IsUserBlacklisted(user.Id) || if (ConfigHandler.IsUserBlacklisted(user.Id) ||
(!channel.IsPrivate && (!channel.IsPrivate &&
(ConfigHandler.IsServerBlacklisted(channel.Server.Id) || ConfigHandler.IsChannelBlacklisted(channel.Id)))) (ConfigHandler.IsServerBlacklisted(channel.Server.Id) || ConfigHandler.IsChannelBlacklisted(channel.Id))))
{ {
return false; return false;
} }
if (timeBlackList.Contains(user.Id)) try
return false; {
if (timeBlackList.ContainsKey(user.Id))
return false;
}
catch { return false; }
if (!channel.IsPrivate && !channel.Server.CurrentUser.GetPermissions(channel).SendMessages) if (!channel.IsPrivate && !channel.Server.CurrentUser.GetPermissions(channel).SendMessages)
{ {
return false; return false;
} }
timeBlackList.Add(user.Id); timeBlackList.TryAdd(user.Id, true);
ServerPermissions perms; ServerPermissions perms;
PermissionsHandler.PermissionsDict.TryGetValue(user.Server.Id, out perms); PermissionsHandler.PermissionsDict.TryGetValue(user.Server.Id, out perms);

View File

@ -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."); Console.WriteLine("Reading from the permission files.");
Directory.CreateDirectory("data/permissions"); Directory.CreateDirectory("data/permissions");
@ -39,7 +39,7 @@ namespace NadekoBot.Modules.Permissions.Classes
catch { } catch { }
} }
Console.WriteLine("Permission initialization complete."); Console.WriteLine("Permission initialization complete.");
} });
internal static Permissions GetRolePermissionsById(Server server, ulong id) internal static Permissions GetRolePermissionsById(Server server, ulong id)
{ {
@ -428,11 +428,13 @@ namespace NadekoBot.Modules.Permissions.Classes
{ {
var serverPerms = PermissionsDict.GetOrAdd(server.Id, var serverPerms = PermissionsDict.GetOrAdd(server.Id,
new ServerPermissions(server.Id, server.Name)); new ServerPermissions(server.Id, server.Name));
if (value == 0) { if (value == 0)
{
int throwaway; int throwaway;
serverPerms.CommandCooldowns.TryRemove(commandName, out throwaway); serverPerms.CommandCooldowns.TryRemove(commandName, out throwaway);
} }
else { else
{
serverPerms.CommandCooldowns.AddOrUpdate(commandName, value, (str, v) => value); serverPerms.CommandCooldowns.AddOrUpdate(commandName, value, (str, v) => value);
} }

View File

@ -18,8 +18,11 @@ namespace NadekoBot.Modules.Searches.Commands
public StreamNotifications(DiscordModule module) : base(module) public StreamNotifications(DiscordModule module) : base(module)
{ {
//start checking only after ready, because we need all servers to be initialized //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) while (true)
{ {
cachedStatuses.Clear(); cachedStatuses.Clear();
@ -80,12 +83,13 @@ namespace NadekoBot.Modules.Searches.Commands
catch { } catch { }
finally finally
{ {
await Task.Delay(TimeSpan.FromSeconds(15)); await Task.Delay(TimeSpan.FromSeconds(60));
} }
} }
}); });
}
};
}
private async Task<Tuple<bool, string>> GetStreamStatus(StreamNotificationConfig stream, bool checkCache = true) private async Task<Tuple<bool, string>> GetStreamStatus(StreamNotificationConfig stream, bool checkCache = true)
{ {
bool isLive; bool isLive;

View File

@ -39,7 +39,7 @@ namespace NadekoBot.Modules.Utility.Commands
sb.AppendLine($"`Roles:` **{server.Roles.Count()}**"); sb.AppendLine($"`Roles:` **{server.Roles.Count()}**");
sb.AppendLine($"`Created At:` **{createdAt}**"); sb.AppendLine($"`Created At:` **{createdAt}**");
if (server.CustomEmojis.Count() > 0) 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) if (server.Features.Count() > 0)
sb.AppendLine($"`Features:` **{string.Join(", ", server.Features)}**"); sb.AppendLine($"`Features:` **{string.Join(", ", server.Features)}**");
if (!string.IsNullOrWhiteSpace(server.SplashId)) if (!string.IsNullOrWhiteSpace(server.SplashId))

View File

@ -2,6 +2,7 @@
using Discord.Audio; using Discord.Audio;
using Discord.Commands; using Discord.Commands;
using Discord.Modules; using Discord.Modules;
using NadekoBot.Classes;
using NadekoBot.Classes.Help.Commands; using NadekoBot.Classes.Help.Commands;
using NadekoBot.Classes.JSONModels; using NadekoBot.Classes.JSONModels;
using NadekoBot.Modules.Administration; using NadekoBot.Modules.Administration;
@ -117,7 +118,7 @@ namespace NadekoBot
Client = new DiscordClient(new DiscordConfigBuilder() Client = new DiscordClient(new DiscordConfigBuilder()
{ {
MessageCacheSize = 10, MessageCacheSize = 10,
ConnectionTimeout = 200000, ConnectionTimeout = int.MaxValue,
LogLevel = LogSeverity.Warning, LogLevel = LogSeverity.Warning,
LogHandler = (s, e) => LogHandler = (s, e) =>
Console.WriteLine($"Severity: {e.Severity}" + 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 //add command service
Client.AddService<CommandService>(commandService); Client.AddService<CommandService>(commandService);
@ -185,9 +183,18 @@ namespace NadekoBot
//run the bot //run the bot
Client.ExecuteAndWait(async () => 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 try
{ {
await Client.Connect(Creds.Token).ConfigureAwait(false); await Client.Connect(Creds.Token, TokenType.Bot).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -197,7 +204,7 @@ namespace NadekoBot
return; return;
} }
#if NADEKO_RELEASE #if NADEKO_RELEASE
await Task.Delay(180000).ConfigureAwait(false); await Task.Delay(220000).ConfigureAwait(false);
#else #else
await Task.Delay(1000).ConfigureAwait(false); await Task.Delay(1000).ConfigureAwait(false);
#endif #endif
@ -232,11 +239,18 @@ namespace NadekoBot
Client.ClientAPI.SentRequest += (s, e) => Client.ClientAPI.SentRequest += (s, e) =>
{ {
Console.WriteLine($"[Request of type {e.Request.GetType()} sent in {e.Milliseconds}]"); 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 #endif
PermissionsHandler.Initialize();
NadekoBot.Ready = true; NadekoBot.Ready = true;
NadekoBot.OnReady(); NadekoBot.OnReady();
Console.WriteLine("Ready!");
//reply to personal messages and forward if enabled.
Client.MessageReceived += Client_MessageReceived;
}); });
Console.WriteLine("Exiting..."); Console.WriteLine("Exiting...");
Console.ReadKey(); Console.ReadKey();

View File

@ -90,6 +90,15 @@ namespace NadekoBot.Classes.JSONModels
} }, } },
{ "%mention% archer", new List<string>() { { "%mention% archer", new List<string>() {
"http://i.imgur.com/Bha9NhL.jpg" "http://i.imgur.com/Bha9NhL.jpg"
} },
{ "%mention% formuoli", new List<string>() {
"http://i.imgur.com/sCHYQhl.jpg"
} },
{ "%mention% mei", new List<string>() {
"http://i.imgur.com/Xkrf5y7.png"
} },
{ "%mention% omega yato", new List<string>() {
"https://cdn.discordapp.com/attachments/168617088892534784/221047921410310144/Yato_Animated.gif"
} } } }
}; };

@ -1 +1 @@
Subproject commit f90cf4ae5c9fd3c049663f46dcbf366412caba8b Subproject commit f7655320bc2b90ddb8bc9d17ae999aa76e9f5f38

View File

@ -24,7 +24,7 @@ If you want to contribute, be sure to PR on the **[dev][dev]** branch.
- [Commands List](Commands List.md) - [Commands List](Commands List.md)
- [Permissions System](Permissions System.md) - [Permissions System](Permissions System.md)
- [JSON Explanations](JSON Explanations.md) - [JSON Explanations](JSON Explanations.md)
- [Custiom Reactions](Custom Reactions.md) - [Custom Reactions](Custom Reactions.md)
- [Frequently Asked Questions](Frequently Asked Questions.md) - [Frequently Asked Questions](Frequently Asked Questions.md)
- [Contribution Guide](Contribution Guide.md) - [Contribution Guide](Contribution Guide.md)
- [Donate](Donate.md) - [Donate](Donate.md)