コード例 #1
0
 def lmgtfy_search(self, q):
     if len(q) == 0:
         raise MissingRequiredArgument("search_query")
     link = "https://lmgtfy.com/?q="
     for question in q.split():
         link += quote(question) + "+"
     return link[:len(link) - 1]
コード例 #2
0
    async def note(self, message: discord.Message) -> None:
        if not message.content and not message.attachments:
            raise MissingRequiredArgument(param(name='msg'))

        await asyncio.gather(
            self.bot.api.append_log(message, self.channel.id, type_='system'),
            self.send(message, self.channel, note=True))
コード例 #3
0
    async def levelling_set_roles(self, ctx: commands.Context):
        if ctx.invoked_subcommand is None:

            class error(inspect.Parameter):
                name = "levelling set roles"
                param = "subcommand"

            raise MissingRequiredArgument(error)
コード例 #4
0
    async def config_command(self, ctx):
        if ctx.invoked_subcommand is None:

            class error(inspect.Parameter):
                name = "config command"
                param = "subcommand"

            raise MissingRequiredArgument(error)
コード例 #5
0
    async def reply(self, message: discord.Message,
                    anonymous: bool = False) -> None:
        if not message.content and not message.attachments:
            raise MissingRequiredArgument(param(name='msg'))
        if all(not g.get_member(self.id) for g in self.bot.guilds):
            return await message.channel.send(
                embed=discord.Embed(
                    color=discord.Color.red(),
                    description='Your message could not be delivered since '
                                'the recipient shares no servers with the bot.'
                ))

        tasks = []

        try:
            await self.send(message,
                            destination=self.recipient,
                            from_mod=True,
                            anonymous=anonymous)
        except Exception:
            logger.info(error('Message delivery failed:'), exc_info=True)
            tasks.append(message.channel.send(
                embed=discord.Embed(
                    color=discord.Color.red(),
                    description='Your message could not be delivered as '
                                'the recipient is only accepting direct '
                                'messages from friends, or the bot was '
                                'blocked by the recipient.'
                )
            ))
        else:
            # Send the same thing in the thread channel.
            tasks.append(
                self.send(message,
                          destination=self.channel,
                          from_mod=True,
                          anonymous=anonymous)
            )

            tasks.append(
                self.bot.api.append_log(message,
                                        self.channel.id,
                                        type_='anonymous' if anonymous else 'thread_message'
                                        ))

        if self.close_task is not None:
            # Cancel closing if a thread message is sent.
            await self.cancel_closure()
            tasks.append(
                self.channel.send(
                    embed=discord.Embed(
                        color=discord.Color.red(),
                        description='Scheduled close has been cancelled.'
                    )
                )
            )

        await asyncio.gather(*tasks)
コード例 #6
0
ファイル: thread.py プロジェクト: bductane/esncsupport
    async def reply(self,
                    message: discord.Message,
                    anonymous: bool = False) -> None:
        if not message.content and not message.attachments:
            raise MissingRequiredArgument(param(name="msg"))
        if all(not g.get_member(self.id) for g in self.bot.guilds):
            return await message.channel.send(embed=discord.Embed(
                color=discord.Color.red(),
                description="Votre message na pas pu être envoyé :"
                "le destinataire nest pas sur le serveur.",
            ))

        tasks = []

        try:
            await self.send(message,
                            destination=self.recipient,
                            from_mod=True,
                            anonymous=anonymous)
        except Exception:
            logger.info(error("Erreur :"), exc_info=True)
            tasks.append(
                message.channel.send(embed=discord.Embed(
                    color=discord.Color.red(),
                    description="Votre message na pas pu être envoyé :"
                    "Erreur destinataire "
                    "Erreur destinataire "
                    "Le bot est bloqué par le destinataire.",
                )))
        else:
            # Send the same thing in the thread channel.
            tasks.append(
                self.send(
                    message,
                    destination=self.channel,
                    from_mod=True,
                    anonymous=anonymous,
                ))

            tasks.append(
                self.bot.api.append_log(
                    message,
                    self.channel.id,
                    type_="anonymous" if anonymous else "thread_message",
                ))

            # Cancel closing if a thread message is sent.
            if self.close_task is not None:
                await self.cancel_closure()
                tasks.append(
                    self.channel.send(embed=discord.Embed(
                        color=discord.Color.red(),
                        description="Annulé",
                    )))

        await asyncio.gather(*tasks)
