Skip to content
Advertisement

Have a search command on discord.py

would like to know if it’s possible to add a search command to my discord bot, I will basically use the command to find files inside a directory. For example there is a file named name.txt, and I could do /search nam and it would search for this file and output the name of similar files in the directory.

Advertisement

Answer

It’s simple, just import listdir from os module and give folder path to listdir function then add one parameter in the command which will be used to match the files in the given path.

Try following code:

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