Comments (4)
There's no generic support for callbacks yet, and currently none planned, but you could write a Go plugin for this. When gopherbot starts the connector or does a reload, it calls each plugin with the command "init". In the processing for init, you'd check to see if your http listener is already running (in the case of a reload), and then fire off a goroutine with the bot object that would create a listener.
from gopherbot.
i created listener on main.go like this:
go func() {
http.Handle("/metrics", handler)
http.ListenAndServe(":8080", nil)
}()
İs this a bad practice ? Should i really need a plugin for this?
from gopherbot.
I don't have any problem with this, if it works for you. The main reason to do it in a plugin would be getting the robot object from init, and storing it so you could later use one of the "Send*Message" methods, and also to store stuff in the brain, etc. If you're just adding the listener in main, how is your handler interacting with the robot?
from gopherbot.
I understand what you mean but i don't interact with bot directly. So it works for me this way. Thanks for reply.
from gopherbot.
Related Issues (20)
- Add API call for deleting long-term memories
- Create bot.Threaded() methods
- Allowing anchoring in ambient message regexes HOT 1
- Update python objects for ruby parity
- Add i(gnore) command to help/ping HOT 1
- Slack connector sends message deletions to robot HOT 1
- Update catch-all help for threads
- Run init jobs with new environment variables
- Deleting a preview from a message makes the robot re-process the message
- Allow short-term memory contexts to be shared (remove the 'user') HOT 1
- Unlisted users are being ignored in threads / AI plugin HOT 1
- Require administrators to be listed in UserRoster
- Feature: Subscribe API HOT 2
- Feature: GOPHER_ADDRMODE HOT 1
- Persist thread ephemeral memories in the brain HOT 1
- cbot.sh updates HOT 1
- Major installer updates - eliminate R/W deploy key !! HOT 1
- Allow (alias)foo instead of (bot), foo HOT 1
- Data race during build
- AI Plugin: stream out a paragraph at a time
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gopherbot.