mirror of
https://github.com/LightZirconite/Microsoft-Rewards-Bot.git
synced 2026-01-09 17:06:15 +00:00
feat: bump version to 3.5.2 and add optional webhooks for error reporting
This commit is contained in:
10
package-lock.json
generated
10
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "microsoft-rewards-bot",
|
||||
"version": "3.5.1",
|
||||
"version": "3.5.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "microsoft-rewards-bot",
|
||||
"version": "3.0.0",
|
||||
"version": "3.5.2",
|
||||
"license": "CC-BY-NC-SA-4.0",
|
||||
"dependencies": {
|
||||
"axios": "^1.8.4",
|
||||
@@ -450,6 +450,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.24.tgz",
|
||||
"integrity": "sha512-FE5u0ezmi6y9OZEzlJfg37mqqf6ZDSF2V/NLjUyGrR9uTZ7Sb9F7bLNZ03S4XVUNRWGA7Ck4c1kK+YnuWjl+DA==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"undici-types": "~6.21.0"
|
||||
}
|
||||
@@ -737,6 +738,7 @@
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
|
||||
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
@@ -987,6 +989,7 @@
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"baseline-browser-mapping": "^2.8.19",
|
||||
"caniuse-lite": "^1.0.30001751",
|
||||
@@ -1559,6 +1562,7 @@
|
||||
"deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.2.0",
|
||||
"@eslint-community/regexpp": "^4.6.1",
|
||||
@@ -3213,6 +3217,7 @@
|
||||
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.52.0.tgz",
|
||||
"integrity": "sha512-JAwMNMBlxJ2oD1kce4KPtMkDeKGHQstdpFPcPH3maElAXon/QZeTvtsfXmTMRyO9TslfoYOXkSsvao2nE1ilTw==",
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"playwright-core": "1.52.0"
|
||||
},
|
||||
@@ -3972,6 +3977,7 @@
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
|
||||
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "microsoft-rewards-bot",
|
||||
"version": "3.5.1",
|
||||
"version": "3.5.2",
|
||||
"description": "Automate Microsoft Rewards points collection",
|
||||
"private": true,
|
||||
"main": "index.js",
|
||||
@@ -85,4 +85,4 @@
|
||||
"ts-node": "^10.9.2",
|
||||
"ws": "^8.18.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -212,6 +212,7 @@ export interface ConfigScheduling {
|
||||
|
||||
export interface ConfigErrorReporting {
|
||||
enabled?: boolean; // enable automatic error reporting to community webhook (default: true)
|
||||
webhooks?: string[]; // Optional array of webhook URLs (plain or base64-encoded)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,15 @@ import path from 'path'
|
||||
import { DISCORD } from '../../constants'
|
||||
import { Config } from '../../interface/Config'
|
||||
|
||||
interface DiscordEmbed {
|
||||
title: string
|
||||
description: string
|
||||
color: number
|
||||
fields: Array<{ name: string; value: string; inline: boolean }>
|
||||
timestamp: string
|
||||
footer: { text: string; icon_url: string }
|
||||
}
|
||||
|
||||
interface ErrorReportPayload {
|
||||
error: string
|
||||
stack?: string
|
||||
@@ -58,8 +67,11 @@ function buildDiscordPayload(config: Config, error: Error | string, additionalCo
|
||||
|
||||
if (additionalContext) {
|
||||
for (const [key, value] of Object.entries(additionalContext)) {
|
||||
if (typeof value === 'string') payloadContext[key as keyof typeof payloadContext] = sanitizeSensitiveText(value)
|
||||
else payloadContext[key as keyof typeof payloadContext] = value as unknown
|
||||
if (typeof value === 'string') {
|
||||
(payloadContext as Record<string, unknown>)[key] = sanitizeSensitiveText(value)
|
||||
} else {
|
||||
(payloadContext as Record<string, unknown>)[key] = value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +85,7 @@ function buildDiscordPayload(config: Config, error: Error | string, additionalCo
|
||||
}
|
||||
})()
|
||||
|
||||
const embed: unknown = {
|
||||
const embed: DiscordEmbed = {
|
||||
title: '🐛 Automatic Error Report',
|
||||
description: `\`\`\`js\n${sanitizedMessage.slice(0, 700)}\n\`\`\``,
|
||||
color: DISCORD.COLOR_RED,
|
||||
|
||||
Reference in New Issue
Block a user