📋 Prerequisites

  • Python 3.8 or higher installed
  • Git installed (for cloning the repository)
  • Discord account and a Discord server (or create one)
  • Discord bot token (from Discord Developer Portal)
  • Your Discord User ID
  • Windows/Mac/Linux operating system

Step 1️⃣ Create a Discord Bot

  1. Go to Discord Developer Portal
  2. Click "New Application" and give it a name: "Laptop Control Bot"
  3. Go to the "Bot" section and click "Add Bot"
  4. Under TOKEN, click "Copy" to copy your bot token (keep this secret! 🔐)
  5. Go to "OAuth2" → "URL Generator"
  6. Select scopes: bot
  7. Select permissions: Administrator
  8. Copy the generated URL and open it in your browser to invite the bot to your server
⚠️ Important: Never share your bot token! It's like your bot's password.

Step 2️⃣ Clone the Repository

Open PowerShell/Command Prompt and run:

git clone https://github.com/Naveen022006/laptop-control-application.git cd laptop-control-application

Or download the ZIP directly from GitHub and extract it.

Step 3️⃣ Create a Virtual Environment

Open PowerShell in the bot directory and run:

python -m venv venv

Activate the virtual environment:

.\venv\Scripts\activate

You should see (venv) at the beginning of your command prompt.

Step 4️⃣ Install Required Dependencies

With the virtual environment activated, run:

pip install -r requirements.txt

This installs all necessary Python packages.

Step 5️⃣ Configure Environment Variables

Create a .env file in the main directory with:

DISCORD_TOKEN=your_bot_token_here AUTHORIZED_USERS=your_user_id_here

Example:

DISCORD_TOKEN=MTk4NjIyNDgzNzA=.ClssqA.1234567890 AUTHORIZED_USERS=123456789012345678

To find your User ID:

  • Enable Developer Mode in Discord (Settings → Advanced → Developer Mode)
  • Right-click your username and select "Copy User ID"
⚠️ Security Warning: Never commit the .env file to GitHub! It contains sensitive information.

Step 6️⃣ Run the Bot

Make sure your virtual environment is activated, then run:

python bot.py

You should see output like:

Logged in as YourBotName (123456789) ------ Bot is ready to receive commands.

Step 7️⃣ Test the Bot

Go to your Discord server and try a command:

!screenshot

The bot should respond with a screenshot of your laptop.

✅ Success! Your bot is now running! Try other commands like !sysinfo or !speak "Hello"

❌ Troubleshooting

Bot doesn't respond to commands:

  • Check that your User ID is in the .env file under AUTHORIZED_USERS
  • Make sure the bot has Administrator permissions
  • Verify your DISCORD_TOKEN is correct
  • Check that the bot is online in your Discord server

ImportError or missing packages:

  • Make sure you're in the virtual environment: .\venv\Scripts\activate
  • Reinstall requirements: pip install -r requirements.txt
  • Ensure Python 3.8+ is installed: python --version

Commands execute but give errors:

  • Check the console output for error messages
  • Some commands may require specific software (e.g., Chrome for !chrome_search)
  • Ensure your system has the necessary permissions

⚙️ Advanced Setup

Run Bot on Startup (Windows)

Use the included setup_startup.py script:

python setup_startup.py

This will set up the bot to run automatically when your laptop starts.

Multiple Authorized Users

Add multiple user IDs separated by commas in .env:

AUTHORIZED_USERS=123456789,987654321,111222333

❓ Need Help?