@@ -3,9 +3,10 @@ import { LoggerWithTarget } from "probot/lib/wrap-logger";
33import format from "string-template" ;
44
55import { Config } from "./interfaces/config.interface" ;
6- import { OrgsListMembersResponseItem } from "@octokit/rest" ;
6+ import { Octokit } from "@octokit/rest" ;
7+ // import { v2 } from "@google-cloud/translate";
8+ // const translate = new v2.Translate({ projectId: "458602011089" });
79
8- const translate = require ( "@vitalets/google-translate-api" ) ;
910const kmp = require ( "kmp" ) ;
1011const axios = require ( "axios" ) ;
1112
@@ -50,7 +51,7 @@ export class Bot {
5051
5152 try {
5253 if ( this . context . event . search ( "pull_request" ) !== - 1 ) {
53- await this . context . github . pullRequests . createReviewRequest (
54+ await this . context . github . pulls . createReviewRequest (
5455 this . context . issue ( { reviewers : assignees } )
5556 ) ;
5657 } else {
@@ -172,52 +173,52 @@ export class Bot {
172173 }
173174 }
174175
175- async replyTranslate ( ) {
176- const config = this . config . issue . translate ;
177- const issue = this . context . payload . issue ;
178- if ( containsChinese ( issue . title ) ) {
179- const body = await translate ( issue . body . replace ( / < ! - - ( . * ? ) - - > / g , "" ) , {
180- from : "zh-CN" ,
181- to : "en" ,
182- } ) ;
183- const title = await translate ( issue . title , { from : "zh-CN" , to : " en" } ) ;
184- if ( body . text && title . text ) {
185- let content = format ( config . replay , {
186- title : title . text ,
187- body : body . text ,
188- } ) ;
189- const issueComment = this . context . issue ( { body : content } ) ;
190-
191- this . log . trace (
192- {
193- issue,
194- issueComment,
195- } ,
196- "translating issue..."
197- ) ;
198-
199- try {
200- await this . context . github . issues . createComment ( issueComment ) ;
201- this . log . info (
202- {
203- issue,
204- issueComment,
205- } ,
206- "translated issue."
207- ) ;
208- } catch ( e ) {
209- this . log . error (
210- {
211- error : new Error ( e ) ,
212- issue,
213- issueComment,
214- } ,
215- "translate issue error!"
216- ) ;
217- }
218- }
219- }
220- }
176+ // async replyTranslate() {
177+ // const config = this.config.issue.translate;
178+ // const issue = this.context.payload.issue;
179+ // if (containsChinese(issue.title)) {
180+ // const [ body] = await translate.translate(
181+ // issue.body.replace(/<!--(.*?)-->/g, "") ,
182+ // "en"
183+ // );
184+ // const [ title] = await translate.translate (issue.title, " en");
185+ // if (body && title) {
186+ // let content = format(config.replay, {
187+ // title: title,
188+ // body: body,
189+ // });
190+ // const issueComment = this.context.issue({ body: content });
191+
192+ // this.log.trace(
193+ // {
194+ // issue,
195+ // issueComment,
196+ // },
197+ // "translating issue..."
198+ // );
199+
200+ // try {
201+ // await this.context.github.issues.createComment(issueComment);
202+ // this.log.info(
203+ // {
204+ // issue,
205+ // issueComment,
206+ // },
207+ // "translated issue."
208+ // );
209+ // } catch (e) {
210+ // this.log.error(
211+ // {
212+ // error: new Error(e),
213+ // issue,
214+ // issueComment,
215+ // },
216+ // "translate issue error!"
217+ // );
218+ // }
219+ // }
220+ // }
221+ // }
221222
222223 async replyNeedReproduce ( ) {
223224 const config = this . config . issue . needReproduce ;
@@ -377,7 +378,7 @@ export class Bot {
377378 }
378379
379380 private async getMembers ( ) : Promise < string [ ] > {
380- let members : OrgsListMembersResponseItem [ ] = [ ] ;
381+ let members : Octokit . OrgsListMembersResponseItem [ ] = [ ] ;
381382 const repo = this . context . repo ( ) ;
382383 let response = await this . context . github . orgs . listMembers ( {
383384 org : repo . owner ,
0 commit comments