MCPcopy Create free account
hub / github.com/027xiguapi/code-box / constructor

Method constructor

server/WechatSender.js:4–14  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2
3class WechatSender {
4 constructor() {
5 this.appid = process.env.WECHAT_APPID
6 this.secret = process.env.WECHAT_SECRET
7
8 if (!this.appid || !this.secret) {
9 const errorMessage =
10 "Error: WECHAT_APPID or WECHAT_SECRET is not set in the environment variables"
11 console.error(errorMessage)
12 throw new Error(errorMessage)
13 }
14 }
15
16 async getAccessToken() {
17 const url = `https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=${this.appid}&secret=${this.secret}`

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected