Comments (5)
The first part of the channel ID will start with "D"
{'ts': '1454135373.000338', 'text': 'This is a channel', 'user': 'U02GSB32U', 'channel': 'C02HDGZT9', 'team': '<REDACTED>', 'type': 'message'}
{'ts': '1454135387.000045', 'text': 'This is a group', 'user': 'U02GSB32U', 'channel': 'G04UL2QM5', 'team': '<REDACTED>', 'type': 'message'}
{'ts': '1454135392.000010', 'text': 'This is a DM', 'user': 'U02GSB32U', 'channel': 'D04UGH7SL', 'team': '<REDACTED>', 'type': 'message'}
from limbo.
neat! next up is that this should be wired into slackrtm, probably the message should come with an is_direct_message
field or something?
from limbo.
Having a second look at the code in the commit that you've linked, they're not looking for DMs, they're looking for mentions of the bot within regular channel/group messages.
init_msg == '<@xxxxxxx>:'
You can get this ID using the auth.test call from slack.
Maybe have a .self_id attribute to server?
That way we can have the following functions as part of the server object, that people can check with within plugins:
def is_direct(server, msg):
if msg['channel'][0] == "D":
return True
def is_mention(server, msg):
if msg["text"].split(" ")[0] = "<{0}>:".format(server.self_id):
return True
from limbo.
The bot's ID is actually available, via the opaque server.slack.server.login_data["self"]["name"]
; limbo used to make sure it wasn't responding to itself but I seem to have cut that out when I added the bot_message
handler.
from limbo.
the slackrtm library should probably gain two issues:
- create a self_id attribute
- add a direct message flag
will do when I have time
from limbo.
Related Issues (20)
- Proposition: Drop support for Python 2 HOT 10
- Please set the OXFORD_APP_ID and OXFORD_APP_KEY environment variables to valid (free) Oxford dictionary API keys HOT 1
- Oxford V1 API is deprecated.
- slackclient not compatible with files.upload HOT 1
- Remove DarkSky dependency in Weather Plugin HOT 4
- Migrate away from deprecated API calls HOT 2
- upload packages with twine
- Make it easy to thread limbo responses HOT 2
- Travis is now unusably slow HOT 1
- plugin idea: emoji added/changed bot HOT 1
- convert to github actions
- add --version flag
- !cat
- !turtle
- !bunny
- Lunch status updater
- unsplash plugin
- use socket mode instead of rtm
- Capability to add custom plugins without removing included plugins HOT 4
- Lack of support for python 3.12 HOT 1
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 limbo.