lib/tgbot/update.rb in tgbot-0.1.0 vs lib/tgbot/update.rb in tgbot-0.1.1
- old
+ new
@@ -17,10 +17,16 @@
@update[@type].chat&.id
end
def text
@update[@type].text
end
+ def done!
+ @done = true
+ end
+ def retry n = 1
+ @done = false if @count < n
+ end
def send_message(text = nil, **kwargs)
return unless chat_id
return unless text = text || kwargs.delete(:text)
@bot.send_message(chat_id: chat_id, text: text, **kwargs)
end
@@ -29,9 +35,10 @@
return unless text = text || kwargs.delete(:text)
@bot.send_message(
chat_id: chat_id, text: text,
reply_to_message_id: @update[@type].message_id, **kwargs)
end
+ alias reply reply_message
%i(photo audio document video voice video_note).each do |name|
class_eval %{
def send_#{name}(#{name} = nil, **kwargs)
return unless chat_id
return unless #{name} = #{name} || kwargs.delete(:#{name})