<commit_before>import os
import json
import random
import aiohttp
import discord
import requests
from discord.ext.commands import bot, is_owner

class Util():
	"""
	A cog that offers utility commands.
	"""
	def __init__(self, bot_client):
		self.bot = bot_client

	@bot.command()
	async def avatar(self, ctx, *,user: discord.User = None):
		"""
		Returns a mentioned users avatar
		Example:
		{command_prefix}avatar @RoxBot#4170
		{command_prefix}avatar RoxBot
		"""
		if not user:
			user = ctx.author

		url = user.avatar_url
		if url.split(".")[-1] == "gif":
			avaimg = 'avaimg.gif'
		else:
			avaimg = 'avaimg.webp'

		async with aiohttp.ClientSession() as session:
			async with session.get(url) as img:
				with open(avaimg, 'wb') as f:
					f.write(await img.read())
		await ctx.send(file=discord.File(avaimg))
		os.remove(avaimg)

	@bot.command()
	async def info(self, ctx, member: discord.Member = None):
		"""
		Gets info for a mentioned user
		Example:
		{command_prefix}info @RoxBot#4170
		{command_prefix}info RoxBot
		"""
		if not member:
			member = ctx.author
		try:
			if member.activity.type == discord.ActivityType.playing:
				activity = "Playing **{}**".format(member.activity.name)
			elif member.activity.type == discord.ActivityType.streaming:
				activity = "Streaming **{}**".format(member.activity.name)
			elif member.activity.tyoe == discord.ActivityType.listening:
				activity = "Listening to **{} by {}**".format(member.activity.title, member.activity.artist)
			else:
				activity = ""
		except AttributeError:
			activity = ""

		colour = member.colour.value
		avatar = member.avatar_url

		embed = discord.Embed(colour=colour, description=activity)
		embed.set_thumbnail(url=avatar)
		embed.set_author(name=str(member), icon_url=avatar)

		embed.add_field(name="ID", value=member.id)
		embed.add_field(name="Status", value=member.status)
		if member.nick:
			embed.add_field(name="Nickname", value=member.nick)
		embed.add_field(name="Account Created", value="{:%a %Y/%m/%d %H:%M:%S} UTC".format(member.created_at), inline=True)
		embed.add_field(name="Joined Server", value="{:%a %Y/%m/%d %H:%M:%S} UTC".format(member.joined_at), inline=True)

		roles = ""<commit_msg>okay, its actually fixed because typos and the if statements a lil better now too.<commit_after>import os
import json
import random
import aiohttp
import discord
import requests
from discord.ext.commands import bot, is_owner

class Util():
	"""
	A cog that offers utility commands.
	"""
	def __init__(self, bot_client):
		self.bot = bot_client

	@bot.command()
	async def avatar(self, ctx, *,user: discord.User = None):
		"""
		Returns a mentioned users avatar
		Example:
		{command_prefix}avatar @RoxBot#4170
		{command_prefix}avatar RoxBot
		"""
		if not user:
			user = ctx.author

		url = user.avatar_url
		if url.split(".")[-1] == "gif":
			avaimg = 'avaimg.gif'
		else:
			avaimg = 'avaimg.webp'

		async with aiohttp.ClientSession() as session:
			async with session.get(url) as img:
				with open(avaimg, 'wb') as f:
					f.write(await img.read())
		await ctx.send(file=discord.File(avaimg))
		os.remove(avaimg)

	@bot.command()
	async def info(self, ctx, member: discord.Member = None):
		"""
		Gets info for a mentioned user
		Example:
		{command_prefix}info @RoxBot#4170
		{command_prefix}info RoxBot
		"""
		if not member:
			member = ctx.author
		if member.activity:
			if member.activity.type == discord.ActivityType.playing:
				activity = "Playing **{}**".format(member.activity.name)
			elif member.activity.type == discord.ActivityType.streaming:
				activity = "Streaming **{}**".format(member.activity.name)
			elif member.activity.type == discord.ActivityType.listening:
				activity = "Listening to **{} by {}**".format(member.activity.title, member.activity.artist)
			else:
				activity = ""
		else:
			activity = ""

		colour = member.colour.value
		avatar = member.avatar_url

		embed = discord.Embed(colour=colour, description=activity)
		embed.set_thumbnail(url=avatar)
		embed.set_author(name=str(member), icon_url=avatar)

		embed.add_field(name="ID", value=member.id)
		embed.add_field(name="Status", value=member.status)
		if member.nick:
			embed.add_field(name="Nickname", value=member.nick)
		embed.add_field(name="Account Created", value="{:%a %Y/%m/%d %H:%M:%S} UTC".format(member.created_at), inline=True)
		embed.add_field(name="Joined Server", value="{:%a %Y/%m/%d %H:%M:%S} UTC".format(member.joined_at), inline=True)

		roles = ""
{'fraction_non_alphanumeric': 0.14719678356041993, 'fraction_numerical': 0.0040205494750949295, 'mean_word_length': 4.362874251497006, 'pattern_counts': {'":': 2, '<': 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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3975400', 'n_tokens_mistral': 1733, 'n_tokens_neox': 1536, 'n_words': 348}