Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions app/Http/Controllers/WebhookController.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,21 @@ public function handleEvent(Request $request)

if ($headerGit && isset($headerGit['x-github-event']) && $headerGit['x-github-event'][0] == 'issue_comment') {
$this->handleEventGitHub($request->all());
}
}

$webhookEvent = $request->input('webhook_event');
$roomId = $webhookEvent['room_id'];
$fromId = trim($webhookEvent['from_account_id']);
$messageId = $webhookEvent['message_id'];

\Log::error($messageId);
// anh tung, chi dung, anh dungx, anh quangB,
$notReply = ['1272369', '775460', '764474', '2161732'];
$work = ['gmt', 'gmt postman', 'gmt api', 'gmt member', 'gmt workflow', 'gmt book', 'gmt git', 'gmt gg',
'git staging', 'gmt report', 'gmt pull', 'help', 'pull', 'music', 'weather', 'tat', 'vanhoa', '(tat)', '(tat1)', '(tat2)', '(tat3)', '(tat4)', '(tat5)', ];
// anh tung, chi dung, anh dungx,
$notReply = ['1272369', '775460', '764474'];
$work = ['gmt', 'gmt postman', 'gmt api', 'gmt member', 'gmt workflow', 'gmt book', 'gmt git', 'gmt gg', 'git staging', 'gmt report', 'gmt pull', 'help', 'pull', 'music', 'weather', 'tat', 'vanhoa', '(tat)', '(tat1)', '(tat2)', '(tat3)', '(tat4)', '(tat5)', 'map' ];
// Generate response
$message = $this->extractContent($webhookEvent['body']);
$convertMessage = trim(substr($message, 8, strlen($message)));
$convertMessage = trim(substr($message, 61, strlen($message)));

\Log::error($convertMessage);
$name = $this->getServiceName($message);

if (!in_array($fromId, $notReply)) {
Expand Down Expand Up @@ -138,34 +138,34 @@ public function handleEvent(Request $request)
'txt' => $convertMessage
];

