Skip to content

kekivelez/timeLordBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TimeLord Bot 🕐

A Discord bot that monitors channels for time mentions and replies with Discord-formatted timestamps. For lazy admins who can't be bothered to use @time

Features

  • 🔍 Smart Time Parsing: Detects times like "12 utc", "19:30 UTC", "at 20", "3pm utc"
  • 🌍 UTC Assumption: All times are assumed to be UTC
  • 🧠 Smart Date Inference: If a time has already passed today, assumes tomorrow
  • 📝 Discord Timestamps: Replies with both full (<t:unix:F>) and relative (<t:unix:R>) formats
  • 🚫 No Self-Replies: Bot ignores its own messages

Quick Start

1. Clone and Install

git clone <repository-url>
cd timeLordBot
npm install

2. Configure Discord Bot

  1. Go to Discord Developer Portal
  2. Create a new application
  3. Go to "Bot" section and create a bot
  4. Copy the bot token
  5. Enable "Message Content Intent" under Privileged Gateway Intents

3. Set Up Environment

cp .env.example .env
# Edit .env and add your DISCORD_TOKEN

Optional: Configure Channel Filtering

By default, the bot monitors ALL channels. To restrict it to specific channels:

  1. Enable Developer Mode in Discord:

    • User Settings → App Settings → Advanced → Enable Developer Mode
  2. Get channel IDs:

    • Right-click the channel → Copy Channel ID
  3. Add to .env:

    CHANNEL_IDS=123456789012345678,987654321098765432
    

If CHANNEL_IDS is empty or unset, the bot monitors all channels (backward compatible).

4. Run the Bot

npm start

For development with auto-reload:

npm run dev

Example Usage

User posts:

"Pass opens at 12 utc"

Bot replies:

🕐 Time(s) detected:

at 12 utc → <t:1234567890:F> | <t:1234567890:R>

Supported Time Formats

  • 12 utc - 12:00 UTC
  • 19:30 UTC - 19:30 UTC
  • at 20 - 20:00 UTC
  • 3pm utc - 15:00 UTC
  • 3:30pm - 15:30 UTC
  • at 12:30 - 12:30 UTC

Deployment on Azure VPS

Using PM2 (Recommended)

# Install PM2 globally
npm install -g pm2

# Start the bot
pm2 start src/index.js --name timelordbot

# Set to start on system boot
pm2 startup
pm2 save

Using systemd

Create a service file at /etc/systemd/system/timelordbot.service:

[Unit]
Description=TimeLord Discord Bot
After=network.target

[Service]
Type=simple
User=your-user
WorkingDirectory=/path/to/timeLordBot
ExecStart=/usr/bin/node src/index.js
Restart=always
Environment=NODE_ENV=production

[Install]
WantedBy=multi-user.target

Then:

sudo systemctl enable timelordbot
sudo systemctl start timelordbot
sudo systemctl status timelordbot

Project Structure

timeLordBot/
├── src/
│   ├── index.js       # Main bot entry point
│   └── timeParser.js  # Time parsing logic
├── .env               # Environment variables (not in git)
├── .env.example       # Environment template
├── package.json       # Node.js dependencies
└── README.md          # This file

License

ISC

About

Discord bot that monitors channels for time mentions and replies with Discord-formatted timestamps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors