Skip to content

Commit

Permalink
fix coporation endpoint v4
Browse files Browse the repository at this point in the history
  • Loading branch information
Slivo-fr committed Jan 15, 2018
1 parent e53fe28 commit b7a8416
Show file tree
Hide file tree
Showing 5 changed files with 406 additions and 82 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea/
/vendor/
logs/*
12 changes: 8 additions & 4 deletions Killbot.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ private function getShipName($victimShipId) {
return $this->knownShips[$victimShipId];
}

$json = $this->curlRequest(Settings::$ESI_URL . "/universe/types/$victimShipId/");
$json = $this->curlRequest(Settings::$ESI_URL . "v1/universe/types/$victimShipId/");
$data = json_decode($json);

$shipName = $data->{'name'};
Expand All @@ -216,7 +216,7 @@ private function getCharacterName($characterId) {
return $this->knownCharacters[$characterId];
}

$json = $this->curlRequest(Settings::$ESI_URL . "/characters/$characterId/");
$json = $this->curlRequest(Settings::$ESI_URL . "v4/characters/$characterId/");
$data = json_decode($json);

$characterName = $data->{'name'};
Expand All @@ -231,10 +231,10 @@ private function getCorporationName($corporationId) {
return $this->knownCorporations[$corporationId];
}

$json = $this->curlRequest(Settings::$ESI_URL . "/corporations/$corporationId/");
$json = $this->curlRequest(Settings::$ESI_URL . "v4/corporations/$corporationId/");
$data = json_decode($json);

$corporationName = $data->{'corporation_name'};
$corporationName = $data->{'name'};
$this->knownCorporations[$corporationId] = $corporationName;

return $corporationName;
Expand All @@ -258,6 +258,10 @@ private function curlRequest($url) {

private function pushToSlack($killData) {

if (Settings::$DEBUG) {
print_r($killData);
}

$data = "payload=" .json_encode($killData);

$ch = curl_init(Settings::$SLACK_HOOK);
Expand Down
145 changes: 72 additions & 73 deletions Settings.php
Original file line number Diff line number Diff line change
@@ -1,73 +1,72 @@
<?php

namespace Killbot;

class Settings {

/*******************************************************************************************************************
* Basic configuration
* Should be enough to get your bot running.
* Dont forget to setup a cronjob executing cron.php every $MAX_RUN_TIME + a small offset
******************************************************************************************************************/

// Slack webhook URL
public static $SLACK_HOOK = 'https://hooks.slack.com/services/ABC/DEF/GHI';

// 4 minutes default max run time
public static $MAX_RUN_TIME = 4 * 60;

// Entities you want to display killmails for
public static $WATCHED_ENTITIES = [
'corporations' => [
123456,
1324567
],
'alliances' => [
13245678
],
'systems' => [
30003504
]
];

/*******************************************************************************************************************
* Mail settings
* Allow script to send mail alert when something goes wrong
******************************************************************************************************************/

// Enable sending mails
public static $SEND_MAIL = true;

// Server configuration
public static $SMTP_SERVER = 'smtp.example.com';
public static $SMTP_PORT = '465';
public static $SMTP_USER = '[email protected]';
public static $SMTP_PASSWORD = 'my_password';

// Use null or ssl if required
public static $SECURITY = 'ssl';

// Mail addresses
public static $MAIL_RECIPIENT = '[email protected]';
public static $MAIL_SENDER = '[email protected]';

/*******************************************************************************************************************
* Advanced configuration
* Do not edit unless you know what you are doing
******************************************************************************************************************/

// HTTP header sent with each bot request
public static $HTTP_HEADER = 'RedisQ-Slack-Bot https://github.com/Slivo-fr/RedisQ-Slack-Bot';

// URL to redisQ
public static $REDISQ_URL = 'https://redisq.zkillboard.com/listen.php?ttw=1';

// Enable debugging behaviors
public static $DEBUG = false;

// Folder name for json logs
public static $KILL_LOG_FOLDER = 'logs';

// ESI base URL
public static $ESI_URL = 'https://esi.tech.ccp.is/latest';
}
<?php

namespace Killbot;

class Settings {

/*******************************************************************************************************************
* Basic configuration
* Should be enough to get your bot running.
* Dont forget to setup a cronjob executing cron.php every $MAX_RUN_TIME + a small offset
******************************************************************************************************************/

// Slack webhook URL
public static $SLACK_HOOK = 'https://hooks.slack.com/services/ABC/DEF/GHI';

// 4 minutes default max run time
public static $MAX_RUN_TIME = 4 * 60;

// Entities you want to display killmails for
public static $WATCHED_ENTITIES = [
'corporations' => [
123456,
1324567
],
'alliances' => [
13245678
],
'systems' => [
30003504
]
];

/*******************************************************************************************************************
* Mail settings
* Allow script to send mail alert when something goes wrong
******************************************************************************************************************/

// Enable sending mails
public static $SEND_MAIL = true;

// Server configuration
public static $SMTP_SERVER = 'smtp.example.com';
public static $SMTP_PORT = '465';
public static $SMTP_USER = '[email protected]';
public static $SMTP_PASSWORD = 'my_password';

// Use null or ssl if required
public static $SECURITY = 'ssl';

// Mail addresses
public static $MAIL_RECIPIENT = '[email protected]';
public static $MAIL_SENDER = '[email protected]';

/*******************************************************************************************************************
* Advanced configuration
* Do not edit unless you know what you are doing
******************************************************************************************************************/

// HTTP header sent with each bot request
public static $HTTP_HEADER = 'RedisQ-Slack-Bot https://github.com/Slivo-fr/RedisQ-Slack-Bot';

// URL to redisQ
public static $REDISQ_URL = 'https://redisq.zkillboard.com/listen.php?ttw=1';

// Enable debugging behaviors
public static $DEBUG = false;

// Folder name for json logs
public static $KILL_LOG_FOLDER = 'logs';

// ESI base URL
public static $ESI_URL = 'https://esi.tech.ccp.is/';}
Loading

0 comments on commit b7a8416

Please sign in to comment.