0

Look at my code down here / This is the output: Traceback (most recent call last): File "C:\Games\Coding\tickets.py", line 8, in @client.event ^^^^^^^^^^^^ AttributeError: module 'discord.client' has no attribute 'event'

Code:

import discord
from discord.ext import commands

client = commands.bot

@client.event
async def on_ready():
    print("Bot is ready to execute action")

What is going wrong here?

1 Answer 1

0

It's commands.Bot and you need to call it with command_prefix parameter.

from discord.ext import commands

client = commands.Bot(command_prefix='!')

@client.event
async def on_ready():
    print("Make something with the bot")

client.run('BOT_TOKEN')
Sign up to request clarification or add additional context in comments.

3 Comments

Ty very much the bot is online now ❤️ But I still get this error code: 2024-04-06 15:20:33 WARNING discord.ext.commands.bot Privileged message content intent is missing, commands may not work as expected.
@Thatonenoobcoder you can look at here about the issue: stackoverflow.com/questions/73458847/…
You can mark my answer as solved the question if it solves your problem, thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.