Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions docs/extensions/commands/prefixed-commands.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ async def on_message(message):
import discord
from discord.ext import commands

bot = commands.Bot(command_prefix="!")
intents = discord.Intents.default()
intents.message_content = True

bot = commands.Bot(command_prefix="!", intents=intents)

@bot.command()
async def ping(ctx):
Expand Down Expand Up @@ -183,7 +186,10 @@ import discord
from discord.ext import commands # Import the commands extension
# discord.ext.commands are not the same as discord.commands!

bot = commands.Bot(command_prefix="!") # You can change the command prefix to whatever you want.
intents = discord.Intents.default() #Defining intents
intents.message_content = True # Adding the message_content intent so that the bot can read user messages

bot = commands.Bot(command_prefix="!", intents=intents) # You can change the command prefix to whatever you want.

@bot.command() # This is the decorator we use to create a prefixed command.
async def ping(ctx): # This is the function we will use to create the command.
Expand Down