add github plugin
This commit is contained in:
parent
9a0ffb2fc0
commit
f5f5a04d2b
@ -9,5 +9,8 @@ $TAGs = array('#','/','!');
|
|||||||
|
|
||||||
|
|
||||||
//For Telegram-Bot
|
//For Telegram-Bot
|
||||||
define('TB_TOKEN', '123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11');
|
define('TB_TOKEN', 'YOU_TELEGRAM_BOT_TOKEN_HERE');
|
||||||
define('TB_API_URL', 'https://api.telegram.org/bot'.TB_TOKEN.'/');
|
define('TB_API_URL', 'https://api.telegram.org/bot'.TB_TOKEN.'/');
|
||||||
|
|
||||||
|
//For plugins
|
||||||
|
define('PLUGIN_GITHUB_TOKEN', 'YOU_GITHUB_TOKEN_HERE');
|
28
plugins/github.php
Normal file
28
plugins/github.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
PluginSet("find someone on Github");
|
||||||
|
|
||||||
|
$opts = array ('http' => array ('header' => "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0",));
|
||||||
|
$user = file_get_contents("https://api.github.com/users/".urlencode($plugin_text).'?access_token='.PLUGIN_GITHUB_TOKEN, false, stream_context_create($opts));
|
||||||
|
$starred = file_get_contents("https://api.github.com/users/".urlencode($plugin_text)."/starred".'?access_token='.PLUGIN_GITHUB_TOKEN, false, stream_context_create($opts));
|
||||||
|
$user = json_decode($user,true);
|
||||||
|
$msg = "ID: @".$user['login'];
|
||||||
|
plugin_github_check("Type", $user['type']);
|
||||||
|
plugin_github_check("Name", $user['name']);
|
||||||
|
plugin_github_check("Email", $user['email']);
|
||||||
|
plugin_github_check("Company", $user['company']);
|
||||||
|
plugin_github_check("Starred", count(json_decode($starred,true)));
|
||||||
|
plugin_github_check("Repos", $user['public_repos']);
|
||||||
|
plugin_github_check("Followers", $user['followers']);
|
||||||
|
plugin_github_check("Following", $user['following']);
|
||||||
|
@$msg .= "\nUrl: https://github.com/".$user['login'];
|
||||||
|
|
||||||
|
function plugin_github_check($title, $check)
|
||||||
|
{
|
||||||
|
global $msg;
|
||||||
|
if (!empty($check)) {
|
||||||
|
return @$msg .= "\n".$title.": ".$check;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$BOT->msg($plugin_sendto, $msg);
|
Loading…
Reference in New Issue
Block a user