Skip to content
This repository was archived by the owner on Jul 1, 2021. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/discordtipbot/tipbot.cr
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ class TipBot
end

def transfer(from : UInt64, to : UInt64, amount : BigDecimal, memo : String)
@log.debug("#{@config.coinname_short}: Attempting to transfer #{amount} #{@config.coinname_full} from #{from} to #{to}")
log = memo == "rain" || memo == "soak"
@log.debug("#{@config.coinname_short}: Attempting to transfer #{amount} #{@config.coinname_full} from #{from} to #{to}") unless log
ensure_user(from)
ensure_user(to)

Expand All @@ -19,7 +20,7 @@ class TipBot
transaction = tx.connection.exec(sql, memo, from, to, amount)

if transaction.rows_affected == 1
@log.debug("#{@config.coinname_short}: Transfered #{amount} #{@config.coinname_full} from #{from} to #{to}")
@log.debug("#{@config.coinname_short}: Transfered #{amount} #{@config.coinname_full} from #{from} to #{to}") unless log
else
@log.error("#{@config.coinname_short}: Failed to transfer #{amount} from #{from} to #{to}")
return "error"
Expand All @@ -28,7 +29,7 @@ class TipBot
update_balance(from, tx.connection)
update_balance(to, tx.connection)

@log.debug("#{@config.coinname_short}: Calculated balances for #{from} and #{to}")
@log.debug("#{@config.coinname_short}: Calculated balances for #{from} and #{to}") unless log
rescue ex : PQ::PQError
@log.error(ex)
tx.rollback
Expand Down