Ask coding questions

← Back to all posts
Discord Commands
ReshiramWolfu

I want to make a discord bot respond to commands, and i have this code so far, can anyone help me do a command so that it will respond to anything after an exclamation mark, like this !respond
https://repl.it/@ReshiramWolfu/Alter-Ego-Bot-Discord

Voters
rendellpilpil
truchorko2
Kiriotoyt
matiasopazosala
Testerw4341231
neroPika
OfficialZufluch
FamiliaContrera
cristianosilva4
CLIPSCMD2kCMD2k
Comments
hotnewtop
TheDrone7

I might not be able to help you with something like that, since all you need to do is add a little logic, I can provide you with a few links for reference though: -
Discord.py documentation - http://discordpy.readthedocs.io/en/async/
A tutorial: https://pythonprogramming.net/discordpy-basic-bot-tutorial-introduction/
( This is part 1 that you've probably already completed. Still you should go through it.)
Part 2 is what you really need - https://pythonprogramming.net/building-bot-commands-discordpy-bot-tutorial/?completed=/discordpy-basic-bot-tutorial-introduction/

You might also want to go through this if you're planning to keep your bot on repl.it - https://repl.it/talk/learn/Hosting-discordpy-bots-with-replit/11008

Also, you are using discord.py-async , I recommend shifting to discord.py-rewrite, it's newer and already better than discord.py-async in many aspects and is also being improved!

xnfdeveloper

eample if (message.content.startsWith('beep')) {
message.channel.send('Boop.');
}