#๐Ÿ”’ discord bot i need help with this

33 messages ยท Page 1 of 1 (latest)

lean musk
#

so i am currently making a discord bot that looks up a tiktok username and gives you the information about it
but i can't find the command when you hit enter it searches it for you example !search and then the bot starts doing its thing, this is the source https://paste.pythondiscord.com/3ZHQ

silver nightBOT
#

@lean musk

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

formal isle
#

get inn

#

discord question

lean musk
formal isle
lean musk
formal isle
#

also im pretty sure you can solve this with a simple get request

lean musk
formal isle
lean musk
#

does it anywhere say what the command is?

formal isle
lean musk
#

so if i typr

#

!on_message @example

silver nightBOT
#
The discord.py `on_message` event

Registering the on_message event with @bot.event will override the default behavior of the event. This may cause prefix commands to stop working, because they rely on the default on_message event handler.

Instead, use @bot.listen to add a listener. Listeners get added alongside the default on_message handler which allows you to have multiple handlers for the same event. This means prefix commands can still be invoked as usual. Here's an example:

@bot.listen()
async def on_message(message):
    ...  # do stuff here

# Or...

@bot.listen('on_message')
async def message_listener(message):
    ...  # do stuff here

You can also tell discord.py to process the message for commands as usual at the end of the on_message handler with bot.process_commands(). However, this method isn't recommended as it does not allow you to add multiple on_message handlers.

If your prefix commands are still not working, it may be because you haven't enabled the message_content intent. See /tag message_content for more info.

lean musk
#

it sends the information ?

formal isle
#

nope

#

they're two fundamentally different things

#

an event listener just listens for when an event takes place

#

this could be a message, a profile change, a status change, etc

#

a command is exclusively run

#

and also has a lot more functionality than with a message listener

lean musk
#

for like 2 hours

formal isle
#

lmao

novel escarp
#

You should check out #discord-bots and read the pinned messages.

formal isle
lean musk
#

ty

formal isle
#

that code only runs when a message has "tiktok.com" in it

#

it doesnt even need a prefix

silver nightBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.