Giter Site home page Giter Site logo

Comments (8)

llimllib avatar llimllib commented on September 6, 2024

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.

StewPoll avatar StewPoll commented on September 6, 2024

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.

llimllib avatar llimllib commented on September 6, 2024

Not at all, have at it

from limbo.

StewPoll avatar StewPoll commented on September 6, 2024

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.

llimllib avatar llimllib commented on September 6, 2024

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.

StewPoll avatar StewPoll commented on September 6, 2024

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.

StewPoll avatar StewPoll commented on September 6, 2024

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.

llimllib avatar llimllib commented on September 6, 2024

Fixed in 6be28e4

from limbo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.