Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/amineo/t2_server_query_elixir
Query a Tribes 2 server using Elixir!
https://github.com/amineo/t2_server_query_elixir
elixir tribes2 tribesnext udp
Last synced: about 2 months ago
JSON representation
Query a Tribes 2 server using Elixir!
- Host: GitHub
- URL: https://github.com/amineo/t2_server_query_elixir
- Owner: amineo
- License: mit
- Created: 2021-10-07T20:40:04.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-04-13T22:01:34.000Z (over 2 years ago)
- Last Synced: 2024-10-30T16:56:31.012Z (2 months ago)
- Topics: elixir, tribes2, tribesnext, udp
- Language: Elixir
- Homepage: https://hexdocs.pm/t2_server_query/
- Size: 26.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# T2ServerQuery
Querying a Tribes 2 server actually requires sending 2 different packets to the server where the first byte is denoting the type of information we're asking for. The first is called the `info` packet which doesnt contain much more then the server name. The second is called the `status` packet which contains all the meat and potatoes.
The `T2ServerQuery.query/3` function makes requests for both `info` and `status` and combines them into a single response for easy consumption.
## Installation
The package can be installed by adding `t2_server_query` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:t2_server_query, "~> 0.1.3"}
]
end
```## Usage
```elixir
# T2ServerQuery.query("35.239.88.241", port // 28_000, timeout // 3_500)
T2ServerQuery.query("35.239.88.241")
{:ok,
%T2ServerQuery.QueryResult{
bot_count: 0,
game_type: "Classic",
map_name: "Canker",
max_player_count: 64,
mission_type: "LakRabbit",
player_count: 0,
players: [%{}],
server_description: "Celebrating 20 Years of Tribes2! More information in Discord. playt2.com/discord",
server_name: "Discord PUB",
server_status: :online,
team_count: 1,
teams: [%{name: "Storm", score: 0}]
}}
```## Docs
The docs can be found at [https://hexdocs.pm/t2_server_query](https://hexdocs.pm/t2_server_query).Documentation has been generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm).