Skip to content

Commit

Permalink
fix: fixed id in db (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
urumo authored May 7, 2021
1 parent 58bf8b2 commit 2e8f5bf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 0 additions & 2 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,5 @@ def self.check_caller_status(caller_id, message_id, chat_id)

def self.get_user(target, chat_id)
User.find_or_create_by(tg_id: target.id, user_name: target.username, chat_id: chat_id)
rescue ActiveRecord::RecordNotUnique
User.find_by(tg_id: target.id, user_name: target.username, chat_id: chat_id)
end
end
2 changes: 2 additions & 0 deletions lib/tasks/tg_webhook.rake
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ namespace :tg do
return unless should_abuse

User.where(super_black_list: true) do |user|
next if user.user_name.nil? || user.user_name.empty?

text = "@#{user.user_name} #{GosuModel.all.sample.reply}"
Bot.all.sample.send_message(user.chat_id, text, nil, (rand * 1000).round)
end
Expand Down

0 comments on commit 2e8f5bf

Please sign in to comment.