0
votes

So I was following a Python Discord tutorial on creating a Discord bot. When I run the code, it said "AttributeError: module 'discord.client' has no attribute 'event'". When I searched online, most of the answers were confusing. I am using repl.it right now and tries it on Pycharm. Both ending up with the same error.
FYI: I removed the client.run so the token won't be revealed.

import discord
import os

client = discord.client


@client.event
async def on_ready():
    print('We have logged in as {0.user}'.format(client))

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

    if message.content.startswith("%Wilson"):
        await message.send.channel("I can ping you!")
1

1 Answers

0
votes

Try

client = discord.Client()

This should work