コード例 #7
0
ファイル: thread.py プロジェクト: madman2021/modmail
    async def reply(self,
                    message: discord.Message,
                    anonymous: bool = False) -> None:
        if not message.content and not message.attachments:
            raise MissingRequiredArgument(SimpleNamespace(name="msg"))
        if not any(g.get_member(self.id) for g in self.bot.guilds):
            return await message.channel.send(embed=discord.Embed(
                color=discord.Color.red(),
                description="Your message could not be delivered since "
                "the recipient shares no servers with the bot.",
            ))

        tasks = []

        try:
            await self.send(message,
                            destination=self.recipient,
                            from_mod=True,
                            anonymous=anonymous)
        except Exception:
            logger.error("Message delivery failed:", exc_info=True)
            tasks.append(
                message.channel.send(embed=discord.Embed(
                    color=discord.Color.red(),
                    description="Your message could not be delivered as "
                    "the recipient is only accepting direct "
                    "messages from friends, or the bot was "
                    "blocked by the recipient.",
                )))
        else:
            # Send the same thing in the thread channel.
            tasks.append(
                self.send(
                    message,
                    destination=self.channel,
                    from_mod=True,
                    anonymous=anonymous,
                ))

            tasks.append(
                self.bot.api.append_log(
                    message,
                    self.channel.id,
                    type_="anonymous" if anonymous else "thread_message",
                ))

            # Cancel closing if a thread message is sent.
            if self.close_task is not None:
                await self.cancel_closure()
                tasks.append(
                    self.channel.send(embed=discord.Embed(
                        color=discord.Color.red(),
                        description="Scheduled close has been cancelled.",
                    )))

        await asyncio.gather(*tasks)
コード例 #8
0
ファイル: thread.py プロジェクト: xetaah/modmail
    async def note(self, message: discord.Message) -> None:
        if not message.content and not message.attachments:
            raise MissingRequiredArgument(SimpleNamespace(name="msg"))

        _, msg = await asyncio.gather(
            self.bot.api.append_log(message, self.channel.id, type_="system"),
            self.send(message, self.channel, note=True),
        )

        return msg
コード例 #9
0
ファイル: thread.py プロジェクト: VincyBot07/VincyBot07
    async def reply(self,
                    message: discord.Message,
                    anonymous: bool = False) -> None:
        if not message.content and not message.attachments:
            raise MissingRequiredArgument(SimpleNamespace(name="msg"))
        if not any(g.get_member(self.id) for g in self.bot.guilds):
            return await message.channel.send(embed=discord.Embed(
                color=self.bot.error_color,
                description="Il messaggio non può essere inviato perchè "
                "il mittente non condivide alcun server col bot.",
            ))

        tasks = []

        try:
            await self.send(message,
                            destination=self.recipient,
                            from_mod=True,
                            anonymous=anonymous)
        except Exception:
            logger.error("Non è stato possibile inviare il messaggio:",
                         exc_info=True)
            tasks.append(
                message.channel.send(embed=discord.Embed(
                    color=self.bot.error_color,
                    description="Il messaggio non può essere inviato perchè "
                    "il mittente accetta solo messaggi da amici, "
                    "oppure il mittente ha bloccato il bot.",
                )))
        else:
            # Send the same thing in the thread channel.
            msg = await self.send(message,
                                  destination=self.channel,
                                  from_mod=True,
                                  anonymous=anonymous)

            tasks.append(
                self.bot.api.append_log(
                    message,
                    message_id=msg.id,
                    channel_id=self.channel.id,
                    type_="anonymous" if anonymous else "thread_message",
                ))

            # Cancel closing if a thread message is sent.
            if self.close_task is not None:
                await self.cancel_closure()
                tasks.append(
                    self.channel.send(embed=discord.Embed(
                        color=self.bot.error_color,
                        description=
                        "La chiusura programmata è stata annullata.",
                    )))

        await asyncio.gather(*tasks)
