MCPcopy Create free account
hub / github.com/chavyleung/scripts / answerwx

Function answerwx

wps/wps.js:69–113  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

67
68// 获取并回答问题
69async function answerwx() {
70 const answers = [
71 'WPS会员全文检索',
72 '100G',
73 'WPS会员数据恢复',
74 'WPS会员PDF转doc',
75 'WPS会员PDF转图片',
76 'WPS图片转PDF插件',
77 '金山PDF转WORD',
78 'WPS会员拍照转文字',
79 '使用WPS会员修复',
80 'WPS全文检索功能',
81 '有,且无限次',
82 '文档修复'
83 ]
84 // 尝试最多 10 次回答问题
85 for (let idx = 0; idx < 10; idx++) {
86 $.log(`问题: ${$.question.title}`)
87 if ($.question.multi_select === 0) {
88 const optionIdx = $.question.options.findIndex((option) => answers.includes(option))
89 if (optionIdx === -1) {
90 $.log(`选项: ${$.question.options.join(', ')}`)
91 $.log('跳过! 原因: 找不到答案.', '')
92 await getquestion()
93 } else {
94 $.log(`选项: ${$.question.options.join(', ')}`)
95 $.log(`答案: ${optionIdx + 1}.${$.question.options[optionIdx]}`, '')
96 await answerquestion(optionIdx + 1)
97 if ($.answer.right) {
98 $.answer.optionIdx = optionIdx
99 $.log('回答正确!')
100 break
101 } else {
102 $.log(`回答错误! 详情: ${$.answer._raw.msg}`)
103 await getquestion()
104 continue
105 }
106 }
107 } else {
108 $.log(`选项: ${$.question.options.join(', ')}`)
109 $.log('跳过! 原因: 不做多选.', '')
110 await getquestion()
111 }
112 }
113}
114
115// 获取问题
116function getquestion() {

Callers 1

wps.jsFile · 0.85

Calls 3

getquestionFunction · 0.85
answerquestionFunction · 0.85
logMethod · 0.45

Tested by

no test coverage detected