Cykooz/router_bot

Simple Telegram bot for router to send WoL packets for specified computers in local network.

★ 0Forks 0RustGitHub ↗Compare

README

Router Bot

A simple Telegram bot written in Rust that sends Wake-On-Lan (WOL) magic packets to wake up devices in your network.

Features

  • WOL over Telegram: Trigger magic packets from anywhere using a simple /wol command.
  • Per-Chat Configuration: Configure different MAC and IP addresses for different Telegram chats.
  • Easy Setup: Minimal configuration using environment variables.

Prerequisites

  • A Telegram Bot Token (from @BotFather).
  • Rust (2024 edition or later).
  • The target device must be configured to wake up on magic packets (WOL enabled in BIOS/UEFI and OS settings).

Configuration

The bot is configured via environment variables.

Variable Description Example
TELOXIDE_TOKEN Your Telegram Bot API token. 123456789:ABCdefGHIjklMNOpqrsTUVwxyZ
CHAT<id> Per-chat MAC address of target device. CHAT123456789=00:11:22:33:44:55
LOG_LEVEL Logging level (debug, info, warn, error). info
WITHOUT_ANSI_COLOR Disable ANSI colors in logs if set. 1

Chat-specific Configuration Example

If your Telegram Chat ID is 123456789, you would set: CHAT123456789=00:11:22:33:44:55

You can specify configuration for multiple chats.

Usage

Running the Bot

  1. Clone the repository.
  2. Set the environment variables.
  3. Run the bot using Cargo:
cargo run --release

Bot Commands

Once the bot is running, you can use the following commands in Telegram:

  • /help - Displays the available commands.
  • /wol - Sends the magic packet to the device configured for the current chat.

Example Scenario

  1. You have a PC at home with MAC address 00:11:22:33:44:55.
  2. You find your Telegram Chat ID (e.g., by using a bot like @userinfobot).
  3. You configure the environment:
    TELOXIDE_TOKEN=your_token_here
    CHAT123456789=00:11:22:33:44:55
  4. You start the bot.
  5. In your Telegram chat, you type /wol.
  6. The bot sends the magic packet and replies: WOL packet sent to 00:11:22:33:44:55.

Contributors

Cykooz

Issues