<commit_before>import discord
from discord.ext import commands
from cogs.utils.helpers import *
from cogs.utils.clip import *
from __main__ import settings, botdata, report_error, loggingdb
from cogs.utils import checks
import cogs.utils.botdatatypes as botdatatypes
import asyncio
import os
import string
import queue
import random
import re
import urllib.request
from random import randint
from .mangocog import *
from ctypes.util import find_library

intro_outro_length = 4.5

class TtsChannelError(Exception):
	def __init__(self, error):
		self.message = "Errored in the tts channel"
		self.original = error

class AudioPlayerNotFoundError(UserError):
	def __init__(self, message):
		super().__init__(message)

def remove_if_temp(mp3name):
	if os.path.isfile(mp3name):
		if os.path.dirname(mp3name) == settings.resource("temp"):
			os.remove(mp3name)
			print("removed temp file " + mp3name)


class AudioPlayer:
	"""The guild-specific objects used for mangobyte's audio output"""
	def __init__(self, bot, guild):
		self.bot = bot
		self.guild_id = guild.id
		self.guild = guild
		self.player = None
		self.clipqueue = queue.Queue()
		self.last_clip = None

	@property
	def voice(self):
		return self.guild.voice_client

	@property
	def voice_channel(self):
		if self.voice is None:
			return None
		else:
			return self.voice.channel

	async def update_guild(self):
		self.guild = await bot.fetch_guild(self.guild.id)

	# connects to a voice channel
	async def connect(self, channel):
		if not isinstance(channel, discord.VoiceChannel):
			channel = self.bot.get_channel(channel)

		voice = self.voice

		if voice is None:
			print(f"attempting connect to: {channel.id}")<commit_msg>fixed another bug with the new method<commit_after>import discord
from discord.ext import commands
from cogs.utils.helpers import *
from cogs.utils.clip import *
from __main__ import settings, botdata, report_error, loggingdb
from cogs.utils import checks
import cogs.utils.botdatatypes as botdatatypes
import asyncio
import os
import string
import queue
import random
import re
import urllib.request
from random import randint
from .mangocog import *
from ctypes.util import find_library

intro_outro_length = 4.5

class TtsChannelError(Exception):
	def __init__(self, error):
		self.message = "Errored in the tts channel"
		self.original = error

class AudioPlayerNotFoundError(UserError):
	def __init__(self, message):
		super().__init__(message)

def remove_if_temp(mp3name):
	if os.path.isfile(mp3name):
		if os.path.dirname(mp3name) == settings.resource("temp"):
			os.remove(mp3name)
			print("removed temp file " + mp3name)


class AudioPlayer:
	"""The guild-specific objects used for mangobyte's audio output"""
	def __init__(self, bot, guild):
		self.bot = bot
		self.guild_id = guild.id
		self.guild = guild
		self.player = None
		self.clipqueue = queue.Queue()
		self.last_clip = None

	@property
	def voice(self):
		return self.guild.voice_client

	@property
	def voice_channel(self):
		if self.voice is None:
			return None
		else:
			return self.voice.channel

	async def update_guild(self):
		self.guild = await self.bot.fetch_guild(self.guild.id)

	# connects to a voice channel
	async def connect(self, channel):
		if not isinstance(channel, discord.VoiceChannel):
			channel = self.bot.get_channel(channel)

		voice = self.voice

		if voice is None:
			print(f"attempting connect to: {channel.id}")
{'fraction_non_alphanumeric': 0.09192364170337738, 'fraction_numerical': 0.0041116005873715125, 'mean_word_length': 4.657807308970099, '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': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '859749', 'n_tokens_mistral': 1191, 'n_tokens_neox': 1100, 'n_words': 323}