The Discord Windows Controller Bot is a Python bot designed to control Windows operations through Discord commands. It can perform tasks like locking your workstation and monitoring mouse movement in a specified channel as well as saving files you send to the local workstation. Follow these steps to set up and run the bot.
First, clone the repository to your local machine. Open a terminal or command prompt and navigate to the folder where you want to store your bot's files. Then, use the following command:
git clone https://github.com/EpicBotCoders/python-discord-windows-controller.git
Navigate to the cloned repository's folder using the cd
command:
cd python-discord-windows-controller
Set up a virtual environment to manage your project's dependencies. This step is optional but recommended:
python -m venv venv
Activate the virtual environment:
- On Windows:
venv\Scripts\activate
- On macOS and Linux:
source venv/bin/activate
Install the necessary libraries for your bot using the following command:
pip install -r requirements.txt
If you encounter an error message similar to the following:
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
This error occurs because some packages require compilation, and your system is missing the necessary tools. To resolve this:
-
Install Microsoft Visual C++ Build Tools:
- Go to https://visualstudio.microsoft.com/visual-cpp-build-tools/
- Download and run the installer
- In the installer, select "C++ build tools" and install it
-
After installation, restart your computer.
-
Try running the pip install command again:
pip install -r requirements.txt
If you still face issues, try the following:
-
Update pip and setuptools:
pip install --upgrade pip setuptools wheel
-
If problems persist, please open an issue on the GitHub repository for further assistance.
-
Go to the Discord Developer Portal: Discord Developer Portal
-
Click on "New Application" and give your bot a name.
-
Under the "Token" section, click "Reset Token" then copy your bot's token.
-
Under the "Privileged Gateway Intents," select "MESSAGE CONTENT INTENT"
- In the project folder, create a text file named "key.txt."
- Paste the copied bot token into the "key.txt" file and save it.
- Get your Channel ID and your own ID from Discord, and paste them into the "config.json" file.
- Create a folder where you would want the files to be saved to locally, and copy the path to the
file_save_path
variable
Example:
{
"command_channel_id": 1137276176451079374,
"author_id": 637917562920429309,
"log_channel_id": 1137693326543122128,
"mouse_log_channel_id": 1137693326543123128,
"file_save_path": "insert/file/path"
}
-
Invite your bot to a Discord server:
- In the Developer Portal, go to the "OAuth2" section.
- Under "OAuth2 URL Generator," select the "bot" scope and the required permissions.
- Copy the generated URL and open it in a browser. Follow the prompts to add the bot to a server.
-
In the terminal, navigate to the project folder and activate the virtual environment if you created one.
-
Run the bot using the following command:
python bot.py
- In the server where your bot is added, send a message with the content "lock" in the designated channel.
- The bot should respond by locking the workstation and sending a confirmation message.