diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d76b922..4ceda12 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,13 +11,16 @@ jobs: name: Create Release runs-on: ubuntu-latest steps: + - name: Get version from tag + id: tag_name + run: | + echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v} - name: Checkout code uses: actions/checkout@v2 - name: Get Changelog Entry id: changelog_reader uses: mindsers/changelog-reader-action@v2 with: - validation_depth: 10 version: ${{ steps.tag_name.outputs.current_version }} path: ./CHANGELOG.md - name: Create Release @@ -26,11 +29,11 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} + tag_name: ${{ steps.changelog_reader.outputs.version }} + release_name: Release ${{ steps.changelog_reader.outputs.version }} body: ${{ steps.changelog_reader.outputs.changes }} - draft: false - prerelease: false + prerelease: ${{ steps.changelog_reader.outputs.status == 'prereleased' }} + draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }} - name: Set up Go 1.x uses: actions/setup-go@v2 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 45e8b61..629ad80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,29 +1,48 @@ -# Change Log +# Changelog +All notable changes to this project will be documented in this file. -## v0.2.8 -### Changes -- Added github actions to build artifacts. +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## v0.2.2 -### Bugs + +## [Unreleased] +### Added +- game names are now checked case insensitive +- if no comment set, use mumble name + +### Changed +### Deprecated +### Removed +### Fixed +### Security + + +## [0.3.0] +### Added +- Notifications im mumble if in game player name and mumble user name don't match. + +### Fixed +- Player leaving mumble no longer causes the bot to go into a panic. +- A player leaving or disconnecting from the game no longer causes the bot to do an update. + +## [0.2.2] +### Fixed - Fixed moving player to dead when voted out for real this time. - New Nil pointer dereference bug fixed. - -## v0.2.1 -### Bugs +## [0.2.1] +### Fixed - Players always get moved to the dead channel when voted out. - Nil pointer dereference bug fixed. - Fixed certificate commands in README. - -## v0.2.0 -### Changes -- Updated README to include setup instructions. - -### New Features +## [0.2.0] +### Added - Allow passing botname, cert, key, server as parameters from config file. +### Changed +- Updated README to include setup instructions. -## v0.1.0 -- Initial Release +## [0.1.0] +### Added +- Initial Release \ No newline at end of file diff --git a/mumble/mumble.go b/mumble/mumble.go index 03f87cd..94c8a59 100644 --- a/mumble/mumble.go +++ b/mumble/mumble.go @@ -72,11 +72,13 @@ func Meeting(c *gumble.Client, deadplayers []string) { for _, deadplayer := range deadplayers { user := c.Users.Find(deadplayer) - log.Println("Mute player", user.Name) - user.SetMuted(true) - user.SetDeafened(false) - user.Move(alive) - log.Println(user.Name, "is dead") + if user != nil { + log.Println("Mute player", user.Name) + user.SetMuted(true) + user.SetDeafened(false) + user.Move(alive) + log.Println(user.Name, "is dead") + } } } @@ -98,11 +100,13 @@ func Resumegame(c *gumble.Client, deadplayers []string) { for _, deadplayer := range deadplayers { user := c.Users.Find(deadplayer) - log.Println("Unmute player", user.Name) - user.SetMuted(false) - user.SetDeafened(false) - user.Move(dead) - log.Println(user.Name, "is dead") + if user != nil { + log.Println("Unmute player", user.Name) + user.SetMuted(false) + user.SetDeafened(false) + user.Move(dead) + log.Println(user.Name, "is dead") + } } } @@ -145,6 +149,7 @@ func Namecheck(c *gumble.Client, player string) { return } } + lobby.Send("Player "+player+" does not have a mumble user set.", true) log.Println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") log.Println("Player", player, "does not have a mumble user set.") log.Println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") diff --git a/socket/socket.go b/socket/socket.go index 7c7fa1c..70f05e1 100644 --- a/socket/socket.go +++ b/socket/socket.go @@ -14,6 +14,7 @@ import ( type player struct { Name string `json:"Name"` + Action int `json:"Action"` Color int `json:"Color"` IsDead bool `json:"IsDead"` Disconnected bool `json:"Disconnected"` @@ -85,6 +86,11 @@ func SocketioServer(client *gumble.Client, listenaddress string, listenport stri player := player{} _ = json.Unmarshal([]byte(msg), &player) + if player.Action == 1 || player.Action == 5 { + log.Println(player, "left the game.") + return + } + if gamestate == "LOBBY" { mumble.Namecheck(client, strings.TrimSpace(player.Name)) } else {