Compare commits

..

10 commits

9 changed files with 70 additions and 14 deletions

View file

@ -11,6 +11,9 @@ matrix:
- GOOS: linux - GOOS: linux
GOARCH: arm64 GOARCH: arm64
depends_on:
- lint
steps: steps:
build: build:
secrets: secrets:

View file

@ -6,16 +6,32 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased] ## [Unreleased]
### Added
- Added `list` alias to `queue show`
- Added `delete` alias to `queue remove`
### Changed
- Changed table output style
## [v0.2.1] - 2023-06-11
### Changed
- when starting the app in daemon mode, the app will now wait one complete interval until it posts the next post
instead of immediately posting one bundle
## [v0.2.0] - 2023-06-11 ## [v0.2.0] - 2023-06-11
### Added ### Added
- cli option `queue show` to list currently queued bundles [#2](https://git.lauka.net/lauralani/humble-bot/issues/2) - Added cli option `queue show` to list currently queued bundles
- cli option `queue fill` to query humblebundle.com for new bundles and then fill the queue [#2](https://git.lauka.net/lauralani/humble-bot/issues/2) [#2](https://git.lauka.net/lauralani/humble-bot/issues/2)
- cli option `queue remove` to remove a queued up bundle [#2](https://git.lauka.net/lauralani/humble-bot/issues/2) - Added cli option `queue fill` to query humblebundle.com for new bundles and then fill the queue
[#2](https://git.lauka.net/lauralani/humble-bot/issues/2)
- Added cli option `queue remove` to remove a queued up bundle [#2](https://git.lauka.net/lauralani/humble-bot/issues/2)
### Fixed ### Fixed
- [[BUG] Error parsing mastodon response field time](https://git.lauka.net/lauralani/humble-bot/issues/1) - [[BUG] Error parsing mastodon response field time](https://git.lauka.net/lauralani/humble-bot/issues/1)
### Removed
- BREAKING: Removed action when executing `./humble-bot` without arguments, moved to `queue fill`
## [v0.1.2] - 2023-06-07 ## [v0.1.2] - 2023-06-07
### Added ### Added
- logging for new mastodon post now also logs the post url - logging for new mastodon post now also logs the post url
@ -47,7 +63,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[unreleased]: https://git.lauka.net/lauralani/humble-bot/compare/v0.2.0...HEAD [unreleased]: https://git.lauka.net/lauralani/humble-bot/compare/v0.2.1...HEAD
[v0.2.1]: https://git.lauka.net/lauralani/humble-bot/compare/v0.2.0...v0.2.1
[v0.2.0]: https://git.lauka.net/lauralani/humble-bot/compare/v0.1.2...v0.2.0 [v0.2.0]: https://git.lauka.net/lauralani/humble-bot/compare/v0.1.2...v0.2.0
[v0.1.2]: https://git.lauka.net/lauralani/humble-bot/compare/v0.1.1...v0.1.2 [v0.1.2]: https://git.lauka.net/lauralani/humble-bot/compare/v0.1.1...v0.1.2
[v0.1.1]: https://git.lauka.net/lauralani/humble-bot/compare/v0.1.0...v0.1.1 [v0.1.1]: https://git.lauka.net/lauralani/humble-bot/compare/v0.1.0...v0.1.1

30
Dockerfile Normal file
View file

@ -0,0 +1,30 @@
FROM golang:1.23-bullseye AS dev
COPY . /var/app
WORKDIR /var/app
ENV GO111MODULE="on" \
CGO_ENABLED=0 \
GOOS=linux
EXPOSE 80
ENTRYPOINT ["sh"]
FROM dev AS build
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --assume-yes ca-certificates make git
RUN go mod download && go mod verify
RUN make build
FROM gcr.io/distroless/static-debian12 AS prod
WORKDIR /app
COPY --from=build /var/app/bin/humble-bot /bin/
LABEL maintainer="Adora Laura Kalb <adora@lila.network>"
EXPOSE 8080
ENTRYPOINT ["/bin/humble-bot"]

View file

@ -1,15 +1,18 @@
# Humble Bundle Fediverse Bot # Humble Bundle Fediverse Bot
by https://chaos.social/@lauralani by https://social.lila.network/@lauralani
[![status-badge](https://ci.lauka.net/api/badges/4/status.svg)](https://ci.lauka.net/4) [![status-badge](https://ci.codeberg.org/api/badges/12433/status.svg)](https://ci.codeberg.org/repos/12433)
[![Please don't upload to GitHub](https://nogithub.codeberg.page/badge.svg)](https://nogithub.codeberg.page) [![Please don't upload to GitHub](https://nogithub.codeberg.page/badge.svg)](https://nogithub.codeberg.page)
## About ## About
This bot posts new Humble Bundles on the Fediverse so you can follow the bot and get the newest Bundles. This bot posts new Humble Bundles on the Fediverse so you can follow the bot and get the newest Bundles.
The Bot can be found at: TBD The Bot can be found at https://botsin.space/@humblebundles
Also see https://botwiki.org/bot/humble-bundle-bot/
## Changelog ## Changelog
You can find the changelog here: [CHANGELOG](CHANGELOG.md) You can find the changelog here: [CHANGELOG](CHANGELOG.md)
## License ## License
This Humble Bundle bot is available under the MIT license. See the [LICENSE](LICENSE) file for more info. This Humble Bundle bot is available under the MIT license. See the [LICENSE](LICENSE) file for more info.
The Humble Bundle Bot is in no way affiliated with Humble Bundle Inc.

View file

@ -25,6 +25,7 @@ func RunQueueShow(cmd *cobra.Command, args []string) {
} }
t := table.NewWriter() t := table.NewWriter()
t.SetStyle(table.StyleRounded)
t.SetOutputMirror(os.Stdout) t.SetOutputMirror(os.Stdout)
t.AppendHeader(table.Row{"ID", "Short Name", "URL"}) t.AppendHeader(table.Row{"ID", "Short Name", "URL"})

View file

@ -28,7 +28,7 @@ func StartCronJobs() {
return return
} }
_, err = s.Every(viper.GetString("mastodon.postinterval")).Do(RunSingleQueueItem) _, err = s.Every(viper.GetString("mastodon.postinterval")).WaitForSchedule().Do(RunSingleQueueItem)
if err != nil { if err != nil {
log.Error().Str("func", "StartCronJobs").Str("job", "RunSingleQueueItem"). log.Error().Str("func", "StartCronJobs").Str("job", "RunSingleQueueItem").
Msgf("Scheduler Error: %q", err) Msgf("Scheduler Error: %q", err)

View file

@ -17,6 +17,7 @@ var queueremoveCmd = &cobra.Command{
Run: app.RunQueueRemove, Run: app.RunQueueRemove,
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
Example: "humble-bot queue remove 25", Example: "humble-bot queue remove 25",
Aliases: []string{"delete"},
} }
func init() { func init() {

View file

@ -16,6 +16,7 @@ var queueshowCmd = &cobra.Command{
Short: "Show items in queue", Short: "Show items in queue",
Run: app.RunQueueShow, Run: app.RunQueueShow,
Args: cobra.ExactArgs(0), Args: cobra.ExactArgs(0),
Aliases: []string{"list"},
} }
func init() { func init() {

View file

@ -6,7 +6,7 @@
package constants package constants
var AppVersion = "0.2.0" var AppVersion = "0.2.1"
var HumbleCategories = []string{"games", "books", "software"} var HumbleCategories = []string{"games", "books", "software"}