UNPKG

getlogs-sdk

Version:
39 lines (38 loc) 911 B
import { sendDiscordLog } from "./providers/discord"; import { sendSlackLog } from "./providers/slack"; class GetLogs { config; constructor(config) { this.config = config; } async log({ content, embed, block }) { switch (this.config.provider) { case "discord": if (this.config.discord) { await sendDiscordLog({ ...this.config.discord, content, embed }); } else { console.warn("Discord webhook URL not configured."); } break; case "slack": if (this.config.slack) { await sendSlackLog({ ...this.config.slack, block }); } else { console.warn("Slack webhook URL not configured."); } break; default: console.warn("Provider is not intialised!"); } } } export { GetLogs as default };