The source for a Discord bot script that, while running, can take python code from within a Discord channel, execute it, and return the output back on the same channel.
- A version of Python 3.x
- discord.py - Easiest way to install is by running
pip install discord
in a terminal. - ConsoleToStr.py - Can be obtained from here.
- A Discord Bot account - can be obtained from the Discord Developer Portal.
- Grab the latest source code archive(.zip) from here.
- Extract the file into a folder of your choice on your machine.
- Open
main.py
with a text editor and change the value ofcommand_prefix
to a prefix of your choice. (Default isp.
) - Scroll down to the bottom of
main.py
and change<ENTER TOKEN HERE>
to your Bot's token. - Save the changes and run main.py. (can be run by simply double clicking the file)
run
: Runs the code that is provided to the bot from a message. Usage ofrun
:
<prefix>run ```python
<Enter code here>
```
files
: Returns all the files that are stored in the current working directory of the script. Usage offiles
:
<prefix>files
remove
: Removes a file from the current working directory of the script.
<prefix>remove <filename>