# 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: 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):


import discord
import asyncio
import re
from cleverbot import Cleverbot
from discord.ext import commands
from chatterbot import ChatBot
from mods.cog import Cog
from utils import checks
									output_format='text',
									database='chatterbot-database',
									database_uri='mongodb://localhost:27017/')
cb = Cleverbot()

class AI(Cog):
	def __init__(self, bot):
		super().__init__(bot)
		self.ai_target = {}

	@commands.command(aliases=['cb'])
	async def cleverbot(self, *, question:str):
		await self.bot.say(':speech_balloon: '+cb.ask(question)[:2000])

	@commands.group(pass_context=True, aliases=['artificialinteligence', 'talk'], invoke_without_command=True)
	async def ai(self, ctx, *, msg:str=None):
		"""Toggle AI Targeted Responses"""
		if msg != None:
			await self.bot.send_typing(ctx.message.channel)
			ask_msg = ctx.message.content[:899]
			await self.bot.say("**{0}**\n".format(ctx.message.author.name)+str(chatbot.get_response(ask_msg)))
			return
		if any([ctx.message.author.id == x for x in self.ai_target]) == False:
			await self.bot.say("ok, AI targetting user `{0}`\n".format(ctx.message.author.name))
			self.ai_target.update({ctx.message.author.id:ctx.message.channel.id})
		else:
			await self.bot.say("ok, removed AI target `{0}`".format(ctx.message.author.name))
			del self.ai_target[ctx.message.author.id]

	@ai.command(name='remove', aliases=['forceremove'], pass_context=True)

# 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: 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/AI.py
import discord
import asyncio
import re
from cleverbot import Cleverbot
from discord.ext import commands
from chatterbot import ChatBot
from mods.cog import Cog
from utils import checks

									output_format='text',
									database='chatterbot-database',
									database_uri='mongodb://localhost:27017/')
cb = Cleverbot()

class AI(Cog):
	def __init__(self, bot):
		super().__init__(bot)
		self.ai_target = {}

	@commands.command(aliases=['cb'])
	async def cleverbot(self, *, question:str):
		await self.bot.say(':speech_balloon: '+cb.ask(question)[:2000])

	@commands.group(pass_context=True, aliases=['artificialinteligence', 'talk'], invoke_without_command=True)
	async def ai(self, ctx, *, msg:str=None):
		"""Toggle AI Targeted Responses"""
		if msg != None:
			await self.bot.send_typing(ctx.message.channel)
			ask_msg = ctx.message.content[:899]
			await self.bot.say("**{0}**\n".format(ctx.message.author.name)+str(chatbot.get_response(ask_msg)))
			return
		if any([ctx.message.author.id == x for x in self.ai_target]) == False:
			await self.bot.say("ok, AI targetting user `{0}`\n".format(ctx.message.author.name))
			self.ai_target.update({ctx.message.author.id:ctx.message.channel.id})
		else:
			await self.bot.say("ok, removed AI target `{0}`".format(ctx.message.author.name))
			del self.ai_target[ctx.message.author.id]

	@ai.command(name='remove', aliases=['forceremove'], pass_context=True)

	@checks.mod_or_perm(manage_server=True)