(v: {
id: string
name: string
description: string
})
| 6 | |
| 7 | function noop() {} |
| 8 | export function sendMessageToDiscord(v: { |
| 9 | id: string |
| 10 | name: string |
| 11 | description: string |
| 12 | }) { |
| 13 | if (isDev) { |
| 14 | return |
| 15 | } |
| 16 | if (DISCORD_WEBHOOK_URL) { |
| 17 | return fetchPost(DISCORD_WEBHOOK_URL, { |
| 18 | username: 'OpenGpt 机器人', |
| 19 | embeds: [ |
| 20 | { |
| 21 | author: { |
| 22 | name: 'OpenGpt', |
| 23 | url: 'https://open-gpt-app.vercel.app/', |
| 24 | icon_url: 'https://avatars.githubusercontent.com/u/6268441?v=4', |
| 25 | }, |
| 26 | title: '有新的 App 被创建啦!🎉', |
| 27 | url: `https://open-gpt-app.vercel.app/app/${v.id}`, |
| 28 | description: `[点我直达](https://open-gpt-app.vercel.app/app/${v.id})`, |
| 29 | color: 15258703, |
| 30 | fields: [ |
| 31 | { name: '应用名称', value: v.name, inline: false }, |
| 32 | { name: '描述', value: v.description, inline: false }, |
| 33 | ], |
| 34 | }, |
| 35 | ], |
| 36 | }).catch(noop) |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | export function sendAlertToDiscord(message: string) { |
| 41 | if (isDev) { |
no test coverage detected