-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor code and improve changes detection
Add github actions for lint, publish, and release Update README Add documentation
- Loading branch information
Showing
213 changed files
with
1,028 additions
and
262,168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,4 @@ README.md | |
LICENSE | ||
web-watcher | ||
db.sqlite | ||
vendor | ||
dist/ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: lint | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Set up Go 1.14 | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.14 | ||
id: go | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build | ||
run: go build -v . | ||
|
||
- name: golangci-lint | ||
uses: actions-contrib/golangci-lint@v1 | ||
env: | ||
GOROOT: "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: github pages | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
working-directory: www | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
fetch-depth: 0 | ||
|
||
- name: Setup Hugo | ||
uses: peaceiris/actions-hugo@v2 | ||
with: | ||
hugo-version: 'latest' | ||
|
||
- name: Build | ||
run: hugo --minify | ||
|
||
- name: Deploy | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./www/public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
- | ||
name: Unshallow | ||
run: git fetch --prune --unshallow | ||
- | ||
name: Set up Go | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.14.x | ||
- | ||
name: Docker login | ||
uses: azure/docker-login@v1 | ||
with: | ||
login-server: docker.pkg.github.com | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- | ||
name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v1 | ||
with: | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "www/themes/hugo-apex-theme"] | ||
path = www/themes/hugo-apex-theme | ||
url = https://github.com/caarlos0/hugo-apex-theme.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
before: | ||
hooks: | ||
- go mod download | ||
archives: | ||
- replacements: | ||
darwin: Darwin | ||
linux: Linux | ||
windows: Windows | ||
386: i386 | ||
amd64: x86_64 | ||
checksum: | ||
name_template: 'checksums.txt' | ||
snapshot: | ||
name_template: "{{ .Tag }}-next" | ||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' | ||
|
||
release: | ||
github: | ||
owner: shellbear | ||
name: web-watcher | ||
|
||
dockers: | ||
- | ||
binaries: | ||
- web-watcher | ||
dockerfile: Dockerfile.cgo | ||
image_templates: | ||
- "docker.pkg.github.com/shellbear/web-watcher/web-watcher:{{ .Tag }}" | ||
- "docker.pkg.github.com/shellbear/web-watcher/web-watcher:latest" | ||
build_flag_templates: | ||
- "--pull" | ||
- "--label=org.opencontainers.image.created={{.Date}}" | ||
- "--label=org.opencontainers.image.name={{.ProjectName}}" | ||
- "--label=org.opencontainers.image.revision={{.FullCommit}}" | ||
- "--label=org.opencontainers.image.version={{.Version}}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM golang:latest | ||
|
||
COPY web-watcher / | ||
|
||
ENTRYPOINT ["/web-watcher"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,77 @@ | ||
# Web-watcher | ||
|
||
A small discord bot which aims to monitor and send notifications on website changes. | ||
|
||
## Installation | ||
|
||
If you want to self host this bot, you have to first create a new Discord application and bot from the [developer portal](https://discordapp.com/developers/applications/). | ||
You can follow this [tutorial](https://github.com/reactiflux/discord-irc/wiki/Creating-a-discord-bot-&-getting-a-token) to achieve this step. | ||
|
||
With go CLI: | ||
```bash | ||
go get github.com/ShellBear/web-watcher | ||
``` | ||
<p align="center"> | ||
<img alt="Gopher" src=".github/images/gopher.png" height="140" /> | ||
<h3 align="center">web-watcher</h3> | ||
<p align="center">A small Discord bot which aims to alert you on website changes.</p> | ||
</p> | ||
|
||
<p align="center"> | ||
<a href="https://goreportcard.com/report/github.com/shellbear/web-watcher" alt="Go Report Card"> | ||
<img src="https://goreportcard.com/badge/github.com/shellbear/web-watcher" /> | ||
</a> | ||
<a href="https://github.com/shellbear/web-watcher/actions?query=workflow%3Alint" alt="Pipeline status"> | ||
<img src="https://github.com/shellbear/web-watcher/workflows/lint/badge.svg" /> | ||
</a> | ||
<a href="https://github.com/shellbear/web-watcher/actions?query=workflow%3A%22github+pages%22" alt="Pipeline status"> | ||
<img src="https://github.com/shellbear/web-watcher/workflows/github%20pages/badge.svg" /> | ||
</a> | ||
<img src="https://img.shields.io/github/go-mod/go-version/shellbear/web-watcher" alt="Go version" /> | ||
<a href="https://opensource.org/licenses/MIT" alt="Go version"> | ||
<img src="https://img.shields.io/badge/license-MIT-brightgreen.svg" /> | ||
</a> | ||
</p> | ||
|
||
--- | ||
|
||
## Documentation | ||
|
||
A full documentation is available at [https://shellbear.github.io/web-watcher](https://shellbear.github.io/web-watcher). | ||
|
||
## Usage | ||
|
||
```bash | ||
export DISCORD_TOKEN=YOUR_DISCORD_TOKEN | ||
web-watcher | ||
|
||
# or | ||
|
||
web-watcher --token YOUR_DISCORD_TOKEN | ||
``` | ||
|
||
```bash | ||
web-watcher --help | ||
|
||
> web-watcher --help | ||
Web-watcher discord Bot. | ||
|
||
Options: | ||
-delay int | ||
Watch delay in minutes (default 60) | ||
-prefix string | ||
The discord commands prefix (default "!") | ||
-ratio float | ||
Changes detection ratio (default 1) | ||
-token string | ||
Discord token | ||
``` | ||
|
||
By default the watch interval for every website is 1 Hour but you can easily change this with the `delay` parameter followed by the time interval in minutes. | ||
By default, the watch interval for every website is 1 hour, but you can easily change this with the `interval` parameter | ||
followed by the interval in minutes. | ||
|
||
```bash | ||
# Set watch interval to 10 minutes | ||
web-watcher --token YOUR_DISCORD_TOKEN --delay 10 | ||
web-watcher --token YOUR_DISCORD_TOKEN --interval 10 | ||
``` | ||
|
||
## Commands | ||
## Discord commands | ||
|
||
#### !watch [URL] | ||
|
||
Add an URL to the watchlist. | ||
Add a URL to the watchlist. | ||
|
||
#### !unwatch [URL] | ||
|
||
Remove an URL from the watchlist. | ||
Remove a URL from the watchlist. | ||
|
||
#### !watchlist | ||
|
||
Get the complete watchlist. | ||
|
||
## Deploy | ||
|
||
With docker: | ||
```bash | ||
docker build -t web-watcher . | ||
``` | ||
|
||
And test: | ||
```bash | ||
docker run -e DISCORD_TOKEN=YOUR_DISCORD_TOKEN web-watcher | ||
``` | ||
|
||
## Built With | ||
|
||
- [go-difflib](https://github.com/pmezard/go-difflib) - Partial port of Python difflib package to Go | ||
- [xxhash](https://github.com/cespare/xxhash) - Go implementation of the 64-bit xxHash algorithm (XXH64) | ||
- [Gorm](https://github.com/jinzhu/gorm) - The fantastic ORM library for Golang | ||
- [DiscordGo](https://github.com/bwmarrin/discordgo) - Go bindings for Discord | ||
|
||
## License | ||
|
||
This project is licensed under the MIT License - see the [LICENSE](LICENSE.md) file for details | ||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details |
Oops, something went wrong.