Switch Discord notifications from webhook to user ID DMs

Uses the existing bot token to send DMs to users by their Discord user ID
instead of posting to a channel webhook.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-15 02:14:46 -06:00
parent c29ec8e210
commit 1cb929a776
5 changed files with 43 additions and 21 deletions

View File

@@ -15,7 +15,7 @@ interface Preferences {
}
interface NotifSettings {
discord_webhook: string;
discord_user_id: string;
discord_enabled: boolean;
ntfy_topic: string;
ntfy_enabled: boolean;
@@ -29,7 +29,7 @@ export default function SettingsPage() {
celebration_style: 'standard',
});
const [notif, setNotif] = useState<NotifSettings>({
discord_webhook: '',
discord_user_id: '',
discord_enabled: false,
ntfy_topic: '',
ntfy_enabled: false,
@@ -41,7 +41,7 @@ export default function SettingsPage() {
Promise.all([
api.preferences.get().then((data: Preferences) => setPrefs(data)),
api.notifications.getSettings().then((data) => setNotif({
discord_webhook: data.discord_webhook,
discord_user_id: data.discord_user_id,
discord_enabled: data.discord_enabled,
ntfy_topic: data.ntfy_topic,
ntfy_enabled: data.ntfy_enabled,
@@ -214,7 +214,7 @@ export default function SettingsPage() {
<div className="flex items-center justify-between">
<div>
<p className="font-medium text-gray-900">Discord</p>
<p className="text-sm text-gray-500">Send notifications to a Discord channel</p>
<p className="text-sm text-gray-500">Get DMs from the Synculous bot</p>
</div>
<button
onClick={() => updateNotif({ discord_enabled: !notif.discord_enabled })}
@@ -229,11 +229,11 @@ export default function SettingsPage() {
</div>
{notif.discord_enabled && (
<input
type="url"
placeholder="Discord webhook URL"
value={notif.discord_webhook}
onChange={(e) => setNotif({ ...notif, discord_webhook: e.target.value })}
onBlur={() => updateNotif({ discord_webhook: notif.discord_webhook })}
type="text"
placeholder="Your Discord user ID"
value={notif.discord_user_id}
onChange={(e) => setNotif({ ...notif, discord_user_id: e.target.value })}
onBlur={() => updateNotif({ discord_user_id: notif.discord_user_id })}
className="w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent text-gray-900 placeholder-gray-400"
/>
)}