Commit 3e572abd authored by alexm98's avatar alexm98

Created !commitlog command that displays latest commits from

repositories in gitrepos.txt
parent ee911bb8
https://gitlab.com/api/v4/projects/6622864/repository/commits?private_token=
<?php ini_set('user_agent','Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0');
class Commitlog{
public function run($channel){
$config = require('config.php');
$conn = Connection::getInstance();
$handle = fopen('gitrepos.txt', 'r');
while(($line = fgets($handle)) !== false){
$commits = file_get_contents(rtrim($line, "\n\r") . $config['gitlab_token']);
$commits = json_decode($commits);
$latest = 'Commit ' . $commits[0]->id . ' created at ' . $commits[0]->created_at . ' by ' . $commits[0]->author_name . ' - ' .$commits[0]->title;
$conn->sendData($channel, $latest);
}
fclose($handle);
}
}
?>
......@@ -10,10 +10,10 @@ return array(
'Cleverbot' => $baseDir . '/src/Cleverbot.php',
'Color' => $baseDir . '/src/Color.php',
'Command' => $baseDir . '/src/Command.php',
'Commitlog' => $baseDir . '/src/CommitLog.php',
'Connection' => $baseDir . '/src/Connection.php',
'Database' => $baseDir . '/src/Database.php',
'Dpt' => $baseDir . '/src/Dpt.php',
'Gitlogger' => $baseDir . '/src/Gitlogger.php',
'Help' => $baseDir . '/src/Help.php',
'Linkanalyzer' => $baseDir . '/src/Linkanalyzer.php',
'Log' => $baseDir . '/src/Log.php',
......
......@@ -11,10 +11,10 @@ class ComposerStaticInit3621ca872ca0b5ee1afe7925bc99b74b
'Cleverbot' => __DIR__ . '/../..' . '/src/Cleverbot.php',
'Color' => __DIR__ . '/../..' . '/src/Color.php',
'Command' => __DIR__ . '/../..' . '/src/Command.php',
'Commitlog' => __DIR__ . '/../..' . '/src/CommitLog.php',
'Connection' => __DIR__ . '/../..' . '/src/Connection.php',
'Database' => __DIR__ . '/../..' . '/src/Database.php',
'Dpt' => __DIR__ . '/../..' . '/src/Dpt.php',
'Gitlogger' => __DIR__ . '/../..' . '/src/Gitlogger.php',
'Help' => __DIR__ . '/../..' . '/src/Help.php',
'Linkanalyzer' => __DIR__ . '/../..' . '/src/Linkanalyzer.php',
'Log' => __DIR__ . '/../..' . '/src/Log.php',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment