# 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 asyncio
import discord
import os
import re
import random
import math
import io
import sys, traceback
import linecache
from io import StringIO
from itertools import islice, cycle
from discord.ext import commands
from utils import checks
from mods.cog import Cog

		results = ""
		for s in result:
			owner_id = s['user']
			tag = s['tag']
			tag = self.tag_formatter(tag)
			if owner_id == ctx.message.author.id:
				results += "Tag: `{0}` | Owner: <@{1}>\n".format(tag, owner_id)
			else:
				user = await self.bot.get_user_info(str(owner_id))
				results += "Tag: `{0}` | Owner: **{1}**\n".format(tag, user)
		await self.truncate(ctx.message.channel, ":white_check_mark: Results:\n{1}".format(txt, results))

	@tag_search.command(name='content', pass_context=True, no_pm=True)
	async def tag_search_content(self, ctx, *, txt:str):
		txt = self.tag_formatter(txt)
		sql = "SELECT * FROM `tags` WHERE content LIKE {0} AND server IS NOT NULL"
		sql = sql.format("%"+self.escape(txt)+"%")
		result = self.cursor.execute(sql).fetchall()
		if len(result) == 0:
			await self.bot.say(":exclamation: No results found for tags with content like `{0}`".format(txt))
			return
		results = ""
		for s in result:
			owner_id = s['user']
			tag = s['tag']
			tag = self.tag_formatter(tag)
			results += "Tag Name: {0} | Owner: <@{1}>\n".format(tag, owner_id)
		await self.bot.say("**Results For Tags With Content Like `{0}`**\n{1}".format(txt, results))

	@tag.group(name='forceremove', pass_context=True, no_pm=True)

# 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/Tags.py
import asyncio
import discord
import os
import re
import random
import math
import io
import sys, traceback
import linecache
from io import StringIO
from itertools import islice, cycle
from discord.ext import commands
from utils import checks
from mods.cog import Cog

		results = ""
		for s in result:
			owner_id = s['user']
			tag = s['tag']
			tag = self.tag_formatter(tag)
			if owner_id == ctx.message.author.id:
				results += "Tag: `{0}` | Owner: <@{1}>\n".format(tag, owner_id)
			else:
				user = await self.bot.get_user_info(str(owner_id))
				results += "Tag: `{0}` | Owner: **{1}**\n".format(tag, user)
		await self.truncate(ctx.message.channel, ":white_check_mark: Results:\n{1}".format(txt, results))

	@tag_search.command(name='content', pass_context=True, no_pm=True)
	async def tag_search_content(self, ctx, *, txt:str):
		txt = self.tag_formatter(txt)
		sql = "SELECT * FROM `tags` WHERE content LIKE {0} AND server IS NOT NULL"
		sql = sql.format("%"+self.escape(txt)+"%")
		result = self.cursor.execute(sql).fetchall()
		if len(result) == 0:
			await self.bot.say(":exclamation: No results found for tags with content like `{0}`".format(txt))
			return
		results = ""
		for s in result:
			owner_id = s['user']
			tag = s['tag']
			tag = self.tag_formatter(tag)
			results += "Tag Name: {0} | Owner: <@{1}>\n".format(tag, owner_id)
		await self.bot.say("**Results For Tags With Content Like `{0}`**\n{1}".format(txt, results))

	@tag.group(name='forceremove', pass_context=True, no_pm=True)

	@checks.is_owner()
