Skip to content

Commit

Permalink
Merge branch 'master' into risky
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonp committed Jul 9, 2014
2 parents d086e60 + 7437f4b commit 642e57e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
20 changes: 14 additions & 6 deletions botspade.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,19 @@ def save_data_silent
def take_points(person, points)
# Newer Fancy Way
user = get_user(person)
newpoints = user[2] - points
db_checkins_save(user[0], newpoints)
if (user)
newpoints = user[2] - points
db_checkins_save(user[0], newpoints)
end
end

def give_points(person, points)
# Newer Fancy Way
user = get_user(person)
newpoints = user[2] + points
db_checkins_save(user[0], newpoints)
if (user)
newpoints = user[2] + points
db_checkins_save(user[0], newpoints)
end
end

def person_has_enough_points(nick, points_required)
Expand Down Expand Up @@ -469,8 +473,12 @@ def user_is_an_admin?(user)
person = first.downcase
points = last.to_i
if user_is_an_admin?(nick)
give_points(person, points)
msg channel, "#{nick} has given #{person} #{points} #{@botmaster} Points"
if get_user(person)
give_points(person, points)
msg channel, "#{nick} has given #{person} #{points} #{@botmaster} Points"
else
msg channel, "You can only give points to someone who has checked in at least once!"
end
else
if get_user(person)
if person_has_enough_points(nick, points)
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ You can exit (stop) the bot by typing:

### Contributing

If you'd like to help, I'd love it! Just fork the repository, and feel free to send pull requests and reach out to me about contributing. Please send pull requests to the "head" branch, master is the "stable release."
If you'd like to help, I'd love it! Just fork the repository, and feel free to send pull requests and reach out to me about contributing. Please send pull requests to the "risky" branch, master is the "stable release."

Big thanks to @Etheco for his contributions so far.

Expand Down

0 comments on commit 642e57e

Please sign in to comment.