Skip to content

Commit

Permalink
chore: knip fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyrxng committed Oct 4, 2024
1 parent b762c04 commit 43485f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
"prettier": "3.3.3",
"smee-client": "2.0.3",
"ts-jest": "29.2.5",
"tsc-watch": "^6.2.0",
"tsx": "4.18.0",
"typescript": "5.5.4",
"typescript-eslint": "8.3.0",
Expand Down
9 changes: 4 additions & 5 deletions src/handlers/private-notifications/issue-comment-created.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import { CallbackResult } from "../../types/proxy";
import { TelegramBotSingleton } from "../../types/telegram-bot-single";
import { Logger, logger } from "../../utils/logger";


const rewardCommentRegex = /href="https:\/\/[^/]+\/?\?claim=([A-Za-z0-9+/=]+)"[^>]*>\s*\[.*?\]\s*<\/a>\s*<\/h3>\s*<h6>\s*@([a-zA-Z0-9-_]+)\s*<\/h6>/g;
// we'll have multiple permit comments to parse out here
// the regex is capturing the claim url and the github username

export async function notificationsRequiringComments(context: Context<"issue_comment.created" | "issue_comment.edited", SupportedEvents["issue_comment.created" | "issue_comment.edited"]>): Promise<CallbackResult> {
export async function notificationsRequiringComments(
context: Context<"issue_comment.created" | "issue_comment.edited", SupportedEvents["issue_comment.created" | "issue_comment.edited"]>
): Promise<CallbackResult> {
const {
adapters: { github },
payload,
Expand All @@ -21,7 +22,7 @@ export async function notificationsRequiringComments(context: Context<"issue_com
// to support multiple triggers in the future

// skip if not a bot comment or not a reward comment
if(payload.comment.user?.type !== "Bot" || !payload.comment.body.match(rewardCommentRegex)) {
if (payload.comment.user?.type !== "Bot" || !payload.comment.body.match(rewardCommentRegex)) {
return { status: 200, reason: "skipped" };
}

Expand Down Expand Up @@ -104,14 +105,12 @@ async function handlePaymentNotification(username: string, claimUrlBase64String:

try {
await bot?.api.sendMessage(telegramId, message, { parse_mode: "MarkdownV2" });

} catch (er) {
logger.error(`Error sending message to ${telegramId}`, { er });
}
}

function parsePaymentComment(comment: string) {

const claims: Record<string, string> = {};

for (const match of comment.matchAll(rewardCommentRegex)) {
Expand Down

0 comments on commit 43485f5

Please sign in to comment.