@@ -0,0 +1,3248 @@
+import discord%0Afrom discord.ext import commands%0Afrom discord.ext.commands import Context%0A%0Afrom cogbot.cog_bot import CogBot%0A%0A%0Aclass Quote:%0A    def __init__(self, bot: CogBot, ext: str):%0A        self.bot: CogBot = bot%0A        options = bot.state.get_extension_state(ext)%0A        self.emojis = set(options.get('emojis', %5B'%F0%9F%97%92'%5D))%0A%0A    async def on_reaction_add(self, reaction: discord.Reaction, user: discord.Member):%0A        if (user != self.bot) and (reaction.emoji in self.emojis):%0A            await self.bot.remove_reaction(reaction.message, reaction.emoji, user)%0A            await self.quote_message(reaction.message.channel, reaction.message)%0A%0A    async def get_message_from_args(self, message: str, channel: str) -%3E discord.Message:%0A        # message is a link%0A        if message.startswith(('http://', 'https://')):%0A            tokens = message.split('/')%0A            channel_id = tokens%5B-2%5D%0A            message_id = tokens%5B-1%5D%0A%0A        # message is an id, channel is a #ref%0A        elif channel and channel.startswith('%3C#') and channel.endswith('%3E'):%0A            message_id = message%0A            channel_id = channel%5B2:-1%5D%0A%0A        # message is an id, channel is an id%0A        else:%0A            message_id = message%0A            channel_id = channel%0A%0A        channel: discord.Channel = self.bot.get_channel(channel_id)%0A        message: discord.Message = await self.bot.get_message(channel, message_id)%0A%0A        return message%0A%0A    async def quote_message(self, destination: discord.channel, message: discord.Message, mention: bool = False):%0A        author: discord.Member = message.author%0A        server: discord.Server = message.server%0A        channel: discord.Channel = message.channel%0A%0A        quote_name = f'%7Bauthor.display_name%7D (%7Bauthor.name%7D#%7Bauthor.discriminator%7D)'%0A        quote_date = message.timestamp.strftime('%25d/%25m/%25Y')%0A        quote_title = f'In #%7Bchannel%7D on %7Bquote_date%7D:'%0A        quote_link = f'https://discordapp.com/channels/%7Bserver.id%7D/%7Bchannel.id%7D/%7Bmessage.id%7D'%0A%0A        em = discord.Embed(title=quote_title, url=quote_link, description=message.clean_content)%0A        em.set_author(name=quote_name, icon_url=author.avatar_url)%0A%0A        content = ((author.mention + ' ') if mention else '') + quote_link%0A%0A        await self.bot.send_message(destination, content, embed=em)%0A%0A    async def quote(self, ctx: Context, message: str, channel: str = None, mention: bool = False):%0A        channel = channel or ctx.message.channel.id%0A%0A        try:%0A            message_to_quote = await self.get_message_from_args(message, channel)%0A        except:%0A            await self.bot.react_question(ctx)%0A            return%0A%0A        try:%0A            await self.quote_message(ctx.message.channel, message_to_quote, mention)%0A        except:%0A            await self.bot.react_failure(ctx)%0A%0A    @commands.command(pass_context=True, name='quote')%0A    async def cmd_quote(self, ctx: Context, message: str, channel: str = None):%0A        await self.quote(ctx, message, channel)%0A%0A    @commands.command(pass_context=True, name='quotem', aliases=%5B'reply'%5D)%0A    async def cmd_quotem(self, ctx: Context, message: str, channel: str = None):%0A        await self.quote(ctx, message, channel, mention=True)%0A%0A%0Adef setup(bot):%0A    bot.add_cog(Quote(bot, __name__))%0A

Implement quote command using message links and embeds