From 057c9f1d996a292cfe0012a97c67dcd2786ccbe3 Mon Sep 17 00:00:00 2001 From: Steve Date: Sun, 7 Aug 2022 14:57:09 -0400 Subject: [PATCH] add containerfile, use accountdatastore --- Containerfile | 13 +++++++++++++ main.go | 15 ++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 Containerfile diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..e566d6e --- /dev/null +++ b/Containerfile @@ -0,0 +1,13 @@ +FROM golang:1.18 as builder +WORKDIR /go/src/app +COPY . . +RUN apt update && apt upgrade -y +RUN go build + +FROM alpine:latest as final +WORKDIR /srv/ +RUN mkdir /srv/simpbot +RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2 +COPY --from=builder /go/src/app/simpbot /srv/simpbot/ + +CMD ["/srv/simpbot/simpbot"] diff --git a/main.go b/main.go index 5643aab..ab2d671 100644 --- a/main.go +++ b/main.go @@ -66,7 +66,20 @@ func main() { panic(err) } } - client.Store = NewLazyMemStore(Statefile) + dataFilter := &mautrix.Filter{ + AccountData: mautrix.FilterPart{ + Limit: 20, + NotTypes: []event.Type{ + event.NewEventType("simp.batch"), + }, + }, + } + store := mautrix.NewAccountDataStore("simp.batch", client) + _, err = client.CreateFilter(dataFilter) + if err != nil { + panic(err) + } + client.Store = store if Token == "" { login_res, err := client.Login(&mautrix.ReqLogin{ Type: "m.login.password",