mirror of
https://github.com/zhigang1992/telert.git
synced 2026-01-12 22:42:11 +08:00
feat: support channel
This commit is contained in:
12
src/index.ts
12
src/index.ts
@@ -130,17 +130,15 @@ const cors: Middleware = async ({ res }, next) => {
|
|||||||
new Application().use(cors).use(router.middleware).listen();
|
new Application().use(cors).use(router.middleware).listen();
|
||||||
|
|
||||||
async function processUpdate(update: Update): Promise<void> {
|
async function processUpdate(update: Update): Promise<void> {
|
||||||
if (update.message == null) {
|
const message = update.message ?? update.channel_post;
|
||||||
|
if (message == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (
|
if (message.text === "/webhook" || message.text === "/webhook@telerts_bot") {
|
||||||
update.message.text === "/webhook" ||
|
const chatId = message.chat.id;
|
||||||
update.message.text === "/webhook@telerts_bot"
|
|
||||||
) {
|
|
||||||
const chatId = update.message.chat.id;
|
|
||||||
const chat = {
|
const chat = {
|
||||||
chatId,
|
chatId,
|
||||||
messageThreadId: update.message.message_thread_id,
|
messageThreadId: message.message_thread_id,
|
||||||
};
|
};
|
||||||
const chatKey = JSON.stringify(chat);
|
const chatKey = JSON.stringify(chat);
|
||||||
const key = `chat-webhook:${chatKey}`;
|
const key = `chat-webhook:${chatKey}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user