var _={alerts:process.env.DUB_SLACK_HOOK_ALERTS,cron:process.env.DUB_SLACK_HOOK_CRON,links:process.env.DUB_SLACK_HOOK_LINKS,subscribers:process.env.DUB_SLACK_HOOK_SUBSCRIBERS,errors:process.env.DUB_SLACK_HOOK_ERRORS},t=async({message:s,type:e,mention:r=!1})=>{(process.env.NODE_ENV==="development"||!process.env.DUB_SLACK_HOOK_ALERTS||!process.env.DUB_SLACK_HOOK_CRON||!process.env.DUB_SLACK_HOOK_LINKS||!process.env.DUB_SLACK_HOOK_SUBSCRIBERS||!process.env.DUB_SLACK_HOOK_ERRORS)&&console.log(s);let o=_[e];if(o)try{return await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({blocks:[{type:"section",text:{type:"mrkdwn",text:`${r?"<@U0404G6J3NJ> ":""}${e==="alerts"||e==="errors"?":alert: ":""}${s}`}}]})})}catch(n){console.log(`Failed to log to Dub Slack. Error: ${n}`)}};export{t as a};
