Commit 00965621 authored by Sean O'Donnell's avatar Sean O'Donnell

Changes to Game Processing

parent d604781b
......@@ -263,4 +263,19 @@ class APIController extends Controller
return response(['sucesss' => true]);
}
public function latestFollower($username){
$user = User::where('display_name', $username)->firstOrFail();
$follower = $user->userFollows()->first();
$client = new \GuzzleHttp\Client();
$res = $client->request('GET', 'https://api.twitch.tv/helix/users?id=' . $follower->from_id,
[
'headers' => [
'Client-ID' => $_ENV['TWITCH_KEY'],
]]);
$body = $res->getBody();
$contents = json_decode($body->getContents());
return $contents->data[0]->display_name;
}
}
......@@ -49,7 +49,8 @@ class ProcessProcesses implements ShouldQueue
foreach(json_decode($processes->processes) as $p)
{
$gname = Game::where('name', $p->PName)->first(); // Find the game based on the name
// Check for which game we can use.
$gname = Game::where('name', $p->PName)->orWhere('name', $p->PWName)->first();
if($gname != null)
$games[] = $gname;
}
......@@ -65,6 +66,8 @@ class ProcessProcesses implements ShouldQueue
}
$processes->notify(new ProcessesProcessed());
return true
}
}
......@@ -111,4 +111,8 @@ class User extends Authenticatable
]);
}
public function userFollows(){
return $this->hasMany('App\UserFollow', 'user_id', 'twitch_id')->orderBy('id', 'desc')->limit(1);
}
}
......@@ -41,4 +41,8 @@ class UserFollow extends Model
'id', 'notification_id', 'topic', 'type'
];
public function latestFollower(){
return $this->orderBy('id', 'desc')->limit(1)->get();
}
}
<?xml version="1.0" standalone="no"?><!-- Generator: Gravit.io --><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="isolation:isolate" viewBox="0 0 103 38" width="103" height="38"><path d=" M 19.266 24.01 L 19.266 24.01 L 19.266 24.01 Q 19.266 22.237 18.021 21.205 L 18.021 21.205 L 18.021 21.205 Q 16.775 20.172 13.465 19.242 L 13.465 19.242 L 13.465 19.242 Q 10.154 18.312 8.631 17.213 L 8.631 17.213 L 8.631 17.213 Q 6.463 15.66 6.463 13.141 L 6.463 13.141 L 6.463 13.141 Q 6.463 10.694 8.477 9.164 L 8.477 9.164 L 8.477 9.164 Q 10.491 7.633 13.626 7.633 L 13.626 7.633 L 13.626 7.633 Q 15.75 7.633 17.427 8.453 L 17.427 8.453 L 17.427 8.453 Q 19.104 9.273 20.027 10.738 L 20.027 10.738 L 20.027 10.738 Q 20.95 12.203 20.95 14.005 L 20.95 14.005 L 19.134 14.005 L 19.134 14.005 Q 19.134 11.822 17.64 10.497 L 17.64 10.497 L 17.64 10.497 Q 16.146 9.171 13.626 9.171 L 13.626 9.171 L 13.626 9.171 Q 11.18 9.171 9.729 10.262 L 9.729 10.262 L 9.729 10.262 Q 8.279 11.354 8.279 13.111 L 8.279 13.111 L 8.279 13.111 Q 8.279 14.737 9.583 15.763 L 9.583 15.763 L 9.583 15.763 Q 10.887 16.788 13.758 17.572 L 13.758 17.572 L 13.758 17.572 Q 16.629 18.355 18.108 19.198 L 18.108 19.198 L 18.108 19.198 Q 19.588 20.04 20.335 21.212 L 20.335 21.212 L 20.335 21.212 Q 21.082 22.384 21.082 23.98 L 21.082 23.98 L 21.082 23.98 Q 21.082 26.5 19.068 28.023 L 19.068 28.023 L 19.068 28.023 Q 17.054 29.547 13.758 29.547 L 13.758 29.547 L 13.758 29.547 Q 11.502 29.547 9.62 28.741 L 9.62 28.741 L 9.62 28.741 Q 7.737 27.936 6.763 26.485 L 6.763 26.485 L 6.763 26.485 Q 5.789 25.035 5.789 23.16 L 5.789 23.16 L 7.591 23.16 L 7.591 23.16 Q 7.591 25.416 9.275 26.72 L 9.275 26.72 L 9.275 26.72 Q 10.96 28.023 13.758 28.023 L 13.758 28.023 L 13.758 28.023 Q 16.248 28.023 17.757 26.925 L 17.757 26.925 L 17.757 26.925 Q 19.266 25.826 19.266 24.01 Z M 25.521 9.347 L 27.278 9.347 L 27.278 13.404 L 30.56 13.404 L 30.56 14.84 L 27.278 14.84 L 27.278 25.401 L 27.278 25.401 Q 27.278 26.72 27.754 27.364 L 27.754 27.364 L 27.754 27.364 Q 28.23 28.009 29.344 28.009 L 29.344 28.009 L 29.344 28.009 Q 29.783 28.009 30.765 27.862 L 30.765 27.862 L 30.838 29.298 L 30.838 29.298 Q 30.149 29.547 28.963 29.547 L 28.963 29.547 L 28.963 29.547 Q 27.161 29.547 26.341 28.5 L 26.341 28.5 L 26.341 28.5 Q 25.521 27.452 25.521 25.416 L 25.521 25.416 L 25.521 14.84 L 22.605 14.84 L 22.605 13.404 L 25.521 13.404 L 25.521 9.347 Z M 46.072 29.254 L 44.197 29.254 L 44.197 29.254 Q 43.934 28.507 43.86 27.042 L 43.86 27.042 L 43.86 27.042 Q 42.938 28.243 41.509 28.895 L 41.509 28.895 L 41.509 28.895 Q 40.081 29.547 38.484 29.547 L 38.484 29.547 L 38.484 29.547 Q 36.199 29.547 34.786 28.272 L 34.786 28.272 L 34.786 28.272 Q 33.372 26.998 33.372 25.05 L 33.372 25.05 L 33.372 25.05 Q 33.372 22.735 35.298 21.388 L 35.298 21.388 L 35.298 21.388 Q 37.225 20.04 40.667 20.04 L 40.667 20.04 L 43.846 20.04 L 43.846 18.238 L 43.846 18.238 Q 43.846 16.539 42.798 15.565 L 42.798 15.565 L 42.798 15.565 Q 41.751 14.591 39.744 14.591 L 39.744 14.591 L 39.744 14.591 Q 37.913 14.591 36.712 15.528 L 36.712 15.528 L 36.712 15.528 Q 35.511 16.466 35.511 17.784 L 35.511 17.784 L 33.753 17.77 L 33.753 17.77 Q 33.753 15.88 35.511 14.496 L 35.511 14.496 L 35.511 14.496 Q 37.269 13.111 39.832 13.111 L 39.832 13.111 L 39.832 13.111 Q 42.483 13.111 44.014 14.437 L 44.014 14.437 L 44.014 14.437 Q 45.545 15.763 45.589 18.136 L 45.589 18.136 L 45.589 25.636 L 45.589 25.636 Q 45.589 27.936 46.072 29.078 L 46.072 29.078 L 46.072 29.254 Z M 38.689 27.994 L 38.689 27.994 L 38.689 27.994 Q 40.447 27.994 41.832 27.145 L 41.832 27.145 L 41.832 27.145 Q 43.216 26.295 43.846 24.874 L 43.846 24.874 L 43.846 21.388 L 40.711 21.388 L 40.711 21.388 Q 38.089 21.417 36.609 22.347 L 36.609 22.347 L 36.609 22.347 Q 35.13 23.277 35.13 24.903 L 35.13 24.903 L 35.13 24.903 Q 35.13 26.236 36.119 27.115 L 36.119 27.115 L 36.119 27.115 Q 37.107 27.994 38.689 27.994 Z M 57.63 13.302 L 57.586 14.898 L 57.586 14.898 Q 57.029 14.796 56.399 14.796 L 56.399 14.796 L 56.399 14.796 Q 54.759 14.796 53.624 15.711 L 53.624 15.711 L 53.624 15.711 Q 52.488 16.627 52.005 18.37 L 52.005 18.37 L 52.005 29.254 L 50.262 29.254 L 50.262 13.404 L 51.976 13.404 L 52.005 15.924 L 52.005 15.924 Q 53.396 13.111 56.473 13.111 L 56.473 13.111 L 56.473 13.111 Q 57.205 13.111 57.63 13.302 L 57.63 13.302 Z M 61.321 9.347 L 63.079 9.347 L 63.079 13.404 L 66.36 13.404 L 66.36 14.84 L 63.079 14.84 L 63.079 25.401 L 63.079 25.401 Q 63.079 26.72 63.555 27.364 L 63.555 27.364 L 63.555 27.364 Q 64.031 28.009 65.145 28.009 L 65.145 28.009 L 65.145 28.009 Q 65.584 28.009 66.565 27.862 L 66.565 27.862 L 66.639 29.298 L 66.639 29.298 Q 65.95 29.547 64.764 29.547 L 64.764 29.547 L 64.764 29.547 Q 62.962 29.547 62.142 28.5 L 62.142 28.5 L 62.142 28.5 Q 61.321 27.452 61.321 25.416 L 61.321 25.416 L 61.321 14.84 L 58.406 14.84 L 58.406 13.404 L 61.321 13.404 L 61.321 9.347 Z M 69.832 28.199 L 69.832 28.199 L 69.832 28.199 Q 69.832 27.687 70.162 27.328 L 70.162 27.328 L 70.162 27.328 Q 70.491 26.969 71.077 26.969 L 71.077 26.969 L 71.077 26.969 Q 71.663 26.969 72 27.328 L 72 27.328 L 72 27.328 Q 72.337 27.687 72.337 28.199 L 72.337 28.199 L 72.337 28.199 Q 72.337 28.712 72 29.042 L 72 29.042 L 72 29.042 Q 71.663 29.371 71.077 29.371 L 71.077 29.371 L 71.077 29.371 Q 70.491 29.371 70.162 29.042 L 70.162 29.042 L 70.162 29.042 Q 69.832 28.712 69.832 28.199 Z M 79.119 6.754 L 79.119 29.254 L 77.361 29.254 L 77.361 6.754 L 79.119 6.754 Z M 83.982 13.404 L 88.904 26.734 L 93.533 13.404 L 95.423 13.404 L 88.655 31.949 L 88.304 32.77 L 88.304 32.77 Q 87 35.655 84.275 35.655 L 84.275 35.655 L 84.275 35.655 Q 83.646 35.655 82.928 35.45 L 82.928 35.45 L 82.913 34 L 83.821 34.088 L 83.821 34.088 Q 85.11 34.088 85.909 33.451 L 85.909 33.451 L 85.909 33.451 Q 86.707 32.813 87.264 31.261 L 87.264 31.261 L 88.04 29.122 L 82.063 13.404 L 83.982 13.404 Z " fill-rule="evenodd" fill="rgb(0,0,0)"/></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!-- Generator: Gravit.io --><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="isolation:isolate" viewBox="0 0 103 38" width="103" height="38"><path d=" M 19.266 24.01 L 19.266 24.01 L 19.266 24.01 Q 19.266 22.237 18.021 21.205 L 18.021 21.205 L 18.021 21.205 Q 16.775 20.172 13.465 19.242 L 13.465 19.242 L 13.465 19.242 Q 10.154 18.312 8.631 17.213 L 8.631 17.213 L 8.631 17.213 Q 6.463 15.66 6.463 13.141 L 6.463 13.141 L 6.463 13.141 Q 6.463 10.694 8.477 9.164 L 8.477 9.164 L 8.477 9.164 Q 10.491 7.633 13.626 7.633 L 13.626 7.633 L 13.626 7.633 Q 15.75 7.633 17.427 8.453 L 17.427 8.453 L 17.427 8.453 Q 19.104 9.273 20.027 10.738 L 20.027 10.738 L 20.027 10.738 Q 20.95 12.203 20.95 14.005 L 20.95 14.005 L 19.134 14.005 L 19.134 14.005 Q 19.134 11.822 17.64 10.497 L 17.64 10.497 L 17.64 10.497 Q 16.146 9.171 13.626 9.171 L 13.626 9.171 L 13.626 9.171 Q 11.18 9.171 9.729 10.262 L 9.729 10.262 L 9.729 10.262 Q 8.279 11.354 8.279 13.111 L 8.279 13.111 L 8.279 13.111 Q 8.279 14.737 9.583 15.763 L 9.583 15.763 L 9.583 15.763 Q 10.887 16.788 13.758 17.572 L 13.758 17.572 L 13.758 17.572 Q 16.629 18.355 18.108 19.198 L 18.108 19.198 L 18.108 19.198 Q 19.588 20.04 20.335 21.212 L 20.335 21.212 L 20.335 21.212 Q 21.082 22.384 21.082 23.98 L 21.082 23.98 L 21.082 23.98 Q 21.082 26.5 19.068 28.023 L 19.068 28.023 L 19.068 28.023 Q 17.054 29.547 13.758 29.547 L 13.758 29.547 L 13.758 29.547 Q 11.502 29.547 9.62 28.741 L 9.62 28.741 L 9.62 28.741 Q 7.737 27.936 6.763 26.485 L 6.763 26.485 L 6.763 26.485 Q 5.789 25.035 5.789 23.16 L 5.789 23.16 L 7.591 23.16 L 7.591 23.16 Q 7.591 25.416 9.275 26.72 L 9.275 26.72 L 9.275 26.72 Q 10.96 28.023 13.758 28.023 L 13.758 28.023 L 13.758 28.023 Q 16.248 28.023 17.757 26.925 L 17.757 26.925 L 17.757 26.925 Q 19.266 25.826 19.266 24.01 Z M 25.521 9.347 L 27.278 9.347 L 27.278 13.404 L 30.56 13.404 L 30.56 14.84 L 27.278 14.84 L 27.278 25.401 L 27.278 25.401 Q 27.278 26.72 27.754 27.364 L 27.754 27.364 L 27.754 27.364 Q 28.23 28.009 29.344 28.009 L 29.344 28.009 L 29.344 28.009 Q 29.783 28.009 30.765 27.862 L 30.765 27.862 L 30.838 29.298 L 30.838 29.298 Q 30.149 29.547 28.963 29.547 L 28.963 29.547 L 28.963 29.547 Q 27.161 29.547 26.341 28.5 L 26.341 28.5 L 26.341 28.5 Q 25.521 27.452 25.521 25.416 L 25.521 25.416 L 25.521 14.84 L 22.605 14.84 L 22.605 13.404 L 25.521 13.404 L 25.521 9.347 Z M 46.072 29.254 L 44.197 29.254 L 44.197 29.254 Q 43.934 28.507 43.86 27.042 L 43.86 27.042 L 43.86 27.042 Q 42.938 28.243 41.509 28.895 L 41.509 28.895 L 41.509 28.895 Q 40.081 29.547 38.484 29.547 L 38.484 29.547 L 38.484 29.547 Q 36.199 29.547 34.786 28.272 L 34.786 28.272 L 34.786 28.272 Q 33.372 26.998 33.372 25.05 L 33.372 25.05 L 33.372 25.05 Q 33.372 22.735 35.298 21.388 L 35.298 21.388 L 35.298 21.388 Q 37.225 20.04 40.667 20.04 L 40.667 20.04 L 43.846 20.04 L 43.846 18.238 L 43.846 18.238 Q 43.846 16.539 42.798 15.565 L 42.798 15.565 L 42.798 15.565 Q 41.751 14.591 39.744 14.591 L 39.744 14.591 L 39.744 14.591 Q 37.913 14.591 36.712 15.528 L 36.712 15.528 L 36.712 15.528 Q 35.511 16.466 35.511 17.784 L 35.511 17.784 L 33.753 17.77 L 33.753 17.77 Q 33.753 15.88 35.511 14.496 L 35.511 14.496 L 35.511 14.496 Q 37.269 13.111 39.832 13.111 L 39.832 13.111 L 39.832 13.111 Q 42.483 13.111 44.014 14.437 L 44.014 14.437 L 44.014 14.437 Q 45.545 15.763 45.589 18.136 L 45.589 18.136 L 45.589 25.636 L 45.589 25.636 Q 45.589 27.936 46.072 29.078 L 46.072 29.078 L 46.072 29.254 Z M 38.689 27.994 L 38.689 27.994 L 38.689 27.994 Q 40.447 27.994 41.832 27.145 L 41.832 27.145 L 41.832 27.145 Q 43.216 26.295 43.846 24.874 L 43.846 24.874 L 43.846 21.388 L 40.711 21.388 L 40.711 21.388 Q 38.089 21.417 36.609 22.347 L 36.609 22.347 L 36.609 22.347 Q 35.13 23.277 35.13 24.903 L 35.13 24.903 L 35.13 24.903 Q 35.13 26.236 36.119 27.115 L 36.119 27.115 L 36.119 27.115 Q 37.107 27.994 38.689 27.994 Z M 57.63 13.302 L 57.586 14.898 L 57.586 14.898 Q 57.029 14.796 56.399 14.796 L 56.399 14.796 L 56.399 14.796 Q 54.759 14.796 53.624 15.711 L 53.624 15.711 L 53.624 15.711 Q 52.488 16.627 52.005 18.37 L 52.005 18.37 L 52.005 29.254 L 50.262 29.254 L 50.262 13.404 L 51.976 13.404 L 52.005 15.924 L 52.005 15.924 Q 53.396 13.111 56.473 13.111 L 56.473 13.111 L 56.473 13.111 Q 57.205 13.111 57.63 13.302 L 57.63 13.302 Z M 61.321 9.347 L 63.079 9.347 L 63.079 13.404 L 66.36 13.404 L 66.36 14.84 L 63.079 14.84 L 63.079 25.401 L 63.079 25.401 Q 63.079 26.72 63.555 27.364 L 63.555 27.364 L 63.555 27.364 Q 64.031 28.009 65.145 28.009 L 65.145 28.009 L 65.145 28.009 Q 65.584 28.009 66.565 27.862 L 66.565 27.862 L 66.639 29.298 L 66.639 29.298 Q 65.95 29.547 64.764 29.547 L 64.764 29.547 L 64.764 29.547 Q 62.962 29.547 62.142 28.5 L 62.142 28.5 L 62.142 28.5 Q 61.321 27.452 61.321 25.416 L 61.321 25.416 L 61.321 14.84 L 58.406 14.84 L 58.406 13.404 L 61.321 13.404 L 61.321 9.347 Z M 69.832 28.199 L 69.832 28.199 L 69.832 28.199 Q 69.832 27.687 70.162 27.328 L 70.162 27.328 L 70.162 27.328 Q 70.491 26.969 71.077 26.969 L 71.077 26.969 L 71.077 26.969 Q 71.663 26.969 72 27.328 L 72 27.328 L 72 27.328 Q 72.337 27.687 72.337 28.199 L 72.337 28.199 L 72.337 28.199 Q 72.337 28.712 72 29.042 L 72 29.042 L 72 29.042 Q 71.663 29.371 71.077 29.371 L 71.077 29.371 L 71.077 29.371 Q 70.491 29.371 70.162 29.042 L 70.162 29.042 L 70.162 29.042 Q 69.832 28.712 69.832 28.199 Z M 79.119 6.754 L 79.119 29.254 L 77.361 29.254 L 77.361 6.754 L 79.119 6.754 Z M 83.982 13.404 L 88.904 26.734 L 93.533 13.404 L 95.423 13.404 L 88.655 31.949 L 88.304 32.77 L 88.304 32.77 Q 87 35.655 84.275 35.655 L 84.275 35.655 L 84.275 35.655 Q 83.646 35.655 82.928 35.45 L 82.928 35.45 L 82.913 34 L 83.821 34.088 L 83.821 34.088 Q 85.11 34.088 85.909 33.451 L 85.909 33.451 L 85.909 33.451 Q 86.707 32.813 87.264 31.261 L 87.264 31.261 L 88.04 29.122 L 82.063 13.404 L 83.982 13.404 Z " fill-rule="evenodd" fill="rgb(255,255,255)"/></svg>
\ No newline at end of file
This diff is collapsed.
......@@ -55,6 +55,8 @@ use Carbon\Carbon;
*/
Route::get('user/{apikey}', 'User\APIController@getUser');
Route::get('user/latestfollower/{username}', 'API\APIController@latestFollower');
/**
* Process any incoming processes data we get from the app
*/
......
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