Comments (6)
There may be a misunderstanding here. We aren't restricting anything in mmpy_bot.
The driver used by this project and linked above is the core that handles the requests. It supports having one event handler function. This role is taken by the event handler in mmpy_bot.
This handler is not accessible to plugins as this was not part of mmpy_bot's design. If you need access to it, you have two options:
- Modify mmpy_bot's event handler code to expose events.
- Use the driver directly, without mmpy_bot and build your own framework on top of it.
If you choose 1, you are welcome to open a pull request with your contributions. Maintainers will review and decide upon it.
from mmpy_bot.
Hi @zba,
For "raw" access you may want to look into python-mattermost-autodriver which is how mmpy_bot interacts with mattermost.
You can enable debug
information as described in usage.
If you want to implement conversational behavior in mmpy_bot, see also #140.
from mmpy_bot.
The problem is how mmpy bot handles events, i access driver correct,. Please read example i provide. The problem, that autodriver init single time, it is not subscription by itself, so mmpy loose connection to driver if i init it in plugin, so i had to make this dirty trick to pass events back to mmpy. But if another plugin do same, 1st one will not receive events in my example. It could be easy fixed by making event proxy in eventhandler class,
May be i highlighted it not enough :) i need reactions events, so this is why i need, raw, i happy already to use message listeners and they work, while i not reinit event listener in my plugin, so i made ugly solution to pass this event back to mmpy bot :) ,
I not real pythonist, but you can use EventEmitter template (just found a lot libraries around so can't suggest any)
which provide basically template
in init
self.events = EventEmmitter()
in event receiver (_handle_event()
in your function) :
self.websocket_events.emit(eventName, eventData)
in module main class init
self.websocket_events = self.event_handler.websocket_events
in MyPlugin in init
self.wesocket_events.on('reaction_add', callback)
(or for more security you can export on() and once() methods)
I not real pythonist (more js), so I not sure if it best solution or not :) but access to events any way could make me and anybody like me happy :)
from mmpy_bot.
mmpy_bot
currently only listens to posted
events.
See #445 for another request to add support for post_edited
and a suggestion on how to achieve it.
See also #377 and #386 for other discussion about other kinds of events.
Reactions would need a new approach given @listen_to
doesn't make sense for them.
The point of mmpy_bot
is that you don't have to interact with events at low level.
If you need that functionality, this is currently not supported without modifying mmpy_bot's source.
We could add support for different kinds of event handlers if a proposal is made and implemented.
Contributions are welcome.
from mmpy_bot.
Yes, i like i haven't too, but why not allow me also raw access as i have access to driver too ? The whole point of this issue is ask to add ability to use functions of driver not implemented in decorators.
from mmpy_bot.
Ah I got, i not need mmpy bot, because all it does is decorators on posts events, and i can just go with event model without decorators, hm, ok. I chose 2
from mmpy_bot.
Related Issues (20)
- Send a message direct to user who joins room HOT 2
- RuntimeError: this event loop is already running. HOT 9
- No connection with docker image 2.0.0 and MM7.1.3 HOT 2
- Improvement: Add `type` optional param for `create_post(...)` function HOT 7
- Unable to run concurrent asyncio processes HOT 5
- [Question] Register plugins at runtime HOT 1
- Scheduled responses to channel instead of reply HOT 5
- How to send files to bot directly for some postpone processing? HOT 3
- HTTP/1.1 404 Not Found : Wrong api endpoint HOT 4
- dev requirements inside main project HOT 3
- [Feature Request] Handler for message editions HOT 1
- Need to fix issue flagged when using latest Pytype HOT 2
- Websocket HOT 3
- Mandatory MATTERMOST_PORT breaks MATTERMOST_URL with subpaths HOT 2
- Disable httpx logging? HOT 2
- Reading previously sent messages HOT 1
- Bot.run does not return when stop is called HOT 3
- Bot fails to respond with copied ping if username is capitalized HOT 2
- Import plugins from separate files
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 mmpy_bot.