add containerfile, use accountdatastore
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
a8ea567352
commit
057c9f1d99
13
Containerfile
Normal file
13
Containerfile
Normal 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
15
main.go
@ -66,7 +66,20 @@ func main() {
|
|||||||
panic(err)
|
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 == "" {
|
if Token == "" {
|
||||||
login_res, err := client.Login(&mautrix.ReqLogin{
|
login_res, err := client.Login(&mautrix.ReqLogin{
|
||||||
Type: "m.login.password",
|
Type: "m.login.password",
|
||||||
|
Loading…
Reference in New Issue
Block a user