I have two pieces of code that look like this, with the discord link differing depending on the channel that the command is run in.
I have added “=CHANNEL_NAME” onto channel, which isolates the command to that stream. However, if I run the !discord command in one channel, it automatically runs the !discord command in the other channel.
Is there a way to isolate commands to just one channel, whilst having the option for multiple channels to use the bot?
If that is the case, your bot will always send the link to the #someChannel channel, and not to the channel you write the command in.
If I understand your needs correctly, you want your bot to respond with the link DISCORD_LINK, but only if the '!discord' command is used in the channel CHANNEL_NAME, otherwise it should do nothing?
If that is the case you can use an if statement to prevent it from responding if not the right channel.
Something like this should do the trick, and if you want to add another channel - link combo, you just add another if statement:
One word of caution though. This soluting does not scale well. If you plan to have your bot in a lot of channels, each with their own commands, you should not hardcode it in your message handler. Use a database to store the commands of each channel, and then load them when needed.