<commit_before>import random
import discord
from discord.ext import commands

class Fun:
  def __init__(self, bot):
    self.bot = bot

  @commands.command()
  async def cat(self, ctx):
    """Random cat images. Awww, so cute! Powered by random.cat"""
    async with ctx.bot.session.get('https://random.cat/meow') as r:
      if r.status == 200:
        js = await r.json()
        em = discord.Embed(name='random.cat', colour=0x690E8)
        em.set_image(url=js['file'])
        await ctx.send(embed=em)

  @commands.command()
  async def httpcat(self, ctx, *, http_id: str):
    """http.cat images - ^httpcat <http code>"""
    httpcat_em = discord.Embed(name='http.cat', colour=0x690E8)
    httpcat_em.set_image(url='https://http.cat/' + http_id + '.jpg')
    await ctx.send(embed=httpcat_em)

  @commands.command()
  async def dog(self, ctx):
    """Random dogs, by random.dog"""
    async with ctx.bot.session.get('https://random.dog/woof') as shibeGet:
      if shibeGet.status == 200:
        shibeImg = await shibeGet.text()
        shibeURL = 'https://random.dog/' + shibeImg
        if '.mp4' in str(shibeURL):
            await ctx.send('mp4 file: ' + shibeURL)
        else:
          shibeEmbed = discord.Embed(name='shibe.online', colour=0x690E8)
          shibeEmbed.set_image(url=shibeURL)
          await ctx.send(embed=shibeEmbed)
      else:
        await ctx.send('Uh oh, I failed to get the picture for some reason')

<commit_msg>[cogs, fun] switch to a dedicated ClientSession<commit_after>import random
import discord
from discord.ext import commands

class Fun:
  def __init__(self, bot):
    self.bot = bot
    self.session = aiohttp.ClientSession(loop=self.bot.loop)

  @commands.command()
  async def cat(self, ctx):
    """Random cat images. Awww, so cute! Powered by random.cat"""
    async with self.session.get('https://random.cat/meow') as r:
      if r.status == 200:
        js = await r.json()
        em = discord.Embed(name='random.cat', colour=0x690E8)
        em.set_image(url=js['file'])
        await ctx.send(embed=em)

  @commands.command()
  async def httpcat(self, ctx, *, http_id: str):
    """http.cat images - ^httpcat <http code>"""
    httpcat_em = discord.Embed(name='http.cat', colour=0x690E8)
    httpcat_em.set_image(url='https://http.cat/' + http_id + '.jpg')
    await ctx.send(embed=httpcat_em)

  @commands.command()
  async def dog(self, ctx):
    """Random dogs, by random.dog"""
    async with self.session.get('https://random.dog/woof') as shibeGet:
      if shibeGet.status == 200:
        shibeImg = await shibeGet.text()
        shibeURL = 'https://random.dog/' + shibeImg
        if '.mp4' in str(shibeURL):
            await ctx.send('mp4 file: ' + shibeURL)
        else:
          shibeEmbed = discord.Embed(name='shibe.online', colour=0x690E8)
          shibeEmbed.set_image(url=shibeURL)
          await ctx.send(embed=shibeEmbed)
      else:
        await ctx.send('Uh oh, I failed to get the picture for some reason')


{'fraction_non_alphanumeric': 0.14333444704310055, 'fraction_numerical': 0.015369194787838289, 'mean_word_length': 2.9394736842105265, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 8, 'lorem ipsum': 0, 'www.': 2, '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': '6662613', 'n_tokens_mistral': 1059, 'n_tokens_neox': 1006, 'n_words': 242}