mirror of
https://github.com/TheNetsky/Microsoft-Rewards-Script.git
synced 2026-01-17 21:43:59 +00:00
- Updated README.md to include new configuration options for conclusion webhook. - Enhanced BrowserFunc.ts with improved error handling during page reloads. - Implemented conclusionWebhook configuration in config.json. - Refactored Login.ts to use Playwright types and improved passkey handling. - Added safeClick method in SearchOnBing.ts to handle click timeouts and overlays. - Introduced account summary collection in index.ts for reporting. - Created ConclusionWebhook.ts to send structured summaries to a dedicated webhook. - Updated TypeScript definitions for better type safety across the project.
33 lines
940 B
TypeScript
33 lines
940 B
TypeScript
import axios from 'axios'
|
|
|
|
import { Config } from '../interface/Config'
|
|
|
|
interface ConclusionPayload {
|
|
content?: string
|
|
embeds?: any[]
|
|
}
|
|
|
|
/**
|
|
* Send a final structured summary to the dedicated conclusion webhook (if enabled),
|
|
* otherwise do nothing. Does NOT fallback to the normal logging webhook to avoid spam.
|
|
*/
|
|
export async function ConclusionWebhook(configData: Config, content: string, embed?: ConclusionPayload) {
|
|
const webhook = configData.conclusionWebhook
|
|
|
|
if (!webhook || !webhook.enabled || webhook.url.length < 10) return
|
|
|
|
const body: ConclusionPayload = embed?.embeds ? { embeds: embed.embeds } : { content }
|
|
if (content && !body.content && !body.embeds) body.content = content
|
|
|
|
const request = {
|
|
method: 'POST',
|
|
url: webhook.url,
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: body
|
|
}
|
|
|
|
await axios(request).catch(() => { })
|
|
}
|