Skip to content

Commit

Permalink
modify bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ttt12334 committed Dec 22, 2023
1 parent 23df4ee commit 1730e61
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Address < ApplicationRecord

after_save do
if self.saved_changes['balance'].present?
TelegramBot.perform_async(self, self.balance - self.saved_changes['balance'][0].to_i) if self.tg_bots.active.exists?
TelegramBot.perform_async(self.id, self.balance - self.saved_changes['balance'][0].to_i) if self.tg_bots.active.exists?
end
end

Expand Down
3 changes: 2 additions & 1 deletion app/workers/telegram_bot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ class TelegramBot
include Sidekiq::Worker
require 'telegram/bot'
sidekiq_options queue: "telegram"
def perform(address, change_balance)
def perform(address_id, change_balance)
address = Address.find_by(id: address_id)
bot = Telegram::Bot::Client.new(Settings.tg_bot_token)
address.tg_bots.active.each do |tg_bot|
bot.api.send_message(chat_id: tg_bot.chat_id, text: "Address: <a href='https://nervosscan.com/addresses/#{tg_bot.address_hash}'>#{tg_bot.address_hash}</a>
Expand Down

0 comments on commit 1730e61

Please sign in to comment.