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://i.sstatic.net/abkjP.jpg
Try adding this at the line above commands.Bot
intents.message_content = True