#How to make the bot send stuff in discord

1 messages · Page 1 of 1 (latest)

jade agate
#

This turned into way more of an issue than I thought it would, so I'm making this now

raw kestrelBOT
#

Hey! Once your issue is solved, press the button below to close this thread!

jade agate
#

@errant musk I'm still not seeing anywhere in the document where it says how to send a message to discord using that bot. I'm trying to do whatasync def on_message(message): await message.channel.send('message here') does, but in interactions.py

#

And I've already replaced on_message with on_message_create

errant musk
#
@listen()
async def on_message_create(ctx: MessageCreate):
    await ctx.message.channel.send(...)
jade agate
#

And how would I get the message contents?
ctx.message.content?

errant musk
#

Yup

jade agate
#

Would I have to define MessageCreate? It's giving me the error name 'MessageCreate' is not defined

errant musk
#

You can delete typing MessageCreate if you don't need ide help
It's typing

jade agate
#

I do not understand that message at all, could you like simplify it or something, I'm dyslexic.

errant musk
#
@listen()
async def on_message_create(ctx):
    await ctx.message.channel.send(...)
#

Google python typing

jade agate
lost sonnet
#

Did you enable the message content intent?

jade agate
#

I didn't mess with the intent from the example, it's still set to default

#

And it can see messages, like I got it to respond to messages sent, it just won't give me the content

raw kestrelBOT
#

Did you try to read a message but to your surprise it was an empty string? Or you saw a message telling you that the message content is disabled and you want to enable it?

Here is how you enable the message content intent in Discord:

  1. Go to the Discord developer portal.
  2. Select your application.
  3. In the "Bot" tab, go to the "Privileged Gateway Intents" category and scroll down to "Message Content Intent".
  4. Enable the toggle.
    • If your bot is verified or in more than 100 servers, you need to apply for the intent in order to toggle it.

But wait! You aren't done yet!
You need to add the intent in your client as well:

client = interactions.Client(..., intents=interactions.Intents.DEFAULT | interactions.Intents.MESSAGE_CONTENT)  # specifically message content, not just messages

Your bot can now receive message contents!

jade agate
#

Unrelated question, how would I join a vc and then get a live feed of the audio from said vc? I'm trying to make my bot have the ability to join a vc and create a live transcript of the conversation.

jade agate
hearty bolt
stark dew
stark dew
#

Documentation is your best friend, it took me like 40 seconds to find that page. With a lil more digging, you’ll probably find exactly what you need.

jade agate