Dont handle messages from self

This commit is contained in:
an 2017-07-02 00:50:47 +02:00
parent 0a0a10ed29
commit 99ffde1c7f
3 changed files with 18 additions and 15 deletions

View File

@ -1,4 +1,4 @@
FROM ubuntu:15.10 FROM ubuntu:16.04
MAINTAINER Andreas Neue <an@dnix.de> MAINTAINER Andreas Neue <an@dnix.de>
RUN apt-get -y --force-yes update RUN apt-get -y --force-yes update
@ -7,14 +7,14 @@ RUN apt-get install -y ca-certificates
RUN apt-get install -y fortune vim RUN apt-get install -y fortune vim
RUN apt-get clean RUN apt-get clean
RUN mkdir /flokatirc RUN mkdir /mmflokati
COPY flokatirc /flokatirc/flokatirc COPY mmflokati /mmflokati/mmflokati
COPY newsfeeds.conf /flokatirc/newsfeeds.conf #COPY newsfeeds.conf /mmflokati/newsfeeds.conf
COPY fortunes /flokatirc/fortunes #COPY fortunes /mmflokati/fortunes
ENV PATH $PATH:/flokatirc ENV PATH $PATH:/mmflokati
WORKDIR /flokatirc WORKDIR /mmflokati
CMD [ "/flokatirc/flokatirc", "-server=irc.dnix.de:6667", "-name=Flokati", "-chan=#test", "-nsname=N", "-nspass=t0ps3cr37" ] #CMD [ "/mmflokati/mmflokati", "-server=irc.dnix.de:6667", "-name=Flokati", "-chan=#test", "-nsname=N", "-nspass=t0ps3cr37" ]

View File

@ -9,15 +9,15 @@ build: genversion genbuilddate test
build-win: test genversion build-win: test genversion
GOOS=windows GOARCH=amd64 go build -v -o mmflokati.exe mmflokati GOOS=windows GOARCH=amd64 go build -v -o mmflokati.exe mmflokati
docker: build
./dockerbuild.sh
genversion: genversion:
./genversion.sh ./genversion.sh
genbuilddate: genbuilddate:
./genbuilddate.sh ./genbuilddate.sh
docker: build
./dockerbuild.sh
fmt: fmt:
go fmt ./... go fmt ./...

11
main.go
View File

@ -1,8 +1,8 @@
// vi:ts=4:sts=4:sw=4:noet:tw=72 // vi:ts=4:sts=4:sw=4:noet:tw=72
// //
// flokatirc // mmflokati
// //
// Copyright (c) 2015,2016 Andreas Neue <an@dnix.de> // Copyright (c) 2015,2016,2017 Andreas Neue <an@dnix.de>
package main package main
@ -47,7 +47,7 @@ func main() {
xlog.Info("Connecting ...") xlog.Info("Connecting ...")
bot := matterclient.New(*name, *pass, *team, *server) bot := matterclient.New(*name, *pass, *team, *server)
bot.SetLogLevel("debug") //bot.SetLogLevel("debug")
err := bot.Login() err := bot.Login()
if err != nil { if err != nil {
xlog.Error(err.Error()) xlog.Error(err.Error())
@ -84,7 +84,10 @@ func main() {
go func() { go func() {
for { for {
mm := <-bot.MessageChan mm := <-bot.MessageChan
xlog.Debug("got msg: %v %v :: %v", mm.Username, mm.Channel, mm.Text) if mm.Username == *name {
continue
}
xlog.Debug("Got msg: User: %v, Channel: %v, Text: \"%v\"", mm.Username, mm.Channel, mm.Text)
modules.HandleMessage(&modules.Message{From: mm.Username, Channel: mm.Channel, Text: mm.Text}) modules.HandleMessage(&modules.Message{From: mm.Username, Channel: mm.Channel, Text: mm.Text})
} }
}() }()