mirror of
https://github.com/ReCloudStudio/WebHooker.git
synced 2026-09-22 16:11:29 +00:00
feat(groups): optional forge source label in message footers
- Group.forgeLabel (default off, editable per group in the console) shows the source forge on every message the group's routes dispatch - Discord embed footer: forge name next to the repo + the site's favicon as icon_url (Gitea instance's own favicon from its origin) - Telegram footer: hyperlinked site name (GitHub or Gitea hostname); custom webhooks render a plain 'Custom' label - forgeInfo() derives branding from event.provider + repository.html_url; dispatch attaches it to the NeutralMessage like mentionRoleIds - validateGroups accepts forgeLabel booleans; GroupEditor gains the toggle - tests: forgeInfo unit, discord/telegram footer render, dispatch on/off - docs: groups.md + message-format.md (en/zh), config.example.yaml, AGENTS.md - fix: wrangler.jsonc compatibility_date was an incomplete '2026-'
This commit is contained in:
parent
a5324fb0ea
commit
3dce114cec
19 changed files with 273 additions and 16 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import type { Config, WebhookEvent, Env, Route, Group, NeutralMessage } from "../types";
|
||||
import { formatEvent } from "../formatters";
|
||||
import { emojiPrefix } from "../formatters/helpers";
|
||||
import { emojiPrefix, forgeInfo } from "../formatters/helpers";
|
||||
import { matchRoute, eventOwners } from "../events/match";
|
||||
import { log } from "../lib/log";
|
||||
import { loadTranslations, t as translate, type Translations } from "../lib/i18n";
|
||||
|
|
@ -156,6 +156,9 @@ export async function dispatchEvent(
|
|||
const tr = trMap.get(group?.lang ?? "en")!;
|
||||
const showEmoji = group?.emoji !== false;
|
||||
const message = formatEvent(route, event, tr, showEmoji);
|
||||
if (group?.forgeLabel) {
|
||||
message.forge = forgeInfo(event);
|
||||
}
|
||||
if (route.discordRoleIds?.length) {
|
||||
message.mentionRoleIds = route.discordRoleIds;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue