Does not recognize "client" #9400
Unanswered
AltRavenAR
asked this question in
Q&A
Replies: 2 comments 1 reply
-
What do you mean "doesn't recognise"? |
Beta Was this translation helpful? Give feedback.
0 replies
-
the console says "AttributeError: 'Client' object has no attribute 'command'" |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The code does not recognize client. Did discord update to something new?
``
import os
import discord
intents = discord.Intents.default()
intents.message_content = True
client = discord.Client(intents=intents)
@client.event
async def on_ready():
print('we have logged in as {0.user}'.format(client))
@client.command()
async def add(ctx, left: int, right: int):
"""Adds two numbers together."""
await ctx.send(left + right)
@client.event
async def on_message(message):
if message.author==client.user:
return
if message.content.startswith('$hello'):
await message.channel.send('Hello!')
client.run(os.environ['TOKEN'])
``
Beta Was this translation helpful? Give feedback.
All reactions