我正在尝试检测何时通过dm发送YouTube视频链接,是否可以这样做,如果可以,怎么办?
答案 0 :(得分:1)
如果我的理解是正确的,那应该会对您有所帮助。我试图让您尽可能清楚地修改代码
client = discord.Client() #Discord Client
@client.event
async def on_message(message): #Event handler for income messages
if message.author == client.user: #Stopping the bot from reading its on message
return None
word_to_check = 'example' #Word that you want to check in a string
response = 'this is the response'
if word_to_check in message.content:
await message.channel.send(response) #This responds to the channel the message containing "word_to_check" came from