Compare commits

..

3 Commits

Author SHA1 Message Date
Matthew Faltys 3c42bfdf54 Add fortune db's 5 years ago
Matthew Faltys fb50bfa5d8 Update fortune command 5 years ago
Matthew Faltys 616c058806 Update dockerfile to be based off of alpine 5 years ago
  1. 4
      Makefile
  2. 16
      deps/Dockerfile
  3. 1485
      deps/fortune/fortunes
  4. 1365
      deps/fortune/kenm
  5. 38122
      deps/fortune/showerthoughts
  6. 40
      lorebot/lorebot.go

4
Makefile

@ -7,6 +7,9 @@ all: lorebot
depends:
go get github.com/nlopes/slack
go get github.com/unixvoid/glogger
go get gopkg.in/gcfg.v1
go get gopkg.in/redis.v5
lorebot:
$(GOC) lorebot/lorebot.go
@ -28,6 +31,7 @@ docker: stat
cp deps/redis.conf stage.tmp/
chmod +x deps/run.sh
cp deps/run.sh stage.tmp/
cp -R deps/fortune stage.tmp/
cp config.gcfg stage.tmp/
cd stage.tmp/ && \
sudo docker build -t $(IMAGE_NAME) .

16
deps/Dockerfile vendored

@ -1,11 +1,19 @@
FROM scratch
FROM alpine
#RUN apk --update add ca-certificates redis
#RUN mkdir /redisbackup/
ADD rootfs.tar.gz /
RUN apk --update add ca-certificates redis fortune
RUN mkdir /redisbackup/
RUN rm -rf /usr/share/fortune
COPY fortune/ /usr/share/fortune
WORKDIR /usr/share/fortune/
RUN strfile -c % fortunes fortunes.dat
RUN strfile -c % kenm kenm.dat
RUN strfile -c % showerthoughts showerthoughts.dat
#ADD rootfs.tar.gz /
COPY redis.conf /
COPY config.gcfg /
COPY lorebot /
COPY run.sh /
WORKDIR /
CMD ["/run.sh"]

1485
deps/fortune/fortunes vendored

File diff suppressed because it is too large Load Diff

1365
deps/fortune/kenm vendored

File diff suppressed because it is too large Load Diff

38122
deps/fortune/showerthoughts vendored

File diff suppressed because it is too large Load Diff

40
lorebot/lorebot.go

@ -10,6 +10,7 @@ import (
"net/http"
"net/textproto"
"os"
"os/exec"
"strconv"
"strings"
"time"
@ -238,6 +239,12 @@ func staticCommandHandler(rtm *slack.RTM, ev *slack.MessageEvent, redisClient *r
dicerollhandler(rtm, ev)
case "ceelo":
ceelorollhandler(rtm, ev)
case "fortune":
fortunehandler(rtm, ev)
case "kenm":
kenmhandler(rtm, ev)
case "showerthoughts":
showerthoughtshandler(rtm, ev)
case "listen":
rtm.SendMessage(rtm.NewOutgoingMessage("*it's what you hearin*", ev.Channel))
case "lorelist":
@ -375,6 +382,39 @@ func ceelorollhandler(rtm *slack.RTM, ev *slack.MessageEvent) {
}
}
func fortunehandler(rtm *slack.RTM, ev *slack.MessageEvent) {
fortune, err := exec.Command("fortune", "-e", "fortunes").CombinedOutput()
if err != nil {
fmt.Printf("%v\n", err)
rtm.SendMessage(rtm.NewOutgoingMessage("Fortune command is broken, contact HFIC", ev.Channel))
return
}
rtm.SendMessage(rtm.NewOutgoingMessage(fmt.Sprintf("%s", fortune), ev.Channel))
}
func kenmhandler(rtm *slack.RTM, ev *slack.MessageEvent) {
fortune, err := exec.Command("fortune", "-e", "kenm").CombinedOutput()
if err != nil {
fmt.Printf("%v\n", err)
rtm.SendMessage(rtm.NewOutgoingMessage("kenm command is broken, contact HFIC", ev.Channel))
return
}
rtm.SendMessage(rtm.NewOutgoingMessage(fmt.Sprintf("%s", fortune), ev.Channel))
}
func showerthoughtshandler(rtm *slack.RTM, ev *slack.MessageEvent) {
fortune, err := exec.Command("fortune", "-e", "showerthoughts").CombinedOutput()
if err != nil {
fmt.Printf("%v\n", err)
rtm.SendMessage(rtm.NewOutgoingMessage("showerthoughts command is broken, contact HFIC", ev.Channel))
return
}
rtm.SendMessage(rtm.NewOutgoingMessage(fmt.Sprintf("%s", fortune), ev.Channel))
}
func rrhandler(rtm *slack.RTM, ev *slack.MessageEvent) {
//fmt.Print(rand.Intn(100))
dice := []string{"*click*", "*BANG*", "*click*", "*click*", "*click*", "*click*"}

Loading…
Cancel
Save