bas 1.5.0 → 1.5.2

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: 9b74f1cf242bbd193d745aa8c75166409fb495b8e080717c0db3f03419b7a6c0
4
+ data.tar.gz: f0eb95ba93a7cee05eb3632b38b1e9f89d3c8bb1a078001799a26a4e5af90a55
5
5
  SHA512:
6
- metadata.gz: e54fb58367965508444478928581d8822212def15cfe3b1d5b47ef75ef0a5126293d35295d8a54f43f828fb97a102f86c68d7a3eb057c66f82db435576be042e
7
- data.tar.gz: 471ec1cff36b69d3e51468c0372a00b0fb1a1185977d82ab458a3afbfce6aeccd32bf4861dc93f67270f6c301aff1c6fea7c75aeacd933db10ce9e486b7b69b1
6
+ metadata.gz: 84205602165ebaf52cd11368f5622dd56761a1e6bdaa08ad8bb53d1b40bf431264248ece8c4b9da7edf06816e3d07088c74b914d350da6623354743005bdf076
7
+ data.tar.gz: 22f0220be75faf2e3417c186fd39bcb73b7742e468022e4022a88ec96d5a42965d2a846034f56e643ef48b579f837a5fce4cfcaac3f87b1fcf937ed942ce70bc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ # 1.5.2 (08.10.2024)
4
+ - [Change some details in Discord utils and review media](https://github.com/kommitters/bas/issues/108)
5
+
6
+ # 1.5.1 (08.10.2024)
7
+ - [Refactor Discord Bots Logic to conform with discord_bot implementation](https://github.com/kommitters/bas/issues/105)
8
+
3
9
  # 1.5.0 (03.10.2024)
4
10
  - [Add bots to fetch images from Discord](https://github.com/kommitters/bas/issues/103)
5
11
 
@@ -51,7 +51,6 @@ module Bot
51
51
  #
52
52
  class ReviewMedia < Bot::Base
53
53
  DETAIL = "low"
54
-
55
54
  # read function to execute the PostgresDB Read component
56
55
  #
57
56
  def read
@@ -125,7 +124,8 @@ module Bot
125
124
 
126
125
  def media_hash
127
126
  {
128
- thread_id: read_response.data["thread_id"],
127
+ message_id: read_response.data["message_id"],
128
+ channel_id: read_response.data["channel_id"],
129
129
  property: read_response.data["property"],
130
130
  author: read_response.data["author"],
131
131
  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,9 @@ 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")
43
44
  headers = headers(params[:secret_token])
44
- HTTParty.send(params[:method], url, { body: params[:body].to_json, headers: })
45
+ HTTParty.post(url_message, { body: params[:body].to_json, headers: })
45
46
  end
46
47
 
47
48
  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.2"
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.2
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