コード例 #10
0
    async def reply(self,
                    message: discord.Message,
                    anonymous: bool = False) -> None:
        if not message.content and not message.attachments:
            raise MissingRequiredArgument(SimpleNamespace(name="msg"))
        if not any(g.get_member(self.id) for g in self.bot.guilds):
            return await message.channel.send(embed=discord.Embed(
                color=self.bot.error_color,
                description="Votre message n'a pas pu être envoyé car "
                "le destinataire et le bot ne sont pas dans un serveur commun",
            ))

        tasks = []

        try:
            await self.send(message,
                            destination=self.recipient,
                            from_mod=True,
                            anonymous=anonymous)
        except Exception:
            logger.error("Message delivery failed:", exc_info=True)
            tasks.append(
                message.channel.send(embed=discord.Embed(
                    color=self.bot.error_color,
                    description="Votre message n'a pas pu être envoyé car "
                    "le destnataire n'accepte les messages privés ne venant uniquement de ses amis "
                    "ou alors, le bot à "
                    "été bloqué par le destinataire.",
                )))
        else:
            # Send the same thing in the thread channel.
            msg = await self.send(message,
                                  destination=self.channel,
                                  from_mod=True,
                                  anonymous=anonymous)

            tasks.append(
                self.bot.api.append_log(
                    message,
                    message_id=msg.id,
                    channel_id=self.channel.id,
                    type_="anonymous" if anonymous else "thread_message",
                ))

            # Cancel closing if a thread message is sent.
            if self.close_task is not None:
                await self.cancel_closure()
                tasks.append(
                    self.channel.send(embed=discord.Embed(
                        color=self.bot.error_color,
                        description="Scheduled close has been cancelled.",
                    )))

        await asyncio.gather(*tasks)
コード例 #11
0
    async def reply(self,
                    message: discord.Message,
                    anonymous: bool = False) -> None:
        if not message.content and not message.attachments:
            raise MissingRequiredArgument(SimpleNamespace(name="msg"))
        if not any(g.get_member(self.id) for g in self.bot.guilds):
            return await message.channel.send(embed=discord.Embed(
                color=self.bot.error_color,
                description="Tu mensaje no se pudo entregar porque"
                "el destinatario no comparte servidores con el bot.",
            ))

        tasks = []

        try:
            await self.send(message,
                            destination=self.recipient,
                            from_mod=True,
                            anonymous=anonymous)
        except Exception:
            logger.error("Error en la entrega del mensaje:", exc_info=True)
            tasks.append(
                message.channel.send(embed=discord.Embed(
                    color=self.bot.error_color,
                    description="Tu mensaje no se pudo entregar porque"
                    "el destinatario solo acepta mensajes"
                    "directos de amigos, o el bot fue"
                    "bloqueado por el destinatario.",
                )))
        else:
            # Send the same thing in the thread channel.
            msg = await self.send(message,
                                  destination=self.channel,
                                  from_mod=True,
                                  anonymous=anonymous)

            tasks.append(
                self.bot.api.append_log(
                    message,
                    message_id=msg.id,
                    channel_id=self.channel.id,
                    type_="anónimo" if anonymous else "thread_message",
                ))

            # Cancel closing if a thread message is sent.
            if self.close_task is not None:
                await self.cancel_closure()
                tasks.append(
                    self.channel.send(embed=discord.Embed(
                        color=self.bot.error_color,
                        description="Se canceló el cierre programado.",
                    )))

        await asyncio.gather(*tasks)
