blacklist.py 文件源码

python
阅读 60 收藏 0 点赞 0 评论 0

项目:pcbot 作者: pckv 项目源码 文件源码
def delete_message(message: discord.Message, response: str, pattern: str):
    """ Remove the message and send a response if there is one. 

    :param message: The discord message to delete.
    :param response: The optional response to send, found in a BlacklistConfig.
    :param pattern: The match pattern found in the deleted message, optional for the response. 
    """
    await client.delete_message(message)

    if response:
        # Parse the response message by replacing keywords
        response = response \
                   .replace("{user}", message.author.display_name) \
                   .replace("{mention}", message.author.mention) \
                   .replace("{channel}", message.channel.mention) \
                   .replace("{server}", message.server.name) \
                   .replace("{pattern}", pattern)

        await client.send_message(message.channel, response)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号