From 52f154d188ad4280e27f764e2031030d9f14350c Mon Sep 17 00:00:00 2001 From: Marcus Talken Date: Sat, 7 Nov 2020 07:30:00 +0000 Subject: [PATCH 1/4] Update changelog --- CHANGELOG.md | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45e8b61..0093502 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,29 +1,41 @@ -# Change Log +# Changelog +All notable changes to this project will be documented in this file. -## v0.2.8 -### Changes +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). + + +## [Unreleased] +### Added +### Changed +### Deprecated +### Removed +### Fixed +### Security + + +## [0.2.9] - 2020-11-07 +### Added - Added github actions to build artifacts. -## v0.2.2 -### Bugs +## [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 From fe45419986515a965b1637a7dd01ea3bdef666df Mon Sep 17 00:00:00 2001 From: Marcus Talken Date: Sat, 7 Nov 2020 08:06:58 +0000 Subject: [PATCH 2/4] Update changelog --- .github/workflows/release.yml | 12 ++++++++---- CHANGELOG.md | 4 ++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d76b922..25a7fb3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,6 +11,10 @@ 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 @@ -26,11 +30,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 0093502..72cd3fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Security +## [0.2.10] - 2020-11-07 +### Added +- Added github actions to build artifacts. + ## [0.2.9] - 2020-11-07 ### Added - Added github actions to build artifacts. From 9c9398d5d6f3082954099f6803011b47c35378b3 Mon Sep 17 00:00:00 2001 From: Marcus Talken Date: Sat, 7 Nov 2020 09:19:00 +0000 Subject: [PATCH 3/4] test --- .github/workflows/release.yml | 1 - CHANGELOG.md | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 25a7fb3..4ceda12 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,7 +21,6 @@ jobs: 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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 72cd3fd..d685e15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Security +## [0.2.12] - 2020-11-07 +### Added +- smoke + ## [0.2.10] - 2020-11-07 ### Added - Added github actions to build artifacts. From 83cfd21e9a356c562b5eb6779b698b3c54eaf59b Mon Sep 17 00:00:00 2001 From: Marcus Talken Date: Sat, 14 Nov 2020 09:29:12 +0000 Subject: [PATCH 4/4] Bot should no longer panic when player disconnects from mumble --- CHANGELOG.md | 17 ++++++++--------- mumble/mumble.go | 25 +++++++++++++++---------- socket/socket.go | 6 ++++++ 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d685e15..629ad80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added +- game names are now checked case insensitive +- if no comment set, use mumble name + ### Changed ### Deprecated ### Removed @@ -14,17 +17,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Security -## [0.2.12] - 2020-11-07 -### Added -- smoke - -## [0.2.10] - 2020-11-07 +## [0.3.0] ### Added -- Added github actions to build artifacts. +- Notifications im mumble if in game player name and mumble user name don't match. -## [0.2.9] - 2020-11-07 -### Added -- Added github actions to build artifacts. +### 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 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 {