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)
评论列表
文章目录