简体   繁体   中英

discord.py bot not sending messages

import discord

client = discord.Client(intents=discord.Intents.default())

@client.event
async def on_ready():
    print("Logged in as {0.user}".format(client))

@client.event
async def on_message(message):
    if message.author == client.user:
        return

    if message.content.startswith("Hello"):
        await message.channel.send("Hi")
client.run("Token")

this is a code i basically copied from a tutorial, and even tho it is a 1 to 1 copy of the code shown it still doesn't send messages

Go to https://discord.com/developers/applications/YOUR_BOT_ID/bot and enable the message content intent

you can also try to replace discord.Intents.default() by discord.Intents.all()

Hope it helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM