Skip to content

Latest commit

ย 

History

History
122 lines (89 loc) ยท 3.81 KB

File metadata and controls

122 lines (89 loc) ยท 3.81 KB

โœจ TaskBot for Discord

A simple but powerful task management bot with a live updating board, reminders, deadlines, and team member tagging โ€” all controlled through Discord UI buttons.


๐Ÿš€ Setup (5 minutes)

1. Create a Discord Application

  1. Go to https://discord.com/developers/applications
  2. Click New Application โ†’ name it "TaskBot"
  3. Go to Bot tab โ†’ click Add Bot
  4. Under Token โ†’ click Reset Token โ†’ copy the token
  5. Under Privileged Gateway Intents, enable:
    • โœ… Server Members Intent
    • โœ… Message Content Intent

2. Invite the Bot to Your Server

Go to OAuth2 โ†’ URL Generator:

  • Scopes: bot, applications.commands
  • Bot Permissions: Send Messages, Embed Links, Read Message History, Use Slash Commands, Manage Messages

Copy the generated URL and open it in your browser to invite the bot.

3. Install & Run

# Clone or download the bot files
cd discord-taskbot

# Install dependencies
npm install

# Copy and fill in your token
cp .env.example .env
# Edit .env and paste your DISCORD_TOKEN

# Start the bot
npm start

๐ŸŽฎ How to Use

Commands

Command Description
/tasklist Posts the live task board in the current channel. Use this once to set up โ€” the board updates automatically!
/addtask Quickly add a task via command options
/settings Open server-wide settings panel

The Task Board

After running /tasklist, a pinned message appears with buttons:

Button Action
โž• Add Task Opens a form to add a task with title, description, assignees, deadline, reminder
โœ… Complete Pick a task to mark done
โœ๏ธ Edit Edit any existing task
๐Ÿ—‘๏ธ Delete Remove a task
โš™๏ธ Settings Configure timezone & working hours

Settings Panel

Setting Description
๐ŸŒ Set Timezone Server-wide timezone (e.g. Europe/Berlin)
๐Ÿ•˜ Work Hours Reminder window (e.g. 09:00 โ€“ 17:00)
๐Ÿ“… Work Days Which days to send reminders (0=Sun, 1=Mon, โ€ฆ 6=Sat)
๐Ÿ‘ค My Timezone Each member can set their own timezone for personal DM reminders

Reminders

  • Set reminder: yes when adding a task
  • Reminders are sent as DMs to assigned users
  • Only sent during working hours in the member's timezone
  • Escalate in urgency: ๐Ÿ”” normal โ†’ โš ๏ธ 3 days left โ†’ ๐Ÿšจ last day
  • Stop automatically when the deadline passes or task is completed

๐Ÿ“ File Structure

discord-taskbot/
โ”œโ”€โ”€ bot.js              # Main entry point
โ”œโ”€โ”€ commands.js         # Slash command logic
โ”œโ”€โ”€ buttonHandlers.js   # Button click handlers
โ”œโ”€โ”€ modalHandlers.js    # Form submission handlers
โ”œโ”€โ”€ selectHandlers.js   # Dropdown selection handlers
โ”œโ”€โ”€ taskManager.js      # Data persistence (JSON files)
โ”œโ”€โ”€ embedBuilder.js     # Discord embed builder
โ”œโ”€โ”€ reminderService.js  # Background reminder scheduler
โ”œโ”€โ”€ deploy-commands.js  # Registers slash commands with Discord
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ .env.example
โ””โ”€โ”€ data/               # Auto-created
    โ”œโ”€โ”€ tasks.json      # Task data
    โ””โ”€โ”€ settings.json   # Settings data

๐Ÿ’ก Tips

  • Pin the task board message so it's always visible
  • Use /tasklist in a dedicated #tasks channel
  • Members can set their own timezone with the ๐Ÿ‘ค My Timezone button so reminders arrive at the right time for them
  • Completed tasks are kept (last 5 shown) so the board shows progress

๐Ÿ”ง Extending

  • Persistent storage: Replace data/*.json with a real database (SQLite, PostgreSQL) for large servers
  • Multiple boards: Modify taskManager.js to support per-channel boards
  • Recurring tasks: Add a recurrence field and handle in reminderService.js