$result = $client->request('GET', 'http://ghuntur.com/simsim.php', [
$result = $client->request('GET', 'https://simsimi.p.rapidapi.com/request.p', [
'query' => $array
]);

$simsimi = trim($result->getBody());

$simsimi = str_replace('Símimi', 'Jarvis', $simsimi);
$simsimi = str_replace('símimi', 'Jarvis', $simsimi);
$simsimi = str_replace('Sim', 'Jarvis', $simsimi);
$simsimi = str_replace('sim', 'Jarvis', $simsimi);
$simsimi = str_replace('Simsimi', 'Jarvis', $simsimi);
$simsimi = str_replace('simsimi', 'Jarvis', $simsimi);
$simsimi = str_replace('Simsim', 'Jarvis', $simsimi);
$simsimi = str_replace('simsim', 'Jarvis', $simsimi);
$simsimi = str_replace('con cặc', '***', $simsimi);
$simsimi = str_replace('dm', '***', $simsimi);
$simsimi = str_replace('vl', '***', $simsimi);
$simsimi = str_replace('fuck you', '***', $simsimi);
// $simsimi = str_replace('cứt', '***', $simsimi);
// $simsimi = str_replace('l', '***', $simsimi);
$simsimi = str_replace('dmm', '***', $simsimi);
$simsimi = str_replace('con chó', '***', $simsimi);
$simsimi = str_replace('mày', 'anh', $simsimi);
$simsimi = str_replace('may', 'anh', $simsimi);
$simsimi = str_replace('tao', 'em', $simsimi);
// $simsimi = str_replace('Símimi', 'Cậu Vàng', $simsimi);
// $simsimi = str_replace('símimi', 'Cậu Vàng', $simsimi);
// $simsimi = str_replace('Sim', 'Cậu Vàng', $simsimi);
// $simsimi = str_replace('sim', 'Cậu Vàng', $simsimi);
// $simsimi = str_replace('Simsimi', 'Cậu Vàng', $simsimi);
// $simsimi = str_replace('simsimi', 'Cậu Vàng', $simsimi);
// $simsimi = str_replace('Simsim', 'Cậu Vàng', $simsimi);
// $simsimi = str_replace('simsim', 'Cậu Vàng', $simsimi);
// $simsimi = str_replace('con cặc', '***', $simsimi);
// $simsimi = str_replace('dm', '***', $simsimi);
// $simsimi = str_replace('vl', '***', $simsimi);
// $simsimi = str_replace('fuck you', '***', $simsimi);
// // $simsimi = str_replace('cứt', '***', $simsimi);
// // $simsimi = str_replace('l', '***', $simsimi);
// $simsimi = str_replace('dmm', '***', $simsimi);
// $simsimi = str_replace('con chó', '***', $simsimi);
// $simsimi = str_replace('mày', 'anh', $simsimi);
// $simsimi = str_replace('may', 'anh', $simsimi);
// $simsimi = str_replace('tao', 'em', $simsimi);

if ($simsimi == 'Talk with random person: https://play.google.com/store/apps/details?id=www.speak.com') {
$response = '(bow)';
$response = $convertMessage;
} else {
$response = "[rp aid=$fromId to=$roomId]\n".$simsimi. PHP_EOL;
}
Expand All @@ -179,8 +179,8 @@ public function handleEvent(Request $request)


public function handleEventGitHub($gitHub) {
$idChatwork = ['2359460', '2359460', '1807071', '2559169', '2559207', '3401286', '3542580', '3543924', '3525316', '775460', '2684729', '2296305', '2357269'];
$nameGitHub = ['tranvanmy', 'mytv01-1146', 'quynhnt-0892', 'quandt-1233', 'sunh-1294', 'quynt-1571', 'vietnc-1636', 'ngocntb-0799', 'thangcx-0794', 'dunghtt-0080', 'nghiapt-1099', 'HoangTien339', 'tuanlabophp'];
$idChatwork = ['2359460', '2359460', '1807071', '2559169', '2559207', '3401286', '3542580', '3543924', '3525316', '775460', '2684729', '2135875', '3542426', '3001967'];
$nameGitHub = ['tranvanmy', 'mytv01-1146', 'quynhnt-0892', 'quandt-1233', 'sunh-1294', 'quynt-1571', 'vietnc-1636', 'ngocntb-0799', 'thangcx-0794', 'dunghtt-0080', 'nghiapt-1099', 'hieunv-0998', 'quannt-1637', 'ngoc'];
$linkComment = $gitHub['comment']['html_url'];
$idReply = null;
$idComment = null;
Expand All @@ -200,7 +200,7 @@ public function handleEventGitHub($gitHub) {
if (in_array($idReply, $girl)) {
$start = 'Chị đẹp ơi';
}
$roomId = '138295133';
$roomId = '197160731';
$body = $start.' ,có anh [To:'.$idComment.']comment pull của anh ạ (bow)'.PHP_EOL.$linkComment;
$response = "[rp aid=$idReply to=$roomId]\n".$body. PHP_EOL;

Expand All @@ -221,7 +221,7 @@ protected function sendResponse($response, $roomId)
{
try {

ChatworkSDK::setApiKey('7ddbd71d6a0f674a0c1fdaa5faaadbfd');
ChatworkSDK::setApiKey('d859d016032f340ca8b720c457f70aba');
$room = new ChatworkRoom($roomId);
$room->sendMessage($response);

Expand Down
4 changes: 1 addition & 3 deletions app/Services/Types/HelpService.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ public function createResponse($data)
return "[rp aid=$userId to=$roomId-$messId]\n"
. '[info][title]Danh sách những syntax hỗ trợ:[/title](*)music : Sẽ cho chúng ta 1 bài hát ngẫu nhiên giúp giảm căng thẳng
(*)weather: Sẽ cho chúng ta biết thời tiết hiện tại của Hà Nội
(*)map: Sẽ cho chúng ta biết được map các phòng họp, và chỗ ngồi của công ty Framgia
(*)welcome: @To .Bot sẽ thay mặt ae gửi lời mời cho member mới vào dự án hay box.
(*)tat: @To .Bot sẽ thay ae tát người cần tát
(*)vanhoa: Hiện văn hóa của Group ta
(*)pull: pull: title cuả pull để gửi pull request
[/info]' . PHP_EOL;
}
}
10 changes: 5 additions & 5 deletions app/Services/Types/PullService.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ public function createResponse($data)
$content = $this->extractContent($msg);

if (strrpos($content, 'webapp)') != 0) {
$to = '[To:2359460] [To:1807071] [To:2559169] [To:2559207] [To:3401286] [To:3542580] [To:3543924] [To:3525316]';
$to = '';
} else {
$to = '[To:2359460] [To:1807071] [To:2559169] [To:2559207] [To:3401286] [To:3542580] [To:3543924] [To:3525316]';
$to = '[To:5085113] [To:5102249] [To:5085124]';
}
$pullNumber = $this->extractPullNumber($content);

($userId == '2359460') ? $me = 'mình' : $me = 'em';
($userId == '5085124') ? $me = 'mình' : $me = 'em';

$reponse = "[rp aid=$userId to=$roomId-$messId]\n"
. $to . '
[info][title]Mọi người review giúp'.' '. $me .' '.'pull này với (bow)[/title](*) Title:' . $content . '
(*) Link: https://github.com/framgia/group-management-tool/pull/'. $pullNumber .'[/info]'. PHP_EOL;
(*) Link: https://bitbucket.org/vmodev/unic-cms/pull-requests/'. $pullNumber .'[/info]'. PHP_EOL;

return $reponse;
}
Expand All @@ -39,7 +39,7 @@ public function extractContent($msg)

public function extractPullNumber($content)
{
$number = substr($content, strlen($content) - 3);
$number = substr($content, strlen($content) - 2);

return $number;
}
Expand Down
Loading