import axios from 'axios'
import { readFileSync } from 'fs'
const chat_id = '@MihomoPartyChannel'
const pkg = readFileSync('package.json', 'utf-8')
const changelog = readFileSync('changelog.md', 'utf-8')
const { version } = JSON.parse(pkg)
const downloadUrl = `https://github.com/mihomo-party-org/mihomo-party/releases/download/v${version}`
let content = `🌟 Mihomo Party v${version} 正式发布\n\n`
for (const line of changelog.split('\n')) {
if (line.length === 0) {
content += '\n'
} else if (line.startsWith('### ')) {
content += `${line.replace('### ', '')}\n`
} else {
content += `${line}\n`
}
}
content += '\n下载地址:\nWindows10/11:\n'
content += `安装版:64位 | 32位 | ARM64\n`
content += `便携版:64位 | 32位 | ARM64\n`
content += '\nWindows7/8:\n'
content += `安装版:64位 | 32位\n`
content += `便携版:64位 | 32位\n`
content += '\nmacOS 11+:\n'
content += `PKG:Intel | Apple Silicon\n`
content += '\nmacOS 10.15+:\n'
content += `PKG:Intel | Apple Silicon\n`
content += '\nLinux:\n'
content += `DEB:64位 | ARM64\n`
content += `RPM:64位 | ARM64`
await axios.post(`https://api.telegram.org/bot${process.env.TELEGRAM_BOT_TOKEN}/sendMessage`, {
chat_id,
text: content,
link_preview_options: {
is_disabled: false,
url: 'https://github.com/mihomo-party-org/mihomo-party',
prefer_large_media: true
},
parse_mode: 'HTML'
})