Module: Telegram::DeleteApis
Instance Method Summary collapse
-
#delete_chat_photo(chat_id) ⇒ Object
Use this method to delete a chat photo.
-
#delete_chat_sticker_set(chat_id) ⇒ Object
Use this method to delete a group sticker set from a supergroup.
-
#delete_message(chat_id, message_id) ⇒ Object
Use this method to delete a message, including service messages.
-
#delete_sticker_from_set(sticker) ⇒ Object
Use this method to delete a sticker from a set created by the bot.
Methods included from CoreApi
Instance Method Details
#delete_chat_photo(chat_id) ⇒ Object
Use this method to delete a chat photo.
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/api/delete_apis.rb', line 10 def delete_chat_photo(chat_id) unless chat_id.to_i.negative? fail BadRequestError, %{can't delete private chat photo} end hash = { chat_id: chat_id } response = http_post('deleteChatPhoto', hash) unless response.ok # rubocop:disable Style/IfUnlessModifier fail PermissionError, response.description end response.result end |
#delete_chat_sticker_set(chat_id) ⇒ Object
Use this method to delete a group sticker set from a supergroup.
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/api/delete_apis.rb', line 25 def delete_chat_sticker_set(chat_id) unless chat_id.to_i.negative? fail BadRequestError, %{can' delete sticker set of private chat} end hash = { chat_id: chat_id } response = http_post('deleteChatStickerSet', hash) unless response.ok # rubocop:disable Style/IfUnlessModifier fail PermissionError, response.description end response.result end |
#delete_message(chat_id, message_id) ⇒ Object
Use this method to delete a message, including service messages.
40 41 42 43 44 45 46 47 48 |
# File 'lib/api/delete_apis.rb', line 40 def (chat_id, ) hash = { chat_id: chat_id, message_id: } response = http_post('deleteMessage', hash) unless response.ok # rubocop:disable Style/IfUnlessModifier fail TelegramError, response.description end response.result end |
#delete_sticker_from_set(sticker) ⇒ Object
Use this method to delete a sticker from a set created by the bot.
51 52 53 |
# File 'lib/api/delete_apis.rb', line 51 def delete_sticker_from_set(sticker) throw NotImplementedError, 'currently not supported' end |