<commit_before>﻿using Discord.Commands;
using Discord.Modules;
using NadekoBot.Classes.ClashOfClans;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace NadekoBot.Modules.ClashOfClans
{
    internal class ClashOfClansModule : DiscordModule
    {
        public override string Prefix { get; } = NadekoBot.Config.CommandPrefixes.ClashOfClans;

        public static ConcurrentDictionary<ulong, List<ClashWar>> ClashWars { get; } = new ConcurrentDictionary<ulong, List<ClashWar>>();

        private readonly object writeLock = new object();

        public override void Install(ModuleManager manager)
        {
            manager.CreateCommands("", cgb =>
            {

                cgb.CreateCommand(Prefix + "createwar")
                    .Alias(Prefix + "cw")
                    .Description(
                        $"Creates a new war by specifying a size (>10 and multiple of 5) and enemy clan name. |{Prefix}cw 15 The Enemy Clan")
                    .Parameter("size")
                    .Parameter("enemy_clan", ParameterType.Unparsed)
                    .Do(async e =>
                    {
                        if (!e.User.ServerPermissions.ManageChannels)
                            return;
                        List<ClashWar> wars;
                        if (!ClashWars.TryGetValue(e.Server.Id, out wars))
                        {
                            wars = new List<ClashWar>();
                            if (!ClashWars.TryAdd(e.Server.Id, wars))<commit_msg>Permissions module now works properly with Clas Of Clans module, thx rusty<commit_after>﻿using Discord.Commands;
using Discord.Modules;
using NadekoBot.Classes.ClashOfClans;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using NadekoBot.Modules.Permissions.Classes;

namespace NadekoBot.Modules.ClashOfClans
{
    internal class ClashOfClansModule : DiscordModule
    {
        public override string Prefix { get; } = NadekoBot.Config.CommandPrefixes.ClashOfClans;

        public static ConcurrentDictionary<ulong, List<ClashWar>> ClashWars { get; } = new ConcurrentDictionary<ulong, List<ClashWar>>();

        private readonly object writeLock = new object();

        public override void Install(ModuleManager manager)
        {
            manager.CreateCommands("", cgb =>
            {

              cgb.AddCheck(PermissionChecker.Instance);

              cgb.CreateCommand(Prefix + "createwar")
                    .Alias(Prefix + "cw")
                    .Description(
                        $"Creates a new war by specifying a size (>10 and multiple of 5) and enemy clan name. |{Prefix}cw 15 The Enemy Clan")
                    .Parameter("size")
                    .Parameter("enemy_clan", ParameterType.Unparsed)
                    .Do(async e =>
                    {
                        if (!e.User.ServerPermissions.ManageChannels)
                            return;
                        List<ClashWar> wars;
                        if (!ClashWars.TryGetValue(e.Server.Id, out wars))
                        {
                            wars = new List<ClashWar>();
                            if (!ClashWars.TryAdd(e.Server.Id, wars))
{'fraction_non_alphanumeric': 0.08957897879964169, 'fraction_numerical': 0.002985965959988056, 'mean_word_length': 1.8755364806866952, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3949889', 'n_tokens_mistral': 901, 'n_tokens_neox': 876, 'n_words': 207}