bas 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7973ce35f2f21618cec7a06ad45604419d1ef3523a63d451f7e21ec5034fe766
4
- data.tar.gz: b4245c4f9adda76ce60e1638e812dd8efee15afe2643bb85c63f22bf3e27f516
3
+ metadata.gz: dc097e8e7e42bd943e3b030b01f532ecfdd8473eaaa93dac0e7e26f72a1722ac
4
+ data.tar.gz: 9dfcbd1f8adcd76b419c8d451a39896d0dc6d267ce0d3fb76951cfd81cff4ab9
5
5
  SHA512:
6
- metadata.gz: e54fb58367965508444478928581d8822212def15cfe3b1d5b47ef75ef0a5126293d35295d8a54f43f828fb97a102f86c68d7a3eb057c66f82db435576be042e
7
- data.tar.gz: 471ec1cff36b69d3e51468c0372a00b0fb1a1185977d82ab458a3afbfce6aeccd32bf4861dc93f67270f6c301aff1c6fea7c75aeacd933db10ce9e486b7b69b1
6
+ metadata.gz: 60a2fca24755bd820a3f11cea0ecb51f9596d544c1b293e173c200bc1d1b2f8a1ba473e6834b79bbdd3d0a421a07ad0e2ae4940c9a571c82f51a2fd957f19bfa
7
+ data.tar.gz: de05850f251b1b3c2726624733a6cac04c19829dd56e1f469450b409eb91ba203a65738f1b569a284e270c706d72a999cd2574d3df15ce7e937e4c7975718d18
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ # 1.5.1 (08.10.2024)
4
+ - [Refactor Discord Bots Logic to conform with discord_bot implementation](https://github.com/kommitters/bas/issues/105)
5
+
3
6
  # 1.5.0 (03.10.2024)
4
7
  - [Add bots to fetch images from Discord](https://github.com/kommitters/bas/issues/103)
5
8
 
@@ -50,8 +50,6 @@ module Bot
50
50
  # bot.execute
51
51
  #
52
52
  class ReviewMedia < Bot::Base
53
- DETAIL = "low"
54
-
55
53
  # read function to execute the PostgresDB Read component
56
54
  #
57
55
  def read
@@ -125,7 +123,8 @@ module Bot
125
123
 
126
124
  def media_hash
127
125
  {
128
- thread_id: read_response.data["thread_id"],
126
+ message_id: read_response.data["message_id"],
127
+ channel_id: read_response.data["channel_id"],
129
128
  property: read_response.data["property"],
130
129
  author: read_response.data["author"],
131
130
  media_type: process_options[:media_type]
@@ -63,7 +63,7 @@ module Bot
63
63
  response = Utils::Discord::Request.write_media_text(params)
64
64
 
65
65
  if response.code == 200
66
- { success: { thread_id: read_response.data["thread_id"], property: read_response.data["property"] } }
66
+ { success: { message_id: read_response.data["message_id"], property: read_response.data["property"] } }
67
67
  else
68
68
  { error: { message: response.parsed_response, status_code: response.code } }
69
69
  end
@@ -88,10 +88,10 @@ module Bot
88
88
 
89
89
  def params
90
90
  {
91
- endpoint: "channels/#{read_response.data["thread_id"]}/messages",
91
+ body:,
92
92
  secret_token: process_options[:secret_token],
93
- method: "post",
94
- body:
93
+ message_id: read_response.data["message_id"],
94
+ channel_id: read_response.data["channel_id"]
95
95
  }
96
96
  end
97
97
 
@@ -31,7 +31,8 @@ module Utils
31
31
 
32
32
  {
33
33
  "media" => images_urls,
34
- "thread_id" => message.id,
34
+ "message_id" => message.id,
35
+ "channel_id" => message.channel.id,
35
36
  "author" => message.author.username,
36
37
  "timestamp" => message.timestamp.to_s,
37
38
  "property" => "images"
@@ -39,9 +40,10 @@ module Utils
39
40
  end
40
41
 
41
42
  def self.write_media_text(params)
42
- url = URI.parse("#{DISCORD_BASE_URL}/#{params[:endpoint]}")
43
+ url_message = URI.parse("#{DISCORD_BASE_URL}/channels/#{params[:channel_id]}/messages")
44
+ message_body = { content: params[:body] }
43
45
  headers = headers(params[:secret_token])
44
- HTTParty.send(params[:method], url, { body: params[:body].to_json, headers: })
46
+ HTTParty.post(url_message, { body: message_body.to_json, headers: })
45
47
  end
46
48
 
47
49
  def self.headers(secret_token)
data/lib/bas/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Bas
4
4
  # Gem version
5
- VERSION = "1.5.0"
5
+ VERSION = "1.5.1"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bas
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - kommitters Open Source
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-03 00:00:00.000000000 Z
11
+ date: 2024-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gmail_xoauth