diff --git a/.env.example b/.env.example index 5fc2337..bd08eb9 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,5 @@ AUTH_SECRET= AUTH_GITHUB_ID= AUTH_GITHUB_SECRET= -DISABLE_REGISTER=false \ No newline at end of file +DISABLE_REGISTER=false + diff --git a/components/template-fields.tsx b/components/template-fields.tsx index f04ebe5..0c177b7 100644 --- a/components/template-fields.tsx +++ b/components/template-fields.tsx @@ -62,7 +62,8 @@ function FieldComponent({ // 判断字段是否支持变量插入 function isVariableSupported(field: TemplateField) { - return field.component === 'input' || field.component === 'textarea' || !field.component + // return field.component === 'input' || field.component === 'textarea' || !field.component + return field.component === 'textarea' || !field.component } export function TemplateFields({ form, template }: TemplateFieldsProps) { diff --git a/lib/channels/telegram.ts b/lib/channels/telegram.ts index 06f4965..008a678 100644 --- a/lib/channels/telegram.ts +++ b/lib/channels/telegram.ts @@ -2,6 +2,7 @@ import { BaseChannel, ChannelConfig, SendMessageOptions } from "./base" interface TelegramMessage { chat_id: string + message_thread_id?: string text: string parse_mode?: "HTML" | "Markdown" | "MarkdownV2" disable_web_page_preview?: boolean @@ -19,7 +20,10 @@ export class TelegramChannel extends BaseChannel { description: "文本消息,支持 HTML 标签", fields: [ { key: "text", description: "HTML内容", required: true, component: 'textarea' }, + { key: "chat_id", description: "Chat ID 覆盖渠道配置", required: false, component: 'input' }, + { key: "message_thread_id", description: "群组话题ID", required: false, component: 'input' }, { key: "disable_notification", description: "静默发送", component: 'checkbox' }, + { key: "disable_web_page_preview", description: "禁用网页预览", component: 'checkbox' }, { key: "parse_mode", component: 'hidden', defaultValue: "HTML" }, ], }, @@ -34,6 +38,23 @@ export class TelegramChannel extends BaseChannel { required: true, component: 'textarea' }, + { + key: "chat_id", + description: "Chat ID 覆盖渠道配置", + required: false, + component: 'input' + }, + { + key: "message_thread_id", + description: "群组话题ID", + required: false, + component: 'input' + }, + { + key: "disable_web_page_preview", + description: "禁用网页预览", + component: 'checkbox' + }, { key: "disable_notification", description: "静默发送", @@ -70,7 +91,7 @@ export class TelegramChannel extends BaseChannel { }, body: JSON.stringify({ ...message, - chat_id: chatId, + chat_id: message.chat_id ||chatId, }), } )