コード例 #12
0
ファイル: Social.py プロジェクト: Naila/Naila.py
 def process_users(ctx: Context, users):
     users = [x for x in users if not isinstance(x, str)]
     if not users:
         raise MissingRequiredArgument(ctx.command.params["users"])
     users = [x.mention for x in list(set(users)) if x is not ctx.author]
     if len(users) > 5:
         raise BadArgument("You provided too many users!")
     if not users:
         raise errors.UsedOnSelf
     word = "was" if len(users) == 1 else "were"
     users = readable_list(users)
     return users, word
コード例 #13
0
ファイル: trigger.py プロジェクト: SimsumMC/communitybot
    async def add(self, ctx: commands.Context, *, content):
        time = datetime.datetime.now()
        user = ctx.author.name
        if await botchannel_check(ctx=ctx):
            try:
                word = content.split(" : ")[0]
                msg = content.split(" : ")[1]
            except Exception:

                class error(inspect.Parameter):
                    name = "trigger add"
                    param = "subcommand"

                raise MissingRequiredArgument(error)
            if word in await get_trigger_list(guildid=ctx.guild.id):
                embed = discord.Embed(
                    title=f"**Fehler**",
                    description=
                    f"Der Trigger {word} existiert bereits! Wenn du ihn verändern möchtest, "
                    f"nutze den Befehl:"
                    f"```{await get_prefix_string(message=ctx.message)}trigger edit```",
                    colour=await get_embedcolour(ctx.message),
                )
                embed._footer = await get_embed_footer(ctx)
                embed._thumbnail = await get_embed_thumbnail()
                await ctx.send(embed=embed)
                await log(
                    f"{time}: Der Nutzer {user} hat versucht den Befehl {await get_prefix_string(ctx.message)}"
                    f"trigger add zu benutzen und damit den Trigger {word} hinzuzufügen, konnte"
                    f" es aber nicht da dieser bereits existiert hat!",
                    guildid=ctx.guild.id,
                )
                return
            await add_trigger(guildid=ctx.guild.id, trigger=word, msg=msg)
            embed = discord.Embed(
                title=f"**Trigger Add**",
                description=
                f"Der Bot reagiert nun auf ```{word}``` mit der Nachricht:"
                f"```{msg}```",
                colour=await get_embedcolour(ctx.message),
            )
            embed._footer = await get_embed_footer(ctx)
            embed._thumbnail = await get_embed_thumbnail()
            await ctx.send(embed=embed)
            await log(
                f"{time}: Der Nutzer {user} hat den Befehl {await get_prefix_string(ctx.message)}"
                f"trigger add benutzt und damit den Trigger {word} hinzugefügt.!",
                guildid=ctx.guild.id,
            )

        else:
            Bot.dispatch(self.bot, "botchannelcheck_failure", ctx)
コード例 #14
0
    async def note(self, message: discord.Message) -> None:
        if not message.content and not message.attachments:
            raise MissingRequiredArgument(SimpleNamespace(name="msg"))

        msg = await self.send(message, self.channel, note=True)

        self.bot.loop.create_task(
            self.bot.api.append_log(message,
                                    message_id=msg.id,
                                    channel_id=self.channel.id,
                                    type_="system"))

        return msg
コード例 #15
0
ファイル: trigger.py プロジェクト: SimsumMC/communitybot
    async def edit(self, ctx: commands.Context, *, content):
        time = datetime.datetime.now()
        user = ctx.author.name
        if await botchannel_check(ctx):
            try:
                word = content.split(" : ")[0]
                msg = content.split(" : ")[1]
            except Exception:

                class error(inspect.Parameter):
                    name = "trigger add"
                    param = "subcommand"

                raise MissingRequiredArgument(error)
            if word not in await get_trigger_list(guildid=ctx.guild.id):
                embed = discord.Embed(
                    title=f"**Fehler**",
                    description=
                    f"Der Trigger {word} existiert nicht! Wenn du einen erstellen möchtest,"
                    "nutz den Befehl:"
                    f"```{await get_prefix_string(message=ctx.message)}trigger add```",
                    colour=await get_embedcolour(ctx.message),
                )
                embed._footer = await get_embed_footer(ctx)
                embed._thumbnail = await get_embed_thumbnail()
                await ctx.send(embed=embed)  # todo add components
                await log(
                    f"{time}: Der Nutzer {user} hat versucht den Befehl {await get_prefix_string(ctx.message)}"
                    f"trigger edit zu benutzen und damit den Trigger {word} zu bearbeiten, konnte"
                    f" es aber nicht da dieser nicht existiert hat!",
                    guildid=ctx.guild.id,
                )
                return
            await add_trigger(guildid=ctx.guild.id, trigger=word, msg=msg)
            embed = discord.Embed(
                title=f"**Trigger edit**",
                description=
                f"Der Trigger ```{word}``` wurde erfolgreich zu ```{await get_trigger_msg(guildid=ctx.guild.id, trigger=word)}``` geändert.",
                colour=await get_embedcolour(ctx.message),
            )
            embed._footer = await get_embed_footer(ctx)
            embed._thumbnail = await get_embed_thumbnail()
            await ctx.send(embed=embed)
            await log(
                f"{time}: Der Nutzer {user} hat den Befehl {await get_prefix_string(ctx.message)}"
                f'trigger add benutzt und damit den Trigger {word} zu "{await get_trigger_msg(guildid=ctx.guild.id, trigger=word)}" bearbeitet!',
                guildid=ctx.guild.id,
            )
        else:
            Bot.dispatch(self.bot, "botchannelcheck_failure", ctx)
コード例 #16
0
    async def album(self, ctx, *, search_query=""):
        """Search for an album"""
        urls = dict()
        album = Album()

        # If no search query was supplied, try to fetch an album from the current scrobble,
        # and build the search from its artist and title
        last_album = None
        if not search_query and self.get_lastfm_user(ctx.author):
            scrobble = await search.get_scrobble(
                self.get_lastfm_user(ctx.author))
            if scrobble and scrobble.album:
                last_album = scrobble.album
                search_query = f"{scrobble.artist.name} {scrobble.album.name}"

        if not search_query:
            raise MissingRequiredArgument(ctx.command.params["search_query"])

        if not last_album:
            last_album = await search.search_lastfm_album(search_query)
        album.update(last_album)
        urls["Last.fm"] = last_album.url

        spotify_album = await search.search_spotify_album(search_query,
                                                          extended=True)
        if spotify_album:
            album.update(spotify_album)
            urls["Spotify"] = spotify_album.url

        metrics = ""
        if album.date:
            year = album.date[:4]
            minutes = int(album.length / 60_000)
            metrics = f"\n{year} • {album.tracks} songs, {minutes} min"

        urls["RYM"] = rym_search(album.name, searchtype="l")
        description = f"*{album.artist.name}*{metrics}\n\n{mklinks(urls)}"

        embed = discord.Embed(title=album.name,
                              description=description,
                              url=album.url)
        embed.set_thumbnail(url=album.img_url or EmptyEmbed)

        await ctx.send(embed=embed)
コード例 #17
0
    async def avatar(self, ctx: Context, *, url: str = None):
        '''
        Allows you to change the avatar of the bot to a URL or attached picture
        '''

        # Make sure a URL is passed
        if url == None:
            try:
                url = ctx.message.attachments[0].url
            except IndexError:
                raise MissingRequiredArgument(self.avatar.params['url'])

        # Get the image
        async with self.session.get(url) as r:
            content = await r.read()

        # Edit the profile
        await self.bot.user.edit(avatar=content)
        await ctx.send('Done.')
