|
You last visited: Today at 20:20
Advertisement
Gitlab to Discord Webhook
Discussion on Gitlab to Discord Webhook within the Coding Snippets forum part of the Coding Releases category.
10/21/2016, 13:11
|
#1
|
dotCom
elite*gold: 9570
Join Date: Mar 2009
Posts: 16,812
Received Thanks: 4,663
|
Gitlab to Discord Webhook
Hallo elitepvpers,
kleines Snippet um die Discord webhooks für gitlab zu benutzen.
Einfach Irgendwo hochladen wo cUrl erlaubt ist und gitlab darauf verlinken.
PHP Code:
<?php
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 'On');
/* Variables editing */
$GitlabToken = "";
$DiscordWebHook = "https://ptb.discordapp.com/api/webhooks/";
if( $_SERVER['HTTP_X_GITLAB_TOKEN'] ) {
if( $_SERVER['HTTP_X_GITLAB_TOKEN'] = $GitlabToken ) {
$json = file_get_contents('php://input');
$action = json_decode($json, true);
$payloadArr = array(
"username" => "Gitlab",
"icon_url" => "http://i.epvpimg.com/Rdh7c.jpg",
"text" => $action['project']['name'],
"attachments" => array(
array(
"author_icon" => $action['user_avatar'],
"author_name" => $action['commits'][0]['author']['name'],
"color" => "#ffffff",
"fields" => array(
array(
"title" => $action['event_name'],
"value" => "[" . substr($action['commits'][0]['id'], 0, 7) . "](" . $action['commits'][0]['url'] . ") ",
),
),
),
),
);
$payload = json_encode($payloadArr);
$ch = curl_init();
$options = array(
CURLOPT_URL => $DiscordWebHook . "/slack",
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => array('Content-type: application/json'),
);
curl_setopt_array($ch, $options);
$result = curl_exec($ch);
$httpCodeReturned = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$result_str = json_decode($result);
/*
* print_r($result_str);
* print($payload);
* */
print($httpCodeReturned);
}
}
|
|
|
10/21/2016, 18:16
|
#2
|
elite*gold: 0
Join Date: Sep 2010
Posts: 473
Received Thanks: 104
|
Can u post on english too pls ?
|
|
|
10/21/2016, 19:00
|
#3
|
dotCom
elite*gold: 9570
Join Date: Mar 2009
Posts: 16,812
Received Thanks: 4,663
|
Quote:
Originally Posted by mlukac89
Can u post on english too pls ?
|
Just upload it to any server and change the
PHP Code:
$GitlabToken = "";
$DiscordWebHook = "https://ptb.discordapp.com/api/webhooks/";
and enable Webhooks in Gitlab
|
|
|
01/29/2024, 15:05
|
#5
|
elite*gold: 398
Join Date: May 2020
Posts: 2,447
Received Thanks: 412
|
Thank you
|
|
|
 |
Similar Threads
|
[JS] [Discord Bot] Neptr
11/20/2016 - Coding Releases - 4 Replies
Hey zusammen :)
Wollte mir letztens mal die Discord API anschauen und dabei ist dieser Bot entstanden.
http://i.epvpimg.com/ov7ug.gif
Also warum heißt er Neptr?
Mir ist kein besserer Name eingefallen.
N.E.P.T.R. ist der Never-Ending-Pie-Throwing-Robot aus Adventure Time :D
Was kann er so?
|
Entwickler für Webhook zu Table
08/15/2016 - Coders Trading - 0 Replies
Ich benötige einen Entwickler der mir die Daten von einer Webhook in eine passende Form bringt.
1. Daten kommen per Webhook von mailparser.io
2. Daten werden per Webhook in Datenbank bzw. das Script geschrieben.
3. Die Daten sollen dann dargestellte werden wie folgt
Der Webhook liefert die Daten. Der Timer soll starten bei 05:00 Minuten basierend ab erhalt der E-Mail, sollte also der Webhook 30sec benötigen, so soll dann nur mehr 04:30 angezeigt werden.
|
Gitlab/Gitorious auf Ubuntu
05/15/2015 - General Coding - 0 Replies
Moin,
ich stehe vor einem recht blöden Problem was ich nicht gelöst bekomme.
Ich habe einen kleinen VPS und möchte darauf nun Gitorious installieren.
Benutzt wird Ubuntu 14.04.
Ich befolge ganz simple diese Anleitung von deren Homepage:
http://grabilla.com/0550f-f6b74a8d-c802-47d9-9ff8 -fefe143757be.png
Sieht ja mal ganz simple aus, ist es ja auch aber Postgres macht mir das Leben schwer, jedesmal beim ausführen der dritten Anweisung schlägt die Installation fehl, weil Postgres...
|
Discord Art
01/03/2008 - World of Warcraft - 10 Replies
Hi
ich suche Discord Art für die aktuelle WoW-Version finde aber leider nichts, wenn einer eine aktuelle Version findet pls verlinken. thx :)
mfg
NeoAr
|
All times are GMT +1. The time now is 20:20.
|
|