<commit_before>import asyncio

import discord
from discord.ext import commands
import json

global data
with open('data/blacklist.json', 'r') as f:
    data = json.loads(f.read())


class Blacklist:
    def __init__(self, Aya):
        self.Aya = Aya

    @commands.group(pass_context=True, invoke_without_command=True)
    @commands.has_permissions(manage_server=True)
    async def blacklist(self, ctx):
        """Blacklists a word from the server"""
        self.Aya.say('Available arguments: \n```a.blacklist add <word>: Adds a word to the blacklist'
                     '\na.blacklist remove <word>: Removes a word from the blacklist.'
                     '\na.blacklist list: Lists currently blacklisted words.')

    @blacklist.command(pass_context=True)
    @commands.has_permissions(manage_server=True)
    async def add(self, ctx, word: str):
        """Adds a word the blacklist"""
        word = word.lower()
        data.setdefault(ctx.message.server.id, {})
        if word not in data[ctx.message.server.id]:
            data[ctx.message.server.id].setdefault(word, ctx.message.author.id)
            self.Aya.say(data)
            with open('data/blacklist.json', 'w') as f:
                f.write(json.dumps(data, indent=4))
            await self.Aya.say(word + " has been blacklisted.")
        else:
            await self.Aya.say(word + " is already blacklisted.")
<commit_msg>Update blacklist.py<commit_after>import asyncio

import discord
from discord.ext import commands
import json

global data
with open('data/blacklist.json', 'r') as f:
    data = json.loads(f.read())


class Blacklist:
    def __init__(self, Aya):
        self.Aya = Aya

    @commands.group(pass_context=True, invoke_without_command=True)
    @commands.has_permissions(manage_server=True)
    async def blacklist(self, ctx):
        """Blacklists a word from the server"""
        self.Aya.say('Available arguments: \n```a.blacklist add <word>: Adds a word to the blacklist'
                     '\na.blacklist remove <word>: Removes a word from the blacklist.'
                     '\na.blacklist list: Lists currently blacklisted words.')

    @blacklist.command(pass_context=True)
    @commands.has_permissions(manage_server=True)
    async def add(self, ctx, word: str):
        """Adds a word the blacklist"""
        word = word.lower()
        data.setdefault(ctx.message.server.id, {})
        if word not in data[ctx.message.server.id]:
            data[ctx.message.server.id].setdefault(word, ctx.message.author.id)
            with open('data/blacklist.json', 'w') as f:
                f.write(json.dumps(data, indent=4))
            await self.Aya.say(word + " has been blacklisted.")
        else:
            await self.Aya.say(word + " is already blacklisted.")

{'fraction_non_alphanumeric': 0.12198632601655272, 'fraction_numerical': 0.0007196833393306944, 'mean_word_length': 2.6968085106382977, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '574334', 'n_tokens_mistral': 854, 'n_tokens_neox': 839, 'n_words': 214}