Comments (8)
ooh good catch, I hadn't considered that case!
Thanks so much for reporting, fixing it will be a top priority when I get time to work on this.
from limbo.
I'd encountered this before but wasn't sire what caused it. I knew a
restart fixed it.
A similar issue happens when you add the bot to a new private group on the
first time its triggered.
Mind if I have a go at fixing this?
On Sat, 30 Apr 2016 02:20 Bill Mill [email protected] wrote:
ooh good catch, I hadn't considered that case!
Thanks so much for reporting, fixing it will be a top priority when I get
time to work on this.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#74 (comment)
from limbo.
Not at all, have at it
from limbo.
Looking at the offending code, it appears to be because slackrtm pulls the list of users originally and as such the server object has a static list of users in server.slack.server.users
When a new user enters, slackrtm doesn't update the list of users, which is giving the key error.
The immediately obvious way to fix it would be to make slackrtm update the users first when this KeyError occurs, try again and then if it happens again perform the debugging.
Having said that, what purpose does this line serve? (from limbo/limbo.py ln 131
)
msguser = server.slack.server.users[event["user"]]
Can this be replaced with just msguser = event["user"]
? As far as I can see this would server the same purpose and solve the issue, or is msguser used elsewhere that I can't find?
from limbo.
Looking at the offending code, it appears to be because slackrtm pulls the list of users originally and as such the server object has a static list of users in server.slack.server.users
When a new user enters, slackrtm doesn't update the list of users, which is giving the key error.
Yup! So I think one part of fixing this is updating slackrtm to catch the team_join
message and update the user roster. If it's promising to maintain a user roster, it ought to do so.
Having said that, what purpose does this line serve? (from limbo/limbo.py ln 131)
Very good question! It used to be there to make sure that we didn't get into a loop by responding to bot messages from ourself or from slackbot. However, slack has since added the bot_message
subtype which prevents this problem, and I don't seem to have noticed that we didn't need it anymore.
It also relates to issue #40, which was the cause of me starting to check that every message has a user.
Can this be replaced with just msguser = event["user"]
I think this is the correct answer! We no longer need to check that the user is in the slackrtm roster, though we should fix that too because plugins could depend on that behavior.
from limbo.
As msguser
isn't used at all I've changed the code to the following
if "user" not in event:
logger.debug("event {0} has no user".format(event))
return
I'll make the PR soon.
from limbo.
Ok, I deviated a bit and kept some of the code closer to what it was, and I've made slackrtm update at the same time as fixing this issue (and another issue)
from limbo.
Fixed in 6be28e4
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.