admin管理员组文章数量:1318580
I wrote a Discord bot that is supposed to repeat messages that were deleted by users. It responds to a ping without issue, and it composes a message if someone deletes a message, but it does not retrieve the content of the message that was deleted. The only time it is able to retrieve the content of a deleted message is if it was pinged in the message. Ex: if a message "@bot, this is a deleted message" was deleted then the bot will be able to retrieve it, but if a message "this is a deleted message" was deleted, when trying to retrieve the message it will spit out a no content
error.
I am a novice at Python and would love any pointers. I have included my code below, with comments. Thank you.
import discord
import os
from flask.app import cli
from keep_alive import keep_alive
from discord.ext import commands
intents = discord.Intents.default()
intents.message_content = True
intents.messages = True
client = discord.Client(intents=discord.Intents.default())
token = os.getenv('token.env')
# Event to detect and log deleted messages
@client.event
async def on_message_delete(message):
# Response message
response = (
f"
本文标签:
Python Bot That Repeats Deleted Messages on Discord (Issue)Stack Overflow
版权声明:本文标题:Python Bot That Repeats Deleted Messages on Discord (Issue) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人,
转载请联系作者并注明出处:http://www.betaflare.com/web/1742046732a2417829.html,
本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论