An open API service indexing awesome lists of open source software.

https://github.com/amineo/discord-battlebot

An extensible Discord game server query and topic monitoring bot.
https://github.com/amineo/discord-battlebot

battlebot discord discord-bot elixir tribes tribes2

Last synced: about 1 year ago
JSON representation

An extensible Discord game server query and topic monitoring bot.

Awesome Lists containing this project

README

          


BattleBot

BattleBot v2



An extensible Discord game server query and monitoring bot.




Add to Discord




Feature Request

Report Bug

Legacy: BattleBot v1 (Node)


You can see BattleBot in action on the Tribes 2 Discord.


Table of Contents



  1. About This Project


  2. Supported Games

  3. Roadmap


  4. Contributing


  5. Acknowledgments

  6. License


---


## About This Project

BattleBot [v1](https://github.com/amineo/discord-battlebot/tree/v1-node) was initially written in Node around Fall 2017
for the [Tribes 2 Discord](https://discord.gg/Y4muNvF) community, allowing users to query Tribes 2 servers in real-time.

As BattleBot's feature set grew (*some being experimental*), so did its complexity. With BattleBot evolving, therein lies the
opportunity to learn more Elixir and completely rewrite BattleBot, and its [Tribes 2 server query engine](https://github.com/amineo/t2_server_query_elixir).
Previously, the query engine was using [qstat](https://github.com/Unity-Technologies/qstat).
BattleBot's core is now even more modular, including the ability to handle more games, with Tribes 2 being the first.

### Features
#### Application (Slash) Commands

| Slash Command | Description |
| :--- | :---- |
| `/query t2` | Query options: `server`, `ip`, `format`. If a server or IP option is not selected, BattleBot will query all servers configured in [config/t2_servers.exs](config/t2_servers.exs) and output the results in an embedded list. |
| | `> server` : Select from a list of predefined servers |
| | `> ip` : Manually enter a server's IP:PORT to be queried |
| | `> format` : Output options: `image` *(default)*, `raw` |
| `/events` | List server events |
| `/info` | Info about BattleBot |

#### Ephemeral Message Responses
By default, any response BattleBot yields with will automatically be deleted after 5 minutes have passed. This keeps the chat and query outputs tidy. :)

The default message timeout is configurable in [config/config.exs](config/config.exs). This will eventually be an option you can pass into any `/query` command to set a custom timeout.

#### Server Topic Monitoring
`Coming soon! On the roadmap.`

(back to top)

### Built With
- [Elixir](https://elixir-lang.org/)
- [Nostrum](https://github.com/Kraigie/nostrum)
- T2ServerQuery: [Repo](https://github.com/amineo/t2_server_query_elixir) • [Docs](https://hexdocs.pm/t2_server_query)
- [t2-server-image](https://github.com/exogen/t2-server-xbar/tree/main/packages/t2-server-image)

(back to top)

## Supported Games
- Tribes 2
- *Suggest your favorite title :)*

(back to top)

## Roadmap

- [x] Slash commands
- [x] Tribes 2 Server and list queries
- [ ] Custom message timeout option for slash commands
- [ ] Topic Monitoring :: Monitor game server populations and update Discord channel topics

(back to top)

## Contributing
Any contributions you make are **greatly appreciated**. If you have a suggestion that would make this better, please fork the repo and create a pull request. I'd love to learn from you!

You can also simply open an issue with the tag "enhancement". **Don't forget to give the project a star!** :)

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/NewFeature`)
3. Setup any applicable tests for your module or feature in `./test/*.exs`
4. Commit your Changes (`git commit -m 'feat(new): Command to query '`)
5. Push to the Branch (`git push origin feature/NewFeature`)
6. Open a Pull Request

### Testing, Formatting and Styling
Please run `credo` and `dialyzer` static code analysis on any contributions you make so that we can keep the codebase consistent.

- `mix credo` : Static Code Analysis
- `mix dialyzer` : Static Code Analysis
- `mix test` : Test runner
- `mix format` : Code formatting

### Getting Started
Run BattleBot:
```
iex -S mix
```

#### Prerequisites
- Install Elixir & Erlang : [Guide with ASDF version manager](https://www.pluralsight.com/guides/installing-elixir-erlang-with-asdf)
- The project's Elixir & Erlang versions are found here in: [./elixir_buildpack.config](./elixir_buildpack.config)
- **Not required but recommended**: For VSCode, [ElixirLS: Elixir support and debugger](https://marketplace.visualstudio.com/items?itemName=JakeBecker.elixir-ls)
- **Required Environment Variables**
- `DISCORD_BOT_TOKEN` : Your secret bot token. ([Create a new bot application](https://discord.com/developers/applications))
- `TEST_GUILD_ID` : Your **dev channel** for testing slash commands
- ~ **TIP:** Using [direnv](https://direnv.net/) can make your life easier for auto loading envs/secrets for a project

#### Installation
```
mix deps.get
```

(back to top)

## Acknowledgments
- @exogen: [t2-server-image](https://github.com/exogen/t2-server-xbar/tree/main/packages/t2-server-image)
- @ChocoTaco1: [https://github.com/ChocoTaco1/TacoServer](https://github.com/ChocoTaco1/TacoServer), BattleBot Logo
- The Tribes 2 Community
- T2ServerQuery: [Repo](https://github.com/amineo/t2_server_query_elixir) • [Docs](https://hexdocs.pm/t2_server_query)
- [Nostrum](https://github.com/Kraigie/nostrum)

(back to top)

## License
[MIT](LICENSE.txt)

(back to top)