From edf4900ea6035ce79b64eee8cdb60fe72c2868d1 Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Sat, 11 Apr 2020 13:51:10 -0400 Subject: [PATCH] initial commit --- .gitignore | 208 +++++++++++++++++++++++++++++++++++++++++++++ cmd/beebot/main.go | 13 +++ go.mod | 3 + gok.sh | 23 +++++ readme.adoc | 11 +++ 5 files changed, 258 insertions(+) create mode 100644 .gitignore create mode 100644 cmd/beebot/main.go create mode 100644 go.mod create mode 100755 gok.sh create mode 100644 readme.adoc diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3059bd6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,208 @@ + +# Created by https://www.gitignore.io/api/go,vim,linux,macos,windows,intellij+all +# Edit at https://www.gitignore.io/?templates=go,vim,linux,macos,windows,intellij+all + +### Go ### +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +# vendor/ + +### Go Patch ### +/vendor/ +/Godeps/ + +### Intellij+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Intellij+all Patch ### +# Ignores the whole .idea folder and all .iml files +# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 + +.idea/ + +# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 + +*.iml +modules.xml +.idea/misc.xml +*.ipr + +# Sonarlint plugin +.idea/sonarlint + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Vim ### +# Swap +[._]*.s[a-v][a-z] +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim +Sessionx.vim + +# Temporary +.netrwhist + +# Auto-generated tag files +tags + +# Persistent undo +[._]*.un~ + +# Coc configuration directory +.vim + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# End of https://www.gitignore.io/api/go,vim,linux,macos,windows,intellij+all +/beebot +/cmd/beebot/beebot +beebot.db diff --git a/cmd/beebot/main.go b/cmd/beebot/main.go new file mode 100644 index 0000000..9638172 --- /dev/null +++ b/cmd/beebot/main.go @@ -0,0 +1,13 @@ +package main + +import ( + "flag" + "log" +) + +const version = 1.0 + +func main() { + flag.Parse() + log.Printf("BeeBot v%.2f", version) +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..5a56760 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module code.chrissexton.org/cws/BeeBot + +go 1.13 diff --git a/gok.sh b/gok.sh new file mode 100755 index 0000000..50b19d6 --- /dev/null +++ b/gok.sh @@ -0,0 +1,23 @@ +#!/bin/sh +o=$(mktemp tmp.XXXXXXXXXX) + +fail() { + echo Failed + cat $o | grep -v deprecated + rm $o + exit 1 +} + +trap fail INT TERM + +echo gofmt +gofmt -l $(find . -name '*.go') > $o 2>&1 +test $(wc -l $o | awk '{ print $1 }') = "0" || fail + +echo govet +go vet ./... > $o 2>&1 || fail + +echo go test +go test -test.timeout=60s ./... > $o 2>&1 || fail + +rm $o diff --git a/readme.adoc b/readme.adoc new file mode 100644 index 0000000..12c5ad3 --- /dev/null +++ b/readme.adoc @@ -0,0 +1,11 @@ += BeeBot + +A bot to manage automatic posts and other moderation needs of https://reddit.com/r/mead[r/mead]. + +== Usage + +Build and run `cmd/beebot`. + +== Is it good? + +It is good enough. \ No newline at end of file