提交 6da13bb4 编写于 作者: sinat_25235033's avatar sinat_25235033

add @issuer when bot comment

上级 dddef436
此差异由.gitattributes 抑制。
此差异由.gitattributes 抑制。
...@@ -44,7 +44,7 @@ async function run(): Promise<void> { ...@@ -44,7 +44,7 @@ async function run(): Promise<void> {
// translate issue comment body to english // translate issue comment body to english
const issue_translate_comment_body = await translateCommentBody( const issue_translate_comment_body = await translateCommentBody(
issue_origin_comment_body issue_origin_comment_body, issue_user
) )
if (issue_translate_comment_body === null if (issue_translate_comment_body === null
...@@ -76,12 +76,13 @@ function detectIsEnglish(body: string): boolean | true { ...@@ -76,12 +76,13 @@ function detectIsEnglish(body: string): boolean | true {
return detectResult.length === 1 && detectResult[0][0] === 'english' return detectResult.length === 1 && detectResult[0][0] === 'english'
} }
async function translateCommentBody(body: string): Promise<string> { async function translateCommentBody(body: string, issue_user: string): Promise<string> {
let result = '' let result = ''
await translate(body, {to: 'en'}) await translate(body, {to: 'en'})
.then(res => { .then(res => {
result = result =
` `
> @${issue_user}
> Bot detected the comment body's language is not English, translate it automatically. For the convenience of others, please use English next time👯. > Bot detected the comment body's language is not English, translate it automatically. For the convenience of others, please use English next time👯.
---- ----
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册