A Discord bot that verifies users' Fitbit accounts and manages their roles based on their Fitbit profile data. The bot uses Discord's Role Connections feature to automatically update user roles based on their Fitbit profile information.
- Connect Discord accounts with Fitbit profiles
- Automatic role updates based on Fitbit profile data:
- Average daily steps
- Fitbit Ambassador status
- Membership duration
- Coach status
- Slash commands for user interaction
- Secure OAuth2 authentication flow
- Automatic token refresh and management
- Node.js 22 or higher
- A Discord application with bot token
- A Fitbit application with API credentials
- Cloudflare Workers account (for deployment)
- Clone this repository:
git clone https://github.com/JustinBeckwith/fitbit-discord-bot.git
cd fitbit-discord-bot- Install dependencies:
npm install-
Rename
example.dev.varsto.dev.vars, and add all required fields. -
Register the bot's commands and metadata schema:
npm run register-commands
npm run register-metadata-schemaTo run the bot locally:
npm run devThis will start the development server on port 3000.
The bot provides the following slash commands:
/connect- Start the process of connecting your Fitbit account/disconnect- Disconnect your Fitbit account and remove associated roles/get-profile- View your current Fitbit profile data
The bot is designed to be deployed on Cloudflare Workers. To deploy:
wrangler deploy