add containerfile, use accountdatastore
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
stryan 2022-08-07 14:57:09 -04:00
parent a8ea567352
commit 057c9f1d99
2 changed files with 27 additions and 1 deletions

13
Containerfile Normal file
View File

@ -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"]

15
main.go
View File

@ -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",