# Path: utils/checks.py
# class No_Owner(commands.CommandError): pass
# class No_Perms(commands.CommandError): pass
# class No_Role(commands.CommandError): pass
# class No_Admin(commands.CommandError): pass
# class No_Mod(commands.CommandError): pass
# class No_Sup(commands.CommandError): pass
# class No_ServerandPerm(commands.CommandError): pass
# class Nsfw(commands.CommandError): pass
# def is_owner_check(message):
# def is_owner():
# def check_permissions(ctx, perms):
# def role_or_perm(t, ctx, check, **perms):
# def mod_or_perm(**perms):
# 	def predicate(ctx):
# def admin_or_perm(**perms):
# 	def predicate(ctx):
# def is_in_servers(*server_ids):
# 	def predicate(ctx):
# def server_and_perm(ctx, *server_ids, **perms):
# def sup(ctx):
# def nsfw():
# 	def predicate(ctx):
# 
# Path: mods/cog.py
# class Cog(metaclass=CogMeta):
# 	def __init__(self, bot:NotSoBot):
# 		self._bot = bot
# 
# 	@property
# 	def bot(self):
# 		return self._bot
# 
# 	@classmethod
# 	def setup(cls, bot:NotSoBot):
# 		bot.add_cog(cls(bot))


import discord
import asyncio
import re
from discord.ext import commands
from utils import checks
from mods.cog import Cog

class Afk(Cog):
	def __init__(self, bot):
		super().__init__(bot)
		self.cursor = bot.mysql.cursor
		self.afks = {}
		self.mention_regex = re.compile(r'(<@(|!|)\d*>)')
		self.bot.loop.create_task(self.afk_init())

	async def afk_init(self):
		sql = 'SELECT * FROM `afk`'
		result = self.cursor.execute(sql).fetchall()
		if len(result) == 0:
			return
		for s in result:
			self.afks[str(s['user'])] = s['reason']

	async def remove_afk(self, user):
		sql = 'DELETE FROM `afk` WHERE user={0}'
		sql = sql.format(user)
		self.cursor.execute(sql)
		self.cursor.commit()
		del self.afks[str(user)]

	@commands.command(pass_context=True)
	async def afk(self, ctx, *, reason:str=None):
		if reason:
			reason = reason.replace('@everyone', '@\u200beveryone').replace('@here', '@\u200bhere')
		sql = 'INSERT INTO `afk` (`user`, `reason`) VALUES (%s, %s)'

# Path: utils/checks.py
# class No_Owner(commands.CommandError): pass
# class No_Perms(commands.CommandError): pass
# class No_Role(commands.CommandError): pass
# class No_Admin(commands.CommandError): pass
# class No_Mod(commands.CommandError): pass
# class No_Sup(commands.CommandError): pass
# class No_ServerandPerm(commands.CommandError): pass
# class Nsfw(commands.CommandError): pass
# def is_owner_check(message):
# def is_owner():
# def check_permissions(ctx, perms):
# def role_or_perm(t, ctx, check, **perms):
# def mod_or_perm(**perms):
# 	def predicate(ctx):
# def admin_or_perm(**perms):
# 	def predicate(ctx):
# def is_in_servers(*server_ids):
# 	def predicate(ctx):
# def server_and_perm(ctx, *server_ids, **perms):
# def sup(ctx):
# def nsfw():
# 	def predicate(ctx):
# 
# Path: mods/cog.py
# class Cog(metaclass=CogMeta):
# 	def __init__(self, bot:NotSoBot):
# 		self._bot = bot
# 
# 	@property
# 	def bot(self):
# 		return self._bot
# 
# 	@classmethod
# 	def setup(cls, bot:NotSoBot):
# 		bot.add_cog(cls(bot))


# Path: mods/Afk.py
import discord
import asyncio
import re
from discord.ext import commands
from utils import checks
from mods.cog import Cog


class Afk(Cog):
	def __init__(self, bot):
		super().__init__(bot)
		self.cursor = bot.mysql.cursor
		self.afks = {}
		self.mention_regex = re.compile(r'(<@(|!|)\d*>)')
		self.bot.loop.create_task(self.afk_init())

	async def afk_init(self):
		sql = 'SELECT * FROM `afk`'
		result = self.cursor.execute(sql).fetchall()
		if len(result) == 0:
			return
		for s in result:
			self.afks[str(s['user'])] = s['reason']

	async def remove_afk(self, user):
		sql = 'DELETE FROM `afk` WHERE user={0}'
		sql = sql.format(user)
		self.cursor.execute(sql)
		self.cursor.commit()
		del self.afks[str(user)]

	@commands.command(pass_context=True)
	async def afk(self, ctx, *, reason:str=None):
		if reason:
			reason = reason.replace('@everyone', '@\u200beveryone').replace('@here', '@\u200bhere')
		sql = 'INSERT INTO `afk` (`user`, `reason`) VALUES (%s, %s)'

		try: