Skip to content

Commit d3fe70f

Browse files
committed
fix: findFeed && user deactiveated
1 parent fa42f40 commit d3fe70f

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

source/utils/feed.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { none, Option, Optional } from '../types/option';
2-
import { TRSS, parseString } from '../parser/parse';
2+
import { parseString, TRSS } from '../parser/parse';
3+
34
export async function isFeedValid(feedStr: string): Promise<Option<TRSS>> {
45
try {
56
const feed = await parseString(feedStr);
@@ -15,7 +16,10 @@ export async function findFeed(
1516
): Promise<string[]> {
1617
const reqURL = new URL(reqUrl);
1718
const linksTag = html.match(/<link[^>]+rel="alternate"[^>]+\/?>/g);
18-
const urls = linksTag
19+
if (!linksTag) {
20+
return [];
21+
}
22+
return linksTag
1923
.filter((t) => t.match(/rss|atom/) && t.includes('href'))
2024
.map((linkTag) => {
2125
const url = linkTag.match(/href="(.+?)"/)[1];
@@ -26,5 +30,4 @@ export async function findFeed(
2630
return reqURL.toString();
2731
}
2832
});
29-
return urls;
3033
}

source/utils/send.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ import { isNone } from '../types/option';
1919
async function handlerSendError(e: any, userId: number): Promise<boolean> {
2020
// bot was blocked or chat is deleted
2121
logger.error(e);
22-
const re = new RegExp(
23-
'chat not found|bot was blocked by the user|bot was kicked'
24-
);
22+
const re = /chat not found|bot was blocked by the user|bot was kicked|user is deactivated/;
2523
if (config.delete_on_err_send && re.test(e.description)) {
2624
logger.error(`delete all subscribes for user ${userId}`);
2725
deleteSubscribersByUserId(userId);

0 commit comments

Comments
 (0)