Open DuyenPTM opened 2 years ago
111111111
123
sadsad
yyyy
/ exported Script /
// Begin embedded images const gh_cmit_svg = ''; const gh_pr_svg = ''; const gh_iss_svg = ''; const svg_inline_prefix = 'data:image/svg+xml;ascii,'; // End embedded images
const getLabelsField = (labels) => { let labelsArray = []; labels.forEach(function(label) { labelsArray.push(label.name); }); labelsArray = labelsArray.join(', '); return { title: 'Labels', value: labelsArray, short: labelsArray.length <= 40 }; };
const githubEvents = { ping(request) { return { content: { text: ':thumbsup: ' + request.content.zen } }; },
issues(request) { const user = request.content.sender; const attachment = { author_icon: svg_inline_prefix + gh_iss_svg, author_name: '#' + request.content.issue.number + ' - ' + request.content.issue.title, author_link: request.content.issue.html_url, fields: [] };
if (request.content.issue.labels) {
attachment.fields.push(getLabelsField(request.content.issue.labels));
}
if (request.content.issue.assignee) {
attachment.fields.push({
title: 'Assignee',
value: request.content.issue.assignee.login,
short: true
});
}
const actions = {
'assigned': ':inbox_tray:',
'unassigned': ':outbox_tray:',
'opened': ':triangular_flag_on_post:',
'closed': ':white_check_mark:',
'reopened': ':triangular_flag_on_post:',
'labeled': ':label:',
'unlabeled': ':label:',
'edited': ':pencil:'
};
const text = actions[request.content.action] + ' issue';
return {
content: {
icon_url: user.avatar_url,
alias: user.login,
text: text,
attachments: [attachment]
}
};
},
issue_comment(request) { const user = request.content.comment.user; var attachment = { author_icon: svg_inline_prefix + gh_iss_svg, author_name: '#' + request.content.issue.number + ' - ' + request.content.issue.title, author_link: request.content.comment.html_url, fields: [] };
if (request.content.issue.labels) {
attachment.fields.push(getLabelsField(request.content.issue.labels));
}
if (request.content.issue.assignee) {
attachment.fields.push({
title: 'Assignee',
value: request.content.issue.assignee.login,
short: true
});
}
const text = ':speech_balloon: ' + request.content.comment.body;
return {
content: {
icon_url: user.avatar_url,
alias: user.login,
text: text,
attachments: [attachment]
}
};
},
pull_request(request) { const user = request.content.sender; const attachment = { author_icon: svg_inline_prefix + gh_pr_svg, author_name: '#' + request.content.pull_request.number + ' - ' + request.content.pull_request.title, author_link: request.content.pull_request.html_url };
let text = 'Pull request';
switch (request.content.action) {
case 'assigned':
text += ' assigned to: ' + request.content.assignee.login;
break;
case 'unassigned':
text += ' unassigned of ' + request.content.assignee.login;
break;
case 'opened':
text += ' opened';
break;
case 'closed':
if (request.content.pull_request.merged) {
text += ' merged';
} else {
text += ' closed';
}
break;
case 'reopened':
text += ' reopened';
break;
case 'labeled':
text += ' added label: "' + request.content.label.name + '" ';
break;
case 'unlabeled':
text += ' removed label: "' + request.content.label.name + '" ';
break;
case 'synchronize':
text += ' synchronized';
}
return {
content: {
icon_url: user.avatar_url,
alias: user.login,
text: text,
attachments: [attachment]
}
};
},
//// GitHub push event push(request) { var commits = request.content.commits; var multi_commit = "" var is_short = true; var changeset = 'Changeset'; if ( commits.length > 1 ) { var multi_commit = " [Multiple Commits]"; var is_short = false; var changeset = changeset + 's'; var output = []; } const user = request.content.sender; const attachment = { author_icon: svg_inline_prefix + gh_cmit_svg, author_name: "Message: " + request.content.head_commit.message + multi_commit, author_link: request.content.compare, fields: [] };
if (request.content.repository.full_name) {
attachment.fields.push({
title: 'Repo',
value: "["+request.content.repository.full_name+"]("+request.content.repository.url+")",
short: is_short
});
}
for (var i = 0; i < commits.length; i++) {
var commit = commits[i];
var shortID = commit.id.substring(0,7);
if ( commits.length > 1 ) {
output = '[' + shortID + '](' + commit.url + ') - ' + commit.message
if (i == 0){
attachment.fields.push({
title: changeset,
value: output,
short: is_short
});
} else{
attachment.fields.push({
title: changeset,
value: output,
short: is_short
});
}
} else {
output = "[" + shortID + "](" + commit.url + ")"
attachment.fields.push({
title: changeset,
value: output,
short: is_short
});
}
}
const text = ':ballot_box_with_check: Pushed to ' + "["+request.content.ref.split('/').pop()+"]";
return {
content: {
icon_url: user.avatar_url,
alias: user.login,
text: text,
attachments: [attachment]
}
}; }, // End GitHub Push };
class Script { process_incoming_request({ request }) { const header = request.headers['x-github-event']; if (githubEvents[header]) { return githubEventsheader; }
return {
error: {
success: false,
message: 'Unsupported method'
}
};
} }
https://translate.google.com/?hl=vi&sl=ko&tl=vi&text=1%2C%20https%3A%2F%2Fgithub.com%2Fntqpjt%2FSchat.Rocket.Chat.Electron%2Fissues%2F308%0Ahttps%3A%2F%2Fgithub.com%2Fntqpjt%2FSchat.Rocket.Chat%2Fissues%2F3128%0A%3D%3E%20Task%20n%C3%A0y%20%C4%91%C3%A3%20check%20xong%20c%C3%B9ng%20task%20%233128%2C%20ch%E1%BB%9D%20KH%20tr%E1%BA%A3%20l%E1%BB%9Di%20OK%20l%C3%A0%20done%20c%E1%BA%A3%20hai%20task%0A2%2C%20%0Ahttps%3A%2F%2Fgithub.com%2Fntqpjt%2FSchat.Rocket.Chat.ReactNative%2Fissues%2F1039%0A3%2C%20%0Ahttps%3A%2F%2Fgithub.com%2Fntqpjt%2FSchat.Rocket.Chat.ReactNative%2Fissues%2F1033%0A4%2C%20https%3A%2F%2Fgithub.com%2Fntqpjt%2FSchat.Rocket.Chat.ReactNative%2Fissues%2F1037%0A%3D%3E%203%20task%20n%C3%A0y%20ch%E1%BB%9D%20a%20C%C6%B0%E1%BB%9Dng%20build%20r%E1%BB%93i%20confirm%0A5%2C%20%0Ahttps%3A%2F%2Fgithub.com%2Fntqpjt%2FSchat.Rocket.Chat.ReactNative%2Fissues%2F999%0A%3D%3E%20Task%20n%C3%A0y%20ch%E1%BB%89%20l%C3%A0%20%C4%91%E1%BA%B7t%20log%2C%20ch%C6%B0a%20fix%20g%C3%AC%20n%C3%AAn%20kh%C3%B4ng%20c%E1%BA%A7n%20test%0A6%2C%20%0Ahttps%3A%2F%2Fgithub.com%2Fntqpjt%2FSchat.Rocket.Chat.ReactNative%2Fissues%2F1036%0A-%3E%20Task%20n%C3%A0y%20%C4%91%E1%BB%A3i%20a%20Long%20%C4%91i%20l%C3%A0m%20%C4%91%E1%BB%83%20m%C6%B0%E1%BB%A3n%20device%20test%0A&op=translate https://translate.google.com/?hl=vi&sl=ko&tl=vi&text=1%2C%20https%3A%2F%2Fgithub.com%2Fntqpjt%2FSchat.Rocket.Chat.Electron%2Fissues%2F308%0Ahttps%3A%2F%2Fgithub.com%2Fntqpjt%2FSchat.Rocket.Chat%2Fissues%2F3128%0A%3D%3E%20Task%20n%C3%A0y%20%C4%91%C3%A3%20check%20xong%20c%C3%B9ng%20task%20%233128%2C%20ch%E1%BB%9D%20KH%20tr%E1%BA%A3%20l%E1%BB%9Di%20OK%20l%C3%A0%20done%20c%E1%BA%A3%20hai%20task%0A2%2C%20%0Ahttps%3A%2F%2Fgithub.com%2Fntqpjt%2FSchat.Rocket.Chat.ReactNative%2Fissues%2F1039%0A3%2C%20%0Ahttps%3A%2F%2Fgithub.com%2Fntqpjt%2FSchat.Rocket.Chat.ReactNative%2Fissues%2F1033%0A4%2C%20https%3A%2F%2Fgithub.com%2Fntqpjt%2FSchat.Rocket.Chat.ReactNative%2Fissues%2F1037%0A%3D%3E%203%20task%20n%C3%A0y%20ch%E1%BB%9D%20a%20C%C6%B0%E1%BB%9Dng%20build%20r%E1%BB%93i%20confirm%0A5%2C%20%0Ahttps%3A%2F%2Fgithub.com%2Fntqpjt%2FSchat.Rocket.Chat.ReactNative%2Fissues%2F999%0A%3D%3E%20Task%20n%C3%A0y%20ch%E1%BB%89%20l%C3%A0%20%C4%91%E1%BA%B7t%20log%2C%20ch%C6%B0a%20fix%20g%C3%AC%20n%C3%AAn%20kh%C3%B4ng%20c%E1%BA%A7n%20test%0A6%2C%20%0Ahttps%3A%2F%2Fgithub.com%2Fntqpjt%2FSchat.Rocket.Chat.ReactNative%2Fissues%2F1036%0A-%3E%20Task%20n%C3%A0y%20%C4%91%E1%BB%A3i%20a%20Long%20%C4%91i%20l%C3%A0m%20%C4%91%E1%BB%83%20m%C6%B0%E1%BB%A3n%20device%20test%0A&op=translate
abcdefjghiklmnopqrstuvxyz
àvbd
dvv
vsv
shrh
nong--- | 1s
gae
sded
gưee
hello
helo
dsadad
dsdasda
Test send message from github
Hi
1111
1223
vbnvbnv