abourget / slick Goto Github PK
View Code? Open in Web Editor NEWSlick, a Slack bot in Go
Slick, a Slack bot in Go
I've been running into a rather strange issue with a bot written in slick. After having an instance running for a while and restarting it (for whatever reason), I can no longer connect to slack. All I see is "Database closed". Resetting any possible changes and deleting all temporary files doesn't seem to have an effect.
Interestingly enough I can connect again when doing so through a new bot account. Simply regenerating the token on the old one does not work. But that's hardly a solution or even a workaround, as this happened again and again for me.
I spent some time with the very helpful Slack support trying to debug this issue, with them going through the server logs but failing to find any problems. I tried my best at debugging the issue, but also couldn't find a cause or something pointing to one.
Should anyone run into a similar issue or have some helpful input on this, I'd love to hear it. For now I had to migrate to using hubot, which does not experience this issue.
Upstream issue: https://github.com/nlopes/slack/issues/109
The field is removed in this commit: nlopes/slack@f1b061d
I have a bot that has a few very simple responses. I tried doing the following to register multiple listeners on the bot calling initSimple
from within a InitPlugin
func and passing it the reference to the bot.
var simpleResponses = map[string]string {
"listenfor1": "response1",
"listenfor2": "response2",
}
func initSimple(bot *slick.Bot) {
for listen, response := range simpleResponses {
bot.Listen(&slick.Listener{
Contains: listen,
MessageHandlerFunc: func(l *slick.Listener, m *slick.Message) {
m.Reply(response)
},
})
}
}
The problem is that every "query" into simpleResponses returns the response from the last response, e.g. "response2" in this case. I've also tried generating a listener for every case and handing them to the bot one for one, but that leads to the same result.
Any help on how to achieve this would be much appreciated ๐
go get github.com/abourget/slick
# github.com/abourget/slick
Documents/code/go/src/github.com/abourget/slick/reaction.go:111: cannot use ev.Item.Item.File (type *slack.File) as type string in assignment
Documents/code/go/src/github.com/abourget/slick/reaction.go:112: ev.Item.FileComment undefined (type slack.ReactedItem has no field or method FileComment)
Documents/code/go/src/github.com/abourget/slick/reaction.go:114: cannot use ev.EventTimestamp (type slack.JSONTimeString) as type string in assignment
Documents/code/go/src/github.com/abourget/slick/reaction.go:120: cannot use ev.Item (type slack.ReactedItem) as type struct { Type string "json:\"type\""; Channel string "json:\"channel,omitempty\""; File string "json:\"file,omitempty\""; FileComment string "json:\"file_comment,omitempty\""; Timestamp string "json:\"ts,omitempty\"" } in assignment
Documents/code/go/src/github.com/abourget/slick/reaction.go:123: cannot use ev.Item.Item.File (type *slack.File) as type string in assignment
Documents/code/go/src/github.com/abourget/slick/reaction.go:124: ev.Item.FileComment undefined (type slack.ReactedItem has no field or method FileComment)
Documents/code/go/src/github.com/abourget/slick/reaction.go:126: cannot use ev.EventTimestamp (type slack.JSONTimeString) as type string in assignment
Hey @abourget,
I had sent you an email about taking over maintainership for Slick. The code currently in this repository is:
I would like to solve both. I, and several others, have already made changes to get the repository in a working state and to improve code coverage. You can view those here: CapstoneLabs/slick
Even if you don't issue a redirect from this repository I will go on running my fork, that said, you've expressed no license here. Do you have any acceptable licenses in mind?
Hi, I just wanted to highlight that this file is missing :) Also, when I take plotbot.sample.conf , I have:
./example-bot
2018/04/19 14:58:07 LoadConfig(): Error unmarshaling JSON invalid character '"' after object key:value pair
2018/04/19 14:58:07 Error loading Slack config section: invalid character '"' after object key:value pair
!todo add something to do www.domain.com
becomes
@handle added: ID something to do <www.domain.com>
so the link is not clickable anymore
I often run into Event: *slack.OutgoingErrorEvent
when my bot tries to post something to Slack ๐
I'm unsure as to why this is happening or what I could do to fix it. The same exact query/bot message works some of the time and results in this error at other times.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.