Loading...
Loading...
Configure Discord webhook/bot notifications via natural language
npx skill4agent add yeachan-heo/oh-my-claudecode configure-discord~/.claude/.omc-config.jsonCONFIG_FILE="$HOME/.claude/.omc-config.json"
if [ -f "$CONFIG_FILE" ]; then
# Check for existing discord config
HAS_DISCORD=$(jq -r '.notifications.discord.enabled // false' "$CONFIG_FILE" 2>/dev/null)
HAS_DISCORD_BOT=$(jq -r '.notifications["discord-bot"].enabled // false' "$CONFIG_FILE" 2>/dev/null)
WEBHOOK_URL=$(jq -r '.notifications.discord.webhookUrl // empty' "$CONFIG_FILE" 2>/dev/null)
MENTION=$(jq -r '.notifications.discord.mention // empty' "$CONFIG_FILE" 2>/dev/null)
if [ "$HAS_DISCORD" = "true" ] || [ "$HAS_DISCORD_BOT" = "true" ]; then
echo "EXISTING_CONFIG=true"
echo "WEBHOOK_CONFIGURED=$HAS_DISCORD"
echo "BOT_CONFIGURED=$HAS_DISCORD_BOT"
[ -n "$WEBHOOK_URL" ] && echo "WEBHOOK_URL=$WEBHOOK_URL"
[ -n "$MENTION" ] && echo "MENTION=$MENTION"
else
echo "EXISTING_CONFIG=false"
fi
else
echo "NO_CONFIG_FILE"
fihttps://discord.com/api/webhooks/https://discordapp.com/api/webhooks/<@USER_ID><@1465264645320474637><@&ROLE_ID><@&123456789>CONFIG_FILE="$HOME/.claude/.omc-config.json"
mkdir -p "$(dirname "$CONFIG_FILE")"
if [ -f "$CONFIG_FILE" ]; then
EXISTING=$(cat "$CONFIG_FILE")
else
EXISTING='{}'
fi.omc-config.json# WEBHOOK_URL, MENTION, USERNAME are collected from user
# EVENTS is the list of enabled events
echo "$EXISTING" | jq \
--arg url "$WEBHOOK_URL" \
--arg mention "$MENTION" \
--arg username "$USERNAME" \
'.notifications = (.notifications // {enabled: true}) |
.notifications.enabled = true |
.notifications.discord = {
enabled: true,
webhookUrl: $url,
mention: (if $mention == "" then null else $mention end),
username: (if $username == "" then null else $username end)
}' > "$CONFIG_FILE"echo "$EXISTING" | jq \
--arg token "$BOT_TOKEN" \
--arg channel "$CHANNEL_ID" \
--arg mention "$MENTION" \
'.notifications = (.notifications // {enabled: true}) |
.notifications.enabled = true |
.notifications["discord-bot"] = {
enabled: true,
botToken: $token,
channelId: $channel,
mention: (if $mention == "" then null else $mention end)
}' > "$CONFIG_FILE"# Example: disable session-start if not selected
echo "$(cat "$CONFIG_FILE")" | jq \
'.notifications.events = (.notifications.events // {}) |
.notifications.events["session-start"] = {enabled: false}' > "$CONFIG_FILE"# For webhook:
curl -s -o /dev/null -w "%{http_code}" \
-H "Content-Type: application/json" \
-d "{\"content\": \"${MENTION:+$MENTION\\n}OMC test notification - Discord is configured!\"}" \
"$WEBHOOK_URL"Discord Notifications Configured!
Method: Webhook / Bot API
Mention: <@1465264645320474637> (or "none")
Events: session-end, ask-user-question
Username: OMC
Config saved to: ~/.claude/.omc-config.json
You can also set these via environment variables:
OMC_DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...
OMC_DISCORD_MENTION=<@1465264645320474637>
To reconfigure: /oh-my-claudecode:configure-discord
To configure Telegram: /oh-my-claudecode:configure-telegramexport OMC_DISCORD_WEBHOOK_URL="https://discord.com/api/webhooks/..."
export OMC_DISCORD_MENTION="<@1465264645320474637>" # optionalexport OMC_DISCORD_NOTIFIER_BOT_TOKEN="your-bot-token"
export OMC_DISCORD_NOTIFIER_CHANNEL="your-channel-id"
export OMC_DISCORD_MENTION="<@1465264645320474637>" # optional.omc-config.json