<commit_before>from discord.ext import commands
import json


class Memes():
    """Meme commands."""
    def __init__(self, bot):
        self.client = bot
        with open("data/memes.json") as op:
            self.known = json.load(op)

    @commands.group(pass_context=True)
    async def meme(self, ctx):
        """Provides !meme cmds, see !help meme"""
        if ctx.invoked_subcommand is None:
            await self.client.say("Unrecognised command; see !help meme")

    @meme.command(pass_context=True)
    async def lst(self, ctx):
        """List all known memes. Usage: !meme lst"""
        await self.client.say("Listing memes:")
        await self.client.say(", ".join(self.known.keys()))

    @meme.command(pass_context=True)
    async def f(self, ctx, name: str):
        """Replies with file of known meme."""
        msg = await self.client.say("Finding meme...")
        if name in self.known:
            await self.client.edit_message(msg, "Meme found, uploading!")
            filename = self.known[name][0]
            if filename:
                chan = ctx.message.channel
                with open(filename, "rb") as tt:
                    await self.client.send_file(chan, tt)
                await self.client.edit_message(msg, "Meme:")
            else:
                await self.client.edit_message(msg,
                                               "Meme doesn't have a file.")
        else:
            self.client.edit_message(msg, "Meme not found, try again!")

    @meme.command(pass_context=True)
    async def yt(self, ctx, name: str):
        """Replies with youtube link of known meme."""
        msg = await self.client.say("Finding meme...")
        if name in self.known:
            await self.client.edit_message(msg, "Meme found, linking!")
            link = self.known[name][1]
            if link:
                await self.client.edit_message(msg,
                                               str(link))
            else:
                await self.client.edit_message(msg,
                                               "Meme doesn't have a yt.")
        else:
            self.client.edit_message(msg, "Meme not found, try again!")


def setup(bot):
    bot.add_cog(Memes(bot))
<commit_msg>Moved memes to using send_typing.<commit_after>import json

from discord.ext import commands


class Memes():
    """Meme commands."""
    def __init__(self, bot):
        self.client = bot
        with open("data/memes.json") as op:
            self.known = json.load(op)

    @commands.group(pass_context=True)
    async def meme(self, ctx):
        """Provides !meme cmds, see !help meme"""
        if ctx.invoked_subcommand is None:
            await self.client.say("Unrecognised command; see !help meme")

    @meme.command(pass_context=True)
    async def lst(self, ctx):
        """List all known memes. Usage: !meme lst"""
        await self.client.send_typing(ctx.message.channel)
        await self.client.say("Listing memes:")
        await self.client.say(", ".join(self.known.keys()))

    @meme.command(pass_context=True)
    async def f(self, ctx, name: str):
        """Replies with file of known meme."""
        await self.client.send_typing(ctx.message.channel)
        if name in self.known:
            await self.client.say("Meme found, uploading!")
            filename = self.known.get(name)[0]
            if filename:
                await self.client.say("Meme:")
                with open(filename, "rb") as t:
                    await self.client.send_file(ctx.message.channel, t)
            else:
                await self.client.say("Meme doesn't have a file.")
        else:
            self.client.say("Meme not found.")

    @meme.command(pass_context=True)
    async def yt(self, ctx, name: str):
        """Replies with youtube link of known meme."""
        await self.client.send_typing(ctx.message.channel)
        if name in self.known:
            msg = await self.client.say("Meme found, attempting to link...")
            link = self.known[name][1]
            if link:
                await self.client.edit_message(msg, str(link))
            else:
                await self.client.edit_message(msg, "Meme doesn't have a youtube link.")
        else:
            self.client.edit_message(msg, "Meme not found, try again!")


def setup(bot):
    bot.add_cog(Memes(bot))

{'fraction_non_alphanumeric': 0.12171127888355067, 'fraction_numerical': 0.0009151223976206818, 'mean_word_length': 1.9580514208389717, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '313439', 'n_tokens_mistral': 1313, 'n_tokens_neox': 1291, 'n_words': 337}