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 +4 -4
- data/lib/rubydium/mixins/other_actions.rb +6 -4
- data/lib/rubydium/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd8a4b3eb19dab8c582ef2c411debfe38f29c7ad1a21f1eaa4441c5e8545e2db
|
4
|
+
data.tar.gz: f5ed32ade9c218bb8d03ac392c9ae5228628f5fdd53a2678ef6a01d4d79250bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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"]
|
data/lib/rubydium/version.rb
CHANGED