Need Help With Discord Bot Thing

Question:
I am making a discord bot for fun and it keeps giving me the same error.
Repl link:
main.py - Test Bot - Replit

import discord as dis
import os as OS
client = dis.Client()

@client.event
async def on_ready():
  print('We have logged in as {0.user}'.format(client))
@client.event
async def on_messaeg(msg):
  if msg.author == client.user:
    return
  if msg.content.startwith('//hello'):
    await msg.channel.send('Hello, how are you?')
client.run(my_secret)

For sure there is a typo in a def statement …

2 Likes

As fpessolano pointed out, there’s a typo in your function name:

I believe this should be named on_message.

1 Like

@MattDESTROYER made it very easy now … I tried to be less easy. Let us know if this fixes everything.

2 Likes

I did that the error is on line 3 (Prob should have put that up there…)
Pic:
image

Try something like this (based on this documentation):

client = dis.Client(intents=dis.Intents.default())

Or in a more readable way

intents = dis.Intents.default()
intents.members = True

client = dis.Client(intents=intents)
1 Like

How is that… More readable?

Hey, do you know what area where the hidden thing is supposed to be in?

@MattDESTROYER @QwertyQwerty88 Do you know what the file name is supposed to be for the hidden thing?

You mean the secret token?

Yes, sir, that is correct. I am sorry for all the questions by the way. @whileTRUEpass

You need to get one from the discord portal and make sure you do not share it with the world here …

1 Like

You also need the message_content intent, but I would recommend a slash command bot for performance, ease and so your bot doesn’t break when it goes in enough servers to need, and be declined, verification for message_content intent.

2 Likes

One liners and walrus are fun but not necessarily readable :slight_smile:

I still don’t know what walrus is lol. But I don’t think your answer is more readable than Matt’s.

2 Likes

What walrus are you referring to? (Feel free to reply on matrix if it’s off-topic)

2 Likes

5 posts were split to a new topic: What is matrix?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.