|
| 1 | +# @elizaos/plugin-football |
| 2 | + |
| 3 | +A plugin providing live football match data and league standings integration for ElizaOS agents. |
| 4 | + |
| 5 | +## Description |
| 6 | + |
| 7 | +The Football plugin integrates with the [Football-Data.org API](https://www.football-data.org/) to enable ElizaOS agents to fetch live football match information and league standings. It includes actions and utilities to provide real-time football data in conversations. |
| 8 | + |
| 9 | +## Installation |
| 10 | + |
| 11 | +To install the plugin, use the following command: |
| 12 | + |
| 13 | +```bash |
| 14 | +pnpm install @elizaos/plugin-football |
| 15 | +``` |
| 16 | + |
| 17 | +## Features |
| 18 | + |
| 19 | +### 1. Live Match Data |
| 20 | + |
| 21 | +- **Action**: `fetchMatchAction` |
| 22 | + - Retrieves live football match data, including: |
| 23 | + - Teams |
| 24 | + - Scores |
| 25 | + - Game events |
| 26 | + - Provides real-time updates for ongoing matches. |
| 27 | + |
| 28 | +### 2. League Standings |
| 29 | + |
| 30 | +- **Action**: `fetchStandingsAction` |
| 31 | + - Fetches league standings for a specified competition, including: |
| 32 | + - Team rankings |
| 33 | + - Points |
| 34 | + - Goals scored |
| 35 | + - Other league statistics. |
| 36 | + |
| 37 | +### 3. Flexible Integration |
| 38 | + |
| 39 | +- Extendable for additional football data, such as: |
| 40 | + - Player statistics |
| 41 | + - Match schedules |
| 42 | + - Historical match data. |
| 43 | + |
| 44 | +## API Key Configuration |
| 45 | + |
| 46 | +To use this plugin, you need an API key from [Football-Data.org](https://www.football-data.org/). |
| 47 | + |
| 48 | +1. Register and obtain your API key from Football-Data.org. |
| 49 | +2. Add the API key to your `.env` file: |
| 50 | + |
| 51 | + ```env |
| 52 | + FOOTBALL_API_KEY=your_api_key_here |
| 53 | + ``` |
| 54 | +
|
| 55 | +The plugin will use this key to authenticate requests. |
| 56 | +
|
| 57 | +## Usage Examples |
| 58 | +
|
| 59 | +### `fetchMatchAction` |
| 60 | +
|
| 61 | +**Description**: Retrieves live match data. |
| 62 | +
|
| 63 | +**Code Example**: |
| 64 | +
|
| 65 | +```javascript |
| 66 | +import { fetchMatchAction } from "@elizaos/plugin-football"; |
| 67 | +
|
| 68 | +const result = await fetchMatchAction.handler(runtime, message, state); |
| 69 | +console.log(result); |
| 70 | +``` |
| 71 | + |
| 72 | +**Sample Output**: |
| 73 | + |
| 74 | +```json |
| 75 | +{ |
| 76 | + "matches": [ |
| 77 | + { |
| 78 | + "homeTeam": { "name": "Chelsea" }, |
| 79 | + "awayTeam": { "name": "Arsenal" }, |
| 80 | + "score": { |
| 81 | + "fullTime": { "homeTeam": 1, "awayTeam": 2 } |
| 82 | + } |
| 83 | + } |
| 84 | + ] |
| 85 | +} |
| 86 | +``` |
| 87 | + |
| 88 | +### `fetchStandingsAction` |
| 89 | + |
| 90 | +**Description**: Fetches league standings for a specific competition. |
| 91 | + |
| 92 | +**Code Example**: |
| 93 | + |
| 94 | +```javascript |
| 95 | +import { fetchStandingsAction } from "@elizaos/plugin-football"; |
| 96 | + |
| 97 | +const result = await fetchStandingsAction.handler(runtime, message, state); |
| 98 | +console.log(result); |
| 99 | +``` |
| 100 | + |
| 101 | +**Sample Output**: |
| 102 | + |
| 103 | +```json |
| 104 | +{ |
| 105 | + "standings": [ |
| 106 | + { |
| 107 | + "table": [ |
| 108 | + { |
| 109 | + "position": 1, |
| 110 | + "team": { "name": "Manchester City" }, |
| 111 | + "points": 45 |
| 112 | + }, |
| 113 | + { "position": 2, "team": { "name": "Arsenal" }, "points": 42 } |
| 114 | + ] |
| 115 | + } |
| 116 | + ] |
| 117 | +} |
| 118 | +``` |
| 119 | + |
| 120 | +## Development |
| 121 | + |
| 122 | +### Steps to Build and Test |
| 123 | + |
| 124 | +1. Clone the repository: |
| 125 | + |
| 126 | + ```bash |
| 127 | + git clone https://github.com/elizaOS/eliza.git |
| 128 | + ``` |
| 129 | + |
| 130 | +2. Navigate to the `plugin-football` directory and install dependencies: |
| 131 | + |
| 132 | + ```bash |
| 133 | + cd packages/plugin-football |
| 134 | + pnpm install |
| 135 | + ``` |
| 136 | + |
| 137 | +3. Build the plugin: |
| 138 | + |
| 139 | + ```bash |
| 140 | + pnpm run build |
| 141 | + ``` |
| 142 | + |
| 143 | +4. Run linting: |
| 144 | + |
| 145 | + ```bash |
| 146 | + pnpm run lint |
| 147 | + ``` |
| 148 | + |
| 149 | +5. Test the plugin: |
| 150 | + |
| 151 | + ```bash |
| 152 | + pnpm vitest src/tests/match-action.test.ts |
| 153 | + pnpm vitest src/tests/fetch-standings-action.test.ts |
| 154 | + ``` |
| 155 | + |
| 156 | +## Dependencies |
| 157 | + |
| 158 | +This plugin relies on the following dependency: |
| 159 | + |
| 160 | +- `@elizaos/core: workspace:*` |
| 161 | + |
| 162 | +## Future Enhancements |
| 163 | + |
| 164 | +### Expanded Football Data Features |
| 165 | + |
| 166 | +- Player statistics |
| 167 | +- Match schedules and fixtures |
| 168 | +- Team information and histories |
| 169 | +- Historical match data |
| 170 | + |
| 171 | +### Advanced League Tracking |
| 172 | + |
| 173 | +- Real-time updates for all supported leagues |
| 174 | +- Integration with more competitions (e.g., Champions League, World Cup) |
| 175 | + |
| 176 | +### Customizable Output |
| 177 | + |
| 178 | +- Improved data formatting for conversational outputs |
| 179 | +- Support for additional localization options |
| 180 | + |
| 181 | +### Integration Improvements |
| 182 | + |
| 183 | +- Enhanced API error handling |
| 184 | +- Caching for frequently accessed data |
| 185 | +- Increased rate-limit compliance for the Football-Data.org API |
| 186 | + |
| 187 | +### Developer Tools |
| 188 | + |
| 189 | +- Sample applications for plugin usage |
| 190 | +- Test suites for advanced football scenarios |
| 191 | +- Examples for extending plugin functionality |
| 192 | + |
| 193 | +## Contributing |
| 194 | + |
| 195 | +Contributions are welcome! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) file for more information. |
| 196 | + |
| 197 | +## Credits |
| 198 | + |
| 199 | +This plugin integrates with and builds upon several key technologies: |
| 200 | + |
| 201 | +- [Football-Data.org](https://www.football-data.org/documentation/quickstart/) Official Football-Data platform API |
| 202 | + |
| 203 | +Special thanks to: |
| 204 | + |
| 205 | +- Special thanks to [Football-Data.org](https://www.football-data.org/) for providing the API that powers this plugin. |
| 206 | +- The Eliza Core development team. |
| 207 | +- The Eliza community for their contributions and feedback |
| 208 | + |
| 209 | +For more information about Football-Data integration capabilities: |
| 210 | + |
| 211 | +- [Football-Data API Documentation](https://www.football-data.org/documentation/quickstart) |
| 212 | +- [Football-Data Developer Portal](https://www.football-data.org/documentation/api) |
| 213 | + |
| 214 | +## License |
| 215 | + |
| 216 | +This plugin is part of the Eliza project. See the main project repository for license information. |
0 commit comments