Comments (2)
Great idea! I'll have to think a bit on it, but I'll get back to you on this!
edit: the implementation you suggest cannot be used as-is, because what SlackMachine does by default, is prefixing keys in Redis with a unique identifier for each plugin. This should be taken into account when scanning. The pattern provided through the keys(...)
method could be prefixed with the unique idea for example.
from slack-machine.
That's fine. I assume that you mean something along the lines of this:
def keys(self, key):
return self._redis.scan_iter(pattern='{}:*'.format(self._prefix(key)))
...
I'm adding the following right underneath http://slack-machine.readthedocs.io/en/latest/_modules/machine/storage/backends/base.html#MachineBaseStorage.get:
def keys(self, key, shared=False):
"""Retrieve data by key
:param key: key for the data to retrieve
:param shared: ``True/False`` wether to retrieve data from the shared (global) namespace.
:return: the data, or ``None`` if the key cannot be found/has expired
"""
namespaced_key = self._namespace_key(key, shared)
# value = Storage.get_instance().get(namespaced_key)
value = Storage.get_instance().keys(namespaced_key)
if value:
return dill.loads(value)
else:
return None
But, I'm still getting the error:
AttributeError: 'PluginStorage' object has no attribute 'keys'
Is there something else I'm missing? It's fine if this method could be renamed to "get_all_keys", or something of the sort. I'd like to extend the functionality of the storage backend to support more (or all) redis-py functions, if possible.
After modifying these files, do I just run python3 setup.py install
again?
from slack-machine.
Related Issues (20)
- Slack api im.open method has been removed HOT 5
- Move to python-slack-sdk HOT 2
- Replace Travis CI with Github Actions HOT 1
- Move to Events API instead of RTM API HOT 1
- Replace implementations of `*_scheduled` methods with calls to `chat.scheduleMessage` HOT 1
- More flexible python requirements? HOT 1
- Allow user to provide their own logging configuration
- Remove HBase storage plugin HOT 1
- Error messages around user[data] and around ['data']['channel'] HOT 6
- Async support HOT 9
- Introduce structured logging HOT 2
- Add documentation on how to deploy slack-machine
- Add webhook functionality
- How do I set my bot user's icon? HOT 2
- Automatic releases HOT 2
- Can't change log level and use slack-machine logger HOT 2
- Auto-generate app manifests and optionally create Slack app through API
- Overhaul help texts
- Plugin `init()` should be run after connecting to Slack HOT 1
- Create generic socket mode request debug logger
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 slack-machine.