@@ -4,6 +4,7 @@ A Discourse plugin that integrates GitHub Sponsors with your Discourse forum, au
44
55## Features
66
7+ ### GitHub Sponsors Sync
78- ** GitHub API Integration** - Connects to GitHub GraphQL API with pagination support to fetch all active sponsors
89- ** Automatic Group Management** - Creates and manages a sponsors group with automatic membership updates
910- ** Scheduled Synchronization** - Background job runs every 6 hours to keep sponsor status up-to-date
@@ -13,6 +14,14 @@ A Discourse plugin that integrates GitHub Sponsors with your Discourse forum, au
1314- ** Sync History** - Track last 10 syncs with success/failure status and statistics
1415- ** User Account Linking** - Matches GitHub sponsors to Discourse users via OAuth
1516
17+ ### Discord Server Access (Optional)
18+ - ** Automated Discord Invites** - Generate single-use Discord server invites for active sponsors
19+ - ** Member Verification** - Check if sponsors are already on your Discord server
20+ - ** OAuth Integration** - Seamlessly integrates with Discord OAuth for account linking
21+ - ** Invite Tracking** - Admin dashboard showing invite history, usage statistics, and status
22+ - ** Webhook Notifications** - Get notified when sponsors generate Discord invites
23+ - ** Automatic Expiry** - Invites expire after 1 hour and are single-use only
24+
1625## Installation
1726
18271 . Add the plugin to your Discourse ` containers/app.yml ` file:
@@ -33,7 +42,9 @@ cd /var/discourse
3342
3443## Configuration
3544
36- ### Required Settings
45+ ### GitHub Sponsors Setup
46+
47+ #### Required Settings
3748
38491 . ** GitHub API Token**
3950 - Create a personal access token at https://github.com/settings/tokens
@@ -46,7 +57,7 @@ cd /var/discourse
46573 . ** Enable Plugin**
4758 - Set ` github_sponsors_enabled ` to true
4859
49- ### Optional Settings
60+ #### Optional Settings
5061
5162| Setting | Default | Description |
5263| ---------| ---------| -------------|
@@ -57,28 +68,95 @@ cd /var/discourse
5768| ` github_sponsors_verbose_log ` | ` false ` | Enable verbose logging for sync operations |
5869| ` github_sponsors_sync_history_retention_days ` | ` 30 ` | Days to retain sync history records |
5970
71+ ### Discord Integration Setup (Optional)
72+
73+ The Discord integration allows active GitHub sponsors to generate single-use invite links to join your Discord server.
74+
75+ #### 1. Create Discord Bot
76+
77+ 1 . Go to [ Discord Developer Portal] ( https://discord.com/developers/applications )
78+ 2 . Click "New Application" and give it a name
79+ 3 . Navigate to the "Bot" section and click "Add Bot"
80+ 4 . Under "Privileged Gateway Intents", enable:
81+ - ** Server Members Intent** (required for member search)
82+ 5 . Copy the bot token (you'll need this for ` discord_bot_token ` setting)
83+
84+ #### 2. Add Bot to Your Server
85+
86+ 1 . Go to the "OAuth2" → "URL Generator" section
87+ 2 . Select these scopes:
88+ - ` bot `
89+ 3 . Select these bot permissions:
90+ - ** Create Instant Invite** (permission value: 1)
91+ - ** View Channels** (permission value: 1024)
92+ - Total permission integer: ** 1025**
93+ 4 . Copy the generated URL and open it in your browser
94+ 5 . Select your Discord server and authorize the bot
95+
96+ #### 3. Get Server and Channel IDs
97+
98+ 1 . Enable Developer Mode in Discord:
99+ - User Settings → App Settings → Advanced → Developer Mode
100+ 2 . Right-click your server name and select "Copy Server ID"
101+ 3 . Right-click the channel where invites should be generated and select "Copy Channel ID"
102+
103+ #### 4. Configure Discord Settings
104+
105+ | Setting | Required | Description |
106+ | ---------| ----------| -------------|
107+ | ` discord_server_guild_id ` | Yes | Your Discord server (guild) ID |
108+ | ` discord_invite_channel_id ` | Yes | Channel ID where bot will generate invites |
109+ | ` discord_bot_token ` | Yes | Discord bot token (keep secret!) |
110+ | ` discord_webhook_url ` | No | Optional webhook URL for invite notifications |
111+ | ` discord_invite_max_age ` | No | Invite expiry time in seconds (default: 3600 = 1 hour) |
112+
113+ ** Important** : The bot token is a secret and should never be shared publicly or committed to version control.
114+
60115## How It Works
61116
117+ ### GitHub Sponsors Sync
118+
621191 . Users must link their GitHub account in their Discourse preferences
631202 . The plugin runs a sync job every six hours to check sponsor status
641213 . Active sponsors are added to the configured group
651224 . Badges are automatically awarded based on group membership
661235 . User title and flair are set to show sponsor status
67124
125+ ### Discord Integration (Optional)
126+
127+ 1 . ** User Requirements** :
128+ - Must be an active GitHub sponsor (in the sponsors group)
129+ - Must link their Discord account via Discourse OAuth
130+
131+ 2 . ** Invite Generation Flow** :
132+ - Sponsors navigate to their account preferences page
133+ - The plugin checks if they're already on the Discord server
134+ - If not on server, they can generate a single-use invite link
135+ - Invite expires after 1 hour (configurable)
136+ - All invites are logged in the database for admin tracking
137+
138+ 3 . ** Admin Dashboard** :
139+ - View complete invite history (last 50 invites)
140+ - See statistics: total invites, used, expired, active, usage rate
141+ - Monitor which users generated invites and when
142+ - Track invite status (used/expired/active)
143+
68144## Testing
69145
70- ### Manual Sync
146+ ### GitHub Sponsors Sync
147+
148+ #### Manual Sync
71149Navigate to ` /admin/plugins/github-sponsors ` and click "Sync Sponsors Now"
72150
73- ### Command Line Sync
151+ #### Command Line Sync
74152``` bash
75153cd /var/discourse
76154./launcher enter app
77155rails c
78156Jobs::GithubSponsorsSync.new.execute({})
79157```
80158
81- ### Rake Tasks
159+ #### Rake Tasks
82160``` bash
83161# Create/update badge
84162LOAD_PLUGINS=1 bin/rake github_sponsors:create_badge
@@ -87,8 +165,6 @@ LOAD_PLUGINS=1 bin/rake github_sponsors:create_badge
87165LOAD_PLUGINS=1 bin/rake github_sponsors:badge_status
88166```
89167
90- ## Roadmap
168+ ## License
91169
92- - ** Webhook Support** - Real-time updates when sponsorship status changes
93- - ** Sponsorship Tiers** - Different badges per sponsorship tier
94- - ** Grace Period** - Configurable grace period for declined sponsorships, send reminder notifications before removal
170+ MIT
0 commit comments