コード例 #18
0
    async def artist(self, ctx, *, search_query=""):
        """Search for an artist"""
        urls = dict()
        artist = Artist()

        # If no search query was supplied, get the artist from the current scrobble and use its name as search
        if not search_query and self.get_lastfm_user(ctx.author):
            scrobble = await search.get_scrobble(
                self.get_lastfm_user(ctx.author))
            if scrobble:
                search_query = f"'{scrobble.artist.name}'"

        if not search_query:
            raise MissingRequiredArgument(ctx.command.params["search_query"])

        # Use exact search if the "query is in quotes" or 'in quotes'
        quotes = ['"', "'"]
        if search_query[0] in quotes and search_query[
                -1] in quotes and search_query[0] == search_query[-1]:
            last_result = await search.search_lastfm_artist(search_query[1:-1],
                                                            exact=True)
        else:
            last_result = await search.search_lastfm_artist(search_query)
        artist.update(last_result)
        urls["Last.fm"] = last_result.url

        sp_result = await search.search_spotify_artist(last_result.name)
        if sp_result:
            artist.update(sp_result)
            urls["Spotify"] = sp_result.url

        urls["RYM"] = rym_search(artist.name, searchtype="a")

        embed = discord.Embed(title=artist.name, url=artist.url)
        embed.set_thumbnail(url=artist.img_url or EmptyEmbed)
        embed.description = f"{artist.bio}\n\nTop Tags: {artist.tags}\n\n{mklinks(urls)}"

        await ctx.send(embed=embed)
コード例 #19
0
    async def reply(self,
                    message: discord.Message,
                    anonymous: bool = False,
                    plain: bool = False) -> None:
        if not message.content and not message.attachments:
            raise MissingRequiredArgument(SimpleNamespace(name="msg"))
        if not any(g.get_member(self.id) for g in self.bot.guilds):
            return await message.channel.send(embed=discord.Embed(
                color=self.bot.error_color,
                description="Your message could not be delivered since "
                "the recipient shares no servers with the bot.",
            ))

        tasks = []

        try:
            await self.send(
                message,
                destination=self.recipient,
                from_mod=True,
                anonymous=anonymous,
                plain=plain,
            )
        except Exception as e:
            logger.error("Message delivery failed:", exc_info=True)
            if isinstance(e, discord.Forbidden):
                description = ("Your message could not be delivered as "
                               "the recipient is only accepting direct "
                               "messages from friends, or the bot was "
                               "blocked by the recipient.")
            else:
                description = ("Your message could not be delivered due "
                               "to an unknown error. Check `?debug` for "
                               "more information")
            tasks.append(
                message.channel.send(embed=discord.Embed(
                    color=self.bot.error_color,
                    description=description,
                )))
        else:
            # Send the same thing in the thread channel.
            msg = await self.send(message,
                                  destination=self.channel,
                                  from_mod=True,
                                  anonymous=anonymous,
                                  plain=plain)

            tasks.append(
                self.bot.api.append_log(
                    message,
                    message_id=msg.id,
                    channel_id=self.channel.id,
                    type_="anonymous" if anonymous else "thread_message",
                ))

            # Cancel closing if a thread message is sent.
            if self.close_task is not None:
                await self.cancel_closure()
                tasks.append(
                    self.channel.send(embed=discord.Embed(
                        color=self.bot.error_color,
                        description="Scheduled close has been cancelled.",
                    )))

        await asyncio.gather(*tasks)
        self.bot.dispatch("thread_reply", self, True, message, anonymous,
                          plain)
コード例 #20
0
ファイル: thread.py プロジェクト: AlbertWheadon/modmail
    async def reply(self, message: discord.Message, anonymous: bool = False) -> None:
        if not message.content and not message.attachments:
            raise MissingRequiredArgument(param(name="msg"))
        if all(not g.get_member(self.id) for g in self.bot.guilds):
            return await message.channel.send(
                embed=discord.Embed(
                    color=discord.Color.red(),
                    description="Din besked kunne ikke blive leveret siden "
                    "personen ikke deler nogen server med botten.",
                )
            )

        tasks = []

        try:
            await self.send(
                message, destination=self.recipient, from_mod=True, anonymous=anonymous
            )
        except Exception:
            logger.info(error("Message delivery failed:"), exc_info=True)
            tasks.append(
                message.channel.send(
                    embed=discord.Embed(
                        color=discord.Color.red(),
                        description="Din besked blev ikke leveret siden "
                        "personen kun accepterer direkte "
                        "beskeder fra venner, eller botten er "
                        "blokeret af personen.",
                    )
                )
            )
        else:
            # Send the same thing in the thread channel.
            tasks.append(
                self.send(
                    message,
                    destination=self.channel,
                    from_mod=True,
                    anonymous=anonymous,
                )
            )

            tasks.append(
                self.bot.api.append_log(
                    message,
                    self.channel.id,
                    type_="anonymous" if anonymous else "thread_message",
                )
            )

            # Cancel closing if a thread message is sent.
            if self.close_task is not None:
                await self.cancel_closure()
                tasks.append(
                    self.channel.send(
                        embed=discord.Embed(
                            color=discord.Color.red(),
                            description="Den planlagte lukning er blevet annulleret.",
                        )
                    )
                )

        await asyncio.gather(*tasks)
コード例 #21
0
 async def on_endvote_error(self, exception, ctx):
     if isinstance(exception, MissingRequiredArgument()):
         await self.bot.send_message(
             ctx.message.channel,
             "Oops, I need a message id to end the vote")
コード例 #22
0
    async def reply(self,
                    message: discord.Message,
                    anonymous: bool = False,
                    plain: bool = False) -> None:
        if not message.content and not message.attachments:
            raise MissingRequiredArgument(SimpleNamespace(name="msg"))
        if not any(g.get_member(self.id) for g in self.bot.guilds):
            return await message.channel.send(embed=discord.Embed(
                color=self.bot.error_color,
                description="A mensagem não pode ser entregue pois o bot  "
                "não compartilha servidores com o recipiente.",
            ))

        tasks = []

        try:
            user_msg = await self.send(
                message,
                destination=self.recipient,
                from_mod=True,
                anonymous=anonymous,
                plain=plain,
            )
        except Exception as e:
            logger.error("Entrega de mensagem falhada:", exc_info=True)
            if isinstance(e, discord.Forbidden):
                description = ("A sua mensagem não pode ser entregue pois "
                               "o recipiente só está aceitando mensagens "
                               "de amigos ou o bot foi bloqueado "
                               "pelo recipiente.")
            else:
                description = ("Your message could not be delivered due "
                               "to an unknown error. Check `?debug` for "
                               "more information")
            tasks.append(
                message.channel.send(embed=discord.Embed(
                    color=self.bot.error_color,
                    description=description,
                )))
        else:
            # Send the same thing in the thread channel.
            msg = await self.send(message,
                                  destination=self.channel,
                                  from_mod=True,
                                  anonymous=anonymous,
                                  plain=plain)

            tasks.append(
                self.bot.api.append_log(
                    message,
                    message_id=msg.id,
                    channel_id=self.channel.id,
                    type_="anonymous" if anonymous else "thread_message",
                ))

            # Cancel closing if a thread message is sent.
            if self.close_task is not None:
                await self.cancel_closure()
                tasks.append(
                    self.channel.send(embed=discord.Embed(
                        color=self.bot.error_color,
                        description="Fecho calendarizado cancelado.",
                    )))

        await asyncio.gather(*tasks)
        self.bot.dispatch("thread_reply", self, True, message, anonymous,
                          plain)
        return (user_msg, msg)  # sent_to_user, sent_to_thread_channel