My Discord bot is not responding to messages/not even outputting to terminal?

Question:

Trying to make a sorta complicated bot, but before i get started on writing the other code I wanted to just make sure that the bot worked in Discord, and was up and running and responding to a basic command – Send the message "Hello" when someone used the command "!hello".

import discord
from discord.ext import commands

intents = discord.Intents.default()
intents.members = True
bot = commands.Bot(command_prefix='!', intents=intents)
TOKEN = "TOKEN"

@bot.event
async def on_ready():
    print(f'Bot connected as {bot.user}')


@bot.command(name='hello')
async def dosomething(ctx):
    print(f'Hello command made')
    await ctx.send("Hello!")

  bot.run(TOKEN)

the on_ready function does work, it outputs the name of the bot whenever it connects, but trying to get it to respond to a simple !hello command does nothing, it doesnt message in the channel and it doesn’t print to console. Here’s my permissions for the bot as well from Discord Developer Portal – https://imgur.com/a/xrcH1tw

Asked By: Squidley

||

Answers:

Try adding this at the line above commands.Bot

intents.message_content = True
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.