#How to make the bot send stuff in discord
1 messages · Page 1 of 1 (latest)
Hey! Once your issue is solved, press the button below to close this thread!
@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
@listen()
async def on_message_create(ctx: MessageCreate):
await ctx.message.channel.send(...)
And how would I get the message contents?
ctx.message.content?
Yup
Would I have to define MessageCreate? It's giving me the error name 'MessageCreate' is not defined
You can delete typing MessageCreate if you don't need ide help
It's typing
I do not understand that message at all, could you like simplify it or something, I'm dyslexic.
@listen()
async def on_message_create(ctx):
await ctx.message.channel.send(...)
Google python typing
Back to this, it's not returning anything. Like it's not throwing an error, but it also doesn't have a value. I told it to just print ctx.message.content to the console but there's still just nothing.
Did you enable the message content intent?
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
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:
- Go to the Discord developer portal.
- Select your application.
- In the "Bot" tab, go to the "Privileged Gateway Intents" category and scroll down to "Message Content Intent".
- 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!
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.
Along with this question, how would I see who was talking. And would it be possible to make the bot listen to multiple people individually, that way the speech to text doesnt stop working because multiple people were talking
as far as i know, no the bot can;t listen to individual.
There are moderation bots that offer recording voice calls for you, I never looked into voice call stuff but I’m sure its possible
You’ll have to look into the documentation, since unfortunately I haven’t used this myself. But I found this for starters:
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.
I found another library using discord.py that looks like it should work for what I need it to do, but if it doesn't work I'll definitely keep this in mind
Sounds perfect