Skip to content

aymenelouadi/discord-subscription-bot

Repository files navigation


Discord Subscription Bot
Discord Subscription Bot

Version License Node.js Discord

A fully automated role-based subscription management bot for Discord.
Handles subscriptions, expirations, renewals, notifications, charts, and diagnostics — all from slash commands.


🔗 Links

📦 Prerequisites

🚀 Getting Started

  • Download the project in Visual Studio Code, open a terminal via ``CTRL + SHIFT + ``` and run:
npm install
  • Fill in config.json with your credentials.
  • Start the bot:
node index.js

If you use hosting:

  • Upload the project as .zip and extract it.
  • Fill in config.json.
  • Run the bot from your hosting panel.

If you need help, join the support server.


✨ Features ✨

💳 Subscription Management

  • Full lifecycle tracking: active → expired → cancelled.
  • Create, renew, cancel, and search subscriptions with a custom ID system.
  • Edit any subscription field (email, password, note, end date, status) without deleting it.

📬 Smart Notifications

  • DM alerts at configurable stages: 7, 3, and 1 day before expiry.
  • Scheduled reminders stored in the database and delivered automatically via cron.
  • Owner alerts when a user's DM fails.

📊 Charts & Statistics

  • /stats — comprehensive database dashboard.
  • /chart — 4 visual types: status bar, status donut, plans bar, services bar, and monthly timeline.
  • Rendered server-side with @napi-rs/canvas — no external service required.

🔍 Search & Edit

  • /search — find any subscription by customId, userId, email, planName, or serviceType.
  • /edit — update fields on an existing subscription with old→new change tracking in the log.

🔬 Diagnostics

  • /test — instant health report: WS ping, MongoDB state, config validation, uptime, and memory.

🔒 Security & Permissions

  • Owner-only access for all admin commands.
  • Configurable log channels via /setlog.

📁 Configuration

  • config.json for credentials; setting.json for behaviour, names, descriptions, and emoji palette.
  • Per-command enable/disable toggle via /enable.

🕒 Auto Expiry System

  • Daily midnight cron + configurable interval (default every 12 h).
  • Marks expired subscriptions automatically and notifies owners.
  • Hourly cron for scheduled reminder delivery.

✨ Command Reference ✨

📋 Subscription Commands

Command Description Access
/subscribe Create a new subscription 🔑 Admin
/unsubscribe Cancel a subscription by custom ID 🔑 Admin
/renew Renew an existing subscription 🔑 Admin
/subscriptions Paginated list of all subscriptions with filters 🔑 Admin
/info View a user's own subscription details 🌐 Public
/search Search by ID, email, user, plan, or service type 🔑 Admin
/edit Edit email, password, note, end date, or status 🔑 Admin

🔔 Notification Commands

Command Description Access
/check Manually run subscription expiry check 🔑 Admin
/remind Send immediate or scheduled reminder to a user 🔑 Admin
/announce Broadcast a message to all active subscribers 🔑 Admin

📊 Analytics Commands

Command Description Access
/stats Full database statistics dashboard 🔑 Admin
/chart Generate bar, donut, or timeline charts 🔑 Admin

⚙️ Management Commands

Command Description Access
/clearexpired Bulk delete all expired subscription records 🔑 Admin
/setlog Configure log channels 🔑 Admin
/enable Toggle any command on or off 🔑 Admin
/owner_add Add a user to the owner list 🔑 Admin
/owner_remove Remove a user from the owner list 🔑 Admin
/plan_add / /plan_remove Manage available subscription plans 🔑 Admin
/type_add / /type_remove Manage available service types 🔑 Admin
/help Paginated command reference 🌐 Public
/test Bot diagnostics (ping, DB, config validation) 🔑 Admin

📜 License & Copyright

  • © 2025 Code Nexus. All rights reserved.

About

A fully automated Discord subscription bot that allows server admins to manage premium role subscriptions, track active, expired, or cancelled plans, send notifications, and provide a clean, user-friendly interface with buttons, embeds, and pagination. Ideal for managing free and premium subscriptions with full control and logs

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors