Closed en0o0n closed 3 months ago
have you enabled message_content intent for your bot?
Thanks for the fast reply. Yes i did:
Have you tried to print the message from the on_message? it returns none or something else
Yes i have tried to print messages from other bots and it display it correctly but still music bot still ignoring it :
async def on_message(self, message: discord.Message, /) -> None: print(f"Message received from {message.author} (Bot: {message.author.bot}): {message.content}")
# Removing the check that ignores messages from bots
# if message.author.bot:
# return
if not message.guild:
print("Message not from a guild, ignoring.")
return
if self.user.id in message.raw_mentions and not message.mention_everyone:
prefix = await self.command_prefix(self, message)
if not prefix:
return await message.channel.send("I don't have a bot prefix set.")
await message.channel.send(f"My prefix is `{prefix}`")
await self.process_commands(message)
print("Processed commands for the message.")
the ouput is :
Message received from Writer#1622 (Bot: True): -play sia
Processed commands for the message.
Playing music with normal user "-play sia" works
Can you show the code of your on_message function?
i just edit the last message above
as you can see the normal user works but the bot dont haha and i have the same code
what else should i do?
I have tested again and it works fine
async def on_message(self, message: discord.Message, /) -> None:
# if message.author.bot or not message.guild:
# return False
if self.user.id in message.raw_mentions and not message.mention_everyone:
prefix = await self.command_prefix(self, message)
if not prefix:
return await message.channel.send("I don't have a bot prefix set.")
await message.channel.send(f"My prefix is `{prefix}`")
print(message.content)
await self.process_commands(message)
U are trying as Choco, its a normal user not an "app" or "bot"
make sure your bot has permission to read messages from your channel
The music bot is administrator and it read messages from the channel if i wrote it as a normal user But when i write messages as another bot then it ignores it
the message "No voice channel to connect. Please either provide one or join one." are send from the bot
Yeah i understand, can u please try to play a song like sending "!p test" from a bot not from Choco
oh, you are talking about running a command by a bot. Of course, it is not working because discord.py is not allowed. in the process commands function it will bypass all the bot message
how can i avoid that :c?
you can modify the process_commands function in discord.py module
oh wait no u can edit that in the main.py I just added explicit command invocation and now it worksssss
good to hear that :D
Thanks for your answers, talking helps always ^^ And thanks for the great music bot. Can i ask another feature here or shall i make a new iissue for it?
You are welcome!
I generally prefer using Discord. however, since GitHub is more familiar to you, let’s create a separate issue there to discuss another topic.
Hello there,
i must say this music bot is amazing. There is a feature i need, to make the bot listen to messages from other bots.
I tried to remove if message.author.bot from on_message but the music bot still ignore messages from other bots
Can you please help me with this.
Best regards, En0o0n