-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extension on Reaction events to return Member #351
Conversation
lib/discordrb/events/reactions.rb
Outdated
@user = @bot.user(@user_id).on(@server) | ||
else | ||
@user = @bot.user(@user_id) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this could be neatened to:
@user ||= if server
server.member(@user_id)
else
@bot.user(@user_id)
end
This is good to merge. I'm abstaining on the specs for now due to thinking about a better method of providing spec fixtures than the structure we have right now. Tested with eval code |
lib/discordrb/events/reactions.rb
Outdated
def user | ||
# Cache the user so we don't do requests all the time | ||
@user ||= @bot.user(@user_id) | ||
@user ||= if server | ||
@bot.user(@user_id).on(@server) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be simplified to @server.member(@user_id)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I told him to do that but Nekka doesn't like me.
SpecsWon't add yet