mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 05:00:30 +08:00
1.4.5
This commit is contained in:
parent
2f1eabcdc9
commit
61847d94f5
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mihomo-party",
|
"name": "mihomo-party",
|
||||||
"version": "1.4.4",
|
"version": "1.4.5",
|
||||||
"description": "Mihomo Party",
|
"description": "Mihomo Party",
|
||||||
"main": "./out/main/index.js",
|
"main": "./out/main/index.js",
|
||||||
"author": "mihomo-party",
|
"author": "mihomo-party",
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { readFileSync } from 'fs'
|
import { readFileSync } from 'fs'
|
||||||
|
|
||||||
|
const chat_id = '@mihomo_party_group'
|
||||||
const pkg = readFileSync('package.json', 'utf-8')
|
const pkg = readFileSync('package.json', 'utf-8')
|
||||||
const changelog = readFileSync('changelog.md', 'utf-8')
|
const changelog = readFileSync('changelog.md', 'utf-8')
|
||||||
const { version } = JSON.parse(pkg)
|
const { version } = JSON.parse(pkg)
|
||||||
@ -14,8 +15,11 @@ for (const line of changelog.split('\n')) {
|
|||||||
content += `${line}\n`
|
content += `${line}\n`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
axios.post(`https://api.telegram.org/bot${process.env.TELEGRAM_BOT_TOKEN}/sendMessage`, {
|
|
||||||
chat_id: '@mihomo_party_group',
|
const { data: messageData } = await axios.post(
|
||||||
|
`https://api.telegram.org/bot${process.env.TELEGRAM_BOT_TOKEN}/sendMessage`,
|
||||||
|
{
|
||||||
|
chat_id,
|
||||||
text: content,
|
text: content,
|
||||||
link_preview_options: {
|
link_preview_options: {
|
||||||
is_disabled: false,
|
is_disabled: false,
|
||||||
@ -23,4 +27,27 @@ axios.post(`https://api.telegram.org/bot${process.env.TELEGRAM_BOT_TOKEN}/sendMe
|
|||||||
prefer_large_media: true
|
prefer_large_media: true
|
||||||
},
|
},
|
||||||
parse_mode: 'HTML'
|
parse_mode: 'HTML'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
const { data: chatData } = await axios.post(
|
||||||
|
`https://api.telegram.org/bot${process.env.TELEGRAM_BOT_TOKEN}/getChat`,
|
||||||
|
{
|
||||||
|
chat_id
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
if (chatData.result.pinned_message.from.is_bot) {
|
||||||
|
await axios.post(
|
||||||
|
`https://api.telegram.org/bot${process.env.TELEGRAM_BOT_TOKEN}/unpinChatMessage`,
|
||||||
|
{
|
||||||
|
chat_id,
|
||||||
|
message_id: chatData.result.pinned_message.message_id
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
await axios.post(`https://api.telegram.org/bot${process.env.TELEGRAM_BOT_TOKEN}/pinChatMessage`, {
|
||||||
|
chat_id,
|
||||||
|
message_id: messageData.result.message_id
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user