Skip to content
Advertisement

How to receive and send message to specific channel in Discord.py?

Yesterday I was working on something simple where a bot on command of !name Barty would print back Hello Barty

JavaScript

However the problem I am facing at this moment is that the bot would response to any channel where I do use the !name XXXX and what I am trying to do is that I want only to react to given specific channel in discord.

I tried to do:

JavaScript

but that was completely not working and I am out of ideas and here I am.

How can I send command to a given specific channel and get back response from there?

Advertisement

Answer

Move the define code out of the IF statement:

JavaScript

When you’ve done that, you should be able to do;

JavaScript

Could also check out the docs: https://discordpy.readthedocs.io

Once you make the command, make the IF statement inside of that.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement