example.rb in tgbot-0.1.1 vs example.rb in tgbot-0.1.2
- old
+ new
@@ -66,11 +66,11 @@
reply "#{'%.2f' % n} (#{t})"
end
bot.before do |update|
log ">> Processing ##{update.id}"
- log "@#{update.message&.from.username}: #{update.text}", 3
+ log "@#{update.message&.from&.first_name}: #{update.text}", 3
end
bot.after do |update|
if update.done?
log "=> Success ##{update.id}", 2
else
@@ -99,10 +99,10 @@
bot.get 'coin' do
send_message Array.new(text&.match(/\d+/)&.to_s.to_i || 1){ ['🌞', '🌚'].sample }.join
end
bot.get 'roll' do
- send_message rand(text&.match(/\d+/)&.to_s.to_i || 100).to_s
+ send_message rand(text&.match(/\d+/)&.to_s.to_i.nonzero? || 100).to_s
end
end
save_data Garage
\ No newline at end of file