Giter Site home page Giter Site logo

j0k3r / worldcup-slack-bot Goto Github PK

View Code? Open in Web Editor NEW
39.0 10.0 29.0 36 KB

WorldCupBot will notify a Slack channel/group for every match during a FIFA World Cup

License: MIT License

PHP 100.00%
slack bot worldcup football worldcup-slack-bot php fifa-api

worldcup-slack-bot's Issues

2018 Update?

Is there any chance of an update to this bot for 2018?

Women's World Cup?

Has anyone taken a look at the FIFA API to see if this bot will work with the Women's World Cup next month?

Straight red card type number

According the previous Colombia/Japan match, it seems the type number for the straight red card is 3 but not 4 like the following defines.

const EVENT_STRAIGHT_RED = 4; // Maybe?

Refer to the match's events :

https://api.fifa.com/api/v1/timelines/17/254645/275073/300331550?language=fr-FR&count=1

{
  "EventId": "-1011232931",
  "IdTeam": "43926",
  "IdPlayer": "280487",
  "IdSubPlayer": null,
  "Timestamp": "2018-06-19T12:03:58.871Z",
  "MatchMinute": "3'",
  "Period": 3,
  "HomeGoals": 0,
  "AwayGoals": 0,
  "Type": 3,
  "TypeLocalized": [],
  "PositionX": null,
  "PositionY": null,
  "GoalGatePositionX": null,
  "GoalGatePositionY": null,
  "GoalGatePositionZ": null,
  "VarDetail": null,
  "HomePenaltyGoals": 0,
  "AwayPenaltyGoals": 0
}

unable to start the app

$ php worldCupNotifier.php

Fatal error: Uncaught Error: Call to undefined function curl_init() in C:\Users\nokram\Documents\salesforce\workspace\worldcup-slack-bot\worldCupNotifier.php:124
Stack trace:
#0 C:\Users\nokram\Documents\salesforce\workspace\worldcup-slack-bot\worldCupNotifier.php(219): getUrl('https://api.fif...')
#1 {main}
  thrown in C:\Users\nokram\Documents\salesforce\workspace\worldcup-slack-bot\worldCupNotifier.php on line 124

#########################3
below is the php details

$ php --version
PHP 7.2.7 (cli) (built: Jun 19 2018 23:13:48) ( NTS MSVC15 (Visual C++ 2017) x64 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

Add VAR support

Event type 71 seems to be VAR activity. It may be for several things like: incident being investigated, incident referred for review, final referee decision etc. Quite hard to reverse engineer.

From some examples I've seen, potentially these are:

// VAR
const VAR_INCIDENT_GOAL = 1;
const VAR_INCIDENT_NO_GOAL = 2; // Maybe?
const VAR_INCIDENT_PENALTY = 3;
const VAR_INCIDENT_NO_PENALTY = 4;
const VAR_INCIDENT_RED_CARD = 5; // Maybe?
const VAR_INCIDENT_NO_RED_CARD = 6;

const VAR_REASON_OFFSIDE = 1; // Maybe?
const VAR_REASON_FOUL = 5; // Maybe?
const VAR_REASON_HANDBALL = 6; // Maybe?

const VAR_STATUS_WATCHING = 0;
const VAR_STATUS_REVIEW = 1;
const VAR_STATUS_ONFIELD_REVIEW = 2;
const VAR_STATUS_VAR_DECISION = 3;
const VAR_STATUS_ONFIELD_DECISION = 4;

const VAR_RESULT_GOAL_AWARDED = 1;
const VAR_RESULT_GOAL_DISALLOWED = 2; // Maybe?
const VAR_RESULT_PENALTY_AWARDED = 3;
const VAR_RESULT_PENALTY_REVERSED = 4;
const VAR_RESULT_YELLOW_CARD = 7; // Or at least, no red card
const VAR_RESULT_NO_CHANGE = 9;

Extra time and Penalties

Thank you to Spain and Russia for giving us a test case.

From looking at the JSON from the FIFA API it looks like extra time could get mapped as such by the bot:

const PERIOD_1ST_ET = 7;
const PERIOD_2ND_ET = 9;

PHP Warning

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home/jason/projects/worldcup-slack-bot/worldCupNotifier.php on line 405

double posting

Do you guys noticed the duplicate post on slack? is it the fifa api?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.