rubydium 0.3.8 → 0.3.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d4702884e4978975d1cb43d55b5d4dd71f575a25424747d98921bb49d8ec126
4
- data.tar.gz: c4ac1f41fa0e9355b079d362aec2551da5149f5d681205f15d187546217343f8
3
+ metadata.gz: fd8a4b3eb19dab8c582ef2c411debfe38f29c7ad1a21f1eaa4441c5e8545e2db
4
+ data.tar.gz: f5ed32ade9c218bb8d03ac392c9ae5228628f5fdd53a2678ef6a01d4d79250bb
5
5
  SHA512:
6
- metadata.gz: b833da95c7c478177ab7d5155ef08624e6392bb8163b1b0ed0acda7ce57f96e46708af29b72bc80b0501553d6b6033d29bcad039e57b431e835d665062927334
7
- data.tar.gz: dcbbbe31bd4f6174cb3395836eda880efb381e0bc5312865e35b0cf8cc064b178336577b3a23c2dff997b296506c108c49c2c8923aae46c7492e873e07d2d47c
6
+ metadata.gz: bd8e9be91951b562bba6a6dce09df212029e6f9f8c25be7ad346c118b0a5445c32751cb7e3429cbcc90aa22579345c60e6ca793f764e0a330b3bee56db11f425
7
+ data.tar.gz: fda884138b31e64f2574f47dd2fe85dee5214e0db056a1aafbdfcd7a8f1f08a5ac62e27fc61cf621ce991816d5480d4226c10610265f680fdc0576e01cbd1d78
@@ -3,13 +3,15 @@ module Rubydium
3
3
  module OtherActions
4
4
  def safe_delete(maybe_message)
5
5
  message = definitely_message(maybe_message)
6
- return false unless message&.from&.id == config.bot_id # also returns if it's nil
6
+ from_owner = message&.from&.username == config.owner_username
7
+ from_bot = message&.from&.id == config.bot_id
8
+ return false unless from_bot || from_owner
7
9
 
8
- safe_delete_by_id(message.message_id)
10
+ safe_delete_by_id(message.message_id, from_bot: true)
9
11
  end
10
12
 
11
- def safe_delete_by_id(id)
12
- return false unless bot_can_delete_messages?
13
+ def safe_delete_by_id(id, from_bot: false)
14
+ return false unless bot_can_delete_messages? || from_bot
13
15
 
14
16
  result = @api.delete_message(chat_id: @chat.id, message_id: id)
15
17
  result["ok"]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rubydium
4
- VERSION = "0.3.8"
4
+ VERSION = "0.3.10"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubydium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - bulgakke