use clean_content, response starts at new user

fight-fixes
Bobloy 7 years ago
parent 8f0b6f251e
commit afe59c3d42

@ -6,7 +6,6 @@ from discord.ext import commands
from redbot.core import Config from redbot.core import Config
from redbot.core.bot import Red from redbot.core.bot import Red
from redbot.core.utils.chat_formatting import escape
from .source import ChatBot from .source import ChatBot
from .source.trainers import ListTrainer from .source.trainers import ListTrainer
@ -49,9 +48,14 @@ class Chatter:
if in_channel: if in_channel:
channel = in_channel channel = in_channel
await ctx.send("Gathering {}".format(channel.mention)) await ctx.send("Gathering {}".format(channel.mention))
user = None
try: try:
async for message in channel.history(limit=None, reverse=True, after=after): async for message in channel.history(limit=None, reverse=True, after=after):
out.append(message.content) if user == message.author:
out[-1] += "\n"+message.clean_content
else:
user = message.author
out.append(message.clean_content)
except discord.Forbidden: except discord.Forbidden:
pass pass
except discord.HTTPException: except discord.HTTPException:
@ -121,7 +125,7 @@ class Chatter:
return return
text = text.replace(to_strip, "", 1) text = text.replace(to_strip, "", 1)
async with channel.typing(): async with channel.typing():
response = escape(self.chatbot.get_response(text)) response = self.chatbot.get_response(text)
if response: if response:
await channel.send(response) await channel.send(response)
else: else:

Loading…
Cancel
Save