Lint / JS (eslint) (push) Successful in 9s
Lint / Shell (shellcheck) (push) Successful in 10s
Lint / No secrets in webhook configs (push) Successful in 5s
Lint / Landing page is rendered (matrix (push) Successful in 4s
Lint / Python (ruff) (push) Successful in 6s
Lint / Secret scan (gitleaks) (push) Successful in 8s
Lint / Shell (shellcheck) (pull_request) Successful in 11s
Lint / JS (eslint) (pull_request) Successful in 8s
Lint / No secrets in webhook configs (pull_request) Successful in 5s
Lint / Landing page is rendered (matrix (pull_request) Successful in 5s
Lint / Python deps (pip-audit) (push) Successful in 54s
Lint / Python (ruff) (pull_request) Successful in 10s
Lint / Secret scan (gitleaks) (pull_request) Successful in 8s
Lint / Python deps (pip-audit) (pull_request) Successful in 41s
Add the Discord-logo avatar and a script that uploads it as the bridge bot and sets the display name to "Discord Bridge". Document the new "Discord Bridge Down" Grafana alert, and why the bot login belongs on a dedicated non-chatting account: whoever holds it sends to Discord as the bot instead of through the relay webhook. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
35 lines
1.3 KiB
Bash
Executable File
35 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# Gives @discordbot the Discord logo and the display name "Discord Bridge".
|
|
# Run inside LXC 151 (from the Proxmox node):
|
|
# pct exec 151 -- bash /opt/matrix-config/discord-bridge/set-bot-profile.sh
|
|
# Uploads bot-avatar.png as the bridge bot, points config.yaml at it and
|
|
# restarts the bridge, which applies the profile on startup. Safe to re-run.
|
|
set -euo pipefail
|
|
|
|
DIR=/opt/mautrix-discord
|
|
CFG="$DIR/config.yaml"
|
|
AVATAR=/opt/matrix-config/discord-bridge/bot-avatar.png
|
|
BOT="@discordbot:matrix.lotusguild.org"
|
|
|
|
AS_TOKEN=$(awk '/^as_token:/ {gsub(/"/, "", $2); print $2; exit}' "$DIR/registration.yaml")
|
|
[ -n "$AS_TOKEN" ] || { echo "no as_token in $DIR/registration.yaml" >&2; exit 1; }
|
|
|
|
MXC=$(curl -fsS -X POST \
|
|
-H "Authorization: Bearer $AS_TOKEN" \
|
|
-H "Content-Type: image/png" \
|
|
--data-binary "@$AVATAR" \
|
|
"http://127.0.0.1:8008/_matrix/media/v3/upload?filename=discord.png&user_id=${BOT/@/%40}" |
|
|
python3 -c 'import json, sys; print(json.load(sys.stdin)["content_uri"])')
|
|
echo "uploaded $MXC"
|
|
|
|
# Only the bot block's two lines; the 8-space indent is unique to appservice.bot.
|
|
sed -i -E \
|
|
-e 's|^( displayname: ).*$|\1Discord Bridge|' \
|
|
-e "s|^( avatar: )mxc://.*$|\1$MXC|" \
|
|
"$CFG"
|
|
grep -A7 '^ bot:' "$CFG"
|
|
|
|
systemctl restart mautrix-discord
|
|
sleep 3
|
|
systemctl is-active mautrix-discord
|