discordrb-webhooks 3.3.0 → 3.4.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 743d3b8577ca40cb2715db98d2edc5ee4f6b4d061482e60ae11af4fe1e1fe1ea
|
4
|
+
data.tar.gz: e0d589551b5e0c36dfdf4abdec941b958f0cb60b4971c233caec2e4f910530ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb77b442f58026ac6473b91ac6b85dfc45f93f7954ba639689e2707f1d699e470c66020da6292c04bb3e4c8a216bb0de8429306226415e92895379fd0302b1ac
|
7
|
+
data.tar.gz: 3a640f64fb59b9f7addb1c7b7dee42e84a650411f517dd1811663c8b0c6690540912736a0f66f43a2ed49f116a6f3169817493fca514fb33e1f665d973267d72
|
@@ -37,6 +37,7 @@ module Discordrb::Webhooks
|
|
37
37
|
# @param file [File] A file to be sent.
|
38
38
|
def file=(file)
|
39
39
|
raise ArgumentError, 'Embeds and files are mutually exclusive!' unless @embeds.empty?
|
40
|
+
|
40
41
|
@file = file
|
41
42
|
end
|
42
43
|
|
@@ -44,6 +45,7 @@ module Discordrb::Webhooks
|
|
44
45
|
# @param embed [Embed] The embed to add.
|
45
46
|
def <<(embed)
|
46
47
|
raise ArgumentError, 'Embeds and files are mutually exclusive!' if @file
|
48
|
+
|
47
49
|
@embeds << embed
|
48
50
|
end
|
49
51
|
|
@@ -15,11 +15,7 @@ module Discordrb::Webhooks
|
|
15
15
|
# @param token [String] The webhook's authorisation token. Will only be used
|
16
16
|
# if `url` is not set.
|
17
17
|
def initialize(url: nil, id: nil, token: nil)
|
18
|
-
@url =
|
19
|
-
url
|
20
|
-
else
|
21
|
-
generate_url(id, token)
|
22
|
-
end
|
18
|
+
@url = url || generate_url(id, token)
|
23
19
|
end
|
24
20
|
|
25
21
|
# Executes the webhook this client points to with the given data.
|
@@ -68,7 +64,7 @@ module Discordrb::Webhooks
|
|
68
64
|
end
|
69
65
|
|
70
66
|
def generate_url(id, token)
|
71
|
-
"https://
|
67
|
+
"https://discord.com/api/v6/webhooks/#{id}/#{token}"
|
72
68
|
end
|
73
69
|
end
|
74
70
|
end
|
@@ -37,18 +37,20 @@ module Discordrb::Webhooks
|
|
37
37
|
alias_method :color, :colour
|
38
38
|
|
39
39
|
# Sets the colour of the bar to the side of the embed to something new.
|
40
|
-
# @param value [
|
40
|
+
# @param value [String, Integer, {Integer, Integer, Integer}, #to_i, nil] The colour in decimal, hexadecimal, R/G/B decimal, or nil to clear the embeds colour
|
41
41
|
# form.
|
42
42
|
def colour=(value)
|
43
43
|
if value.nil?
|
44
44
|
@colour = nil
|
45
45
|
elsif value.is_a? Integer
|
46
46
|
raise ArgumentError, 'Embed colour must be 24-bit!' if value >= 16_777_216
|
47
|
+
|
47
48
|
@colour = value
|
48
49
|
elsif value.is_a? String
|
49
50
|
self.colour = value.delete('#').to_i(16)
|
50
51
|
elsif value.is_a? Array
|
51
52
|
raise ArgumentError, 'Colour tuple must have three values!' if value.length != 3
|
53
|
+
|
52
54
|
self.colour = value[0] << 16 | value[1] << 8 | value[2]
|
53
55
|
else
|
54
56
|
self.colour = value.to_i
|
@@ -92,7 +94,7 @@ module Discordrb::Webhooks
|
|
92
94
|
# embed.add_field(name: 'A field', value: "The field's content")
|
93
95
|
# @param name [String] The field's name
|
94
96
|
# @param value [String] The field's value
|
95
|
-
# @param inline [true, false] Whether the field should be
|
97
|
+
# @param inline [true, false] Whether the field should be inline
|
96
98
|
def add_field(name: nil, value: nil, inline: nil)
|
97
99
|
self << EmbedField.new(name: name, value: value, inline: inline)
|
98
100
|
end
|
@@ -106,14 +108,14 @@ module Discordrb::Webhooks
|
|
106
108
|
title: @title,
|
107
109
|
description: @description,
|
108
110
|
url: @url,
|
109
|
-
timestamp: @timestamp
|
111
|
+
timestamp: @timestamp&.utc&.iso8601,
|
110
112
|
color: @colour,
|
111
|
-
footer: @footer
|
112
|
-
image: @image
|
113
|
-
thumbnail: @thumbnail
|
114
|
-
video: @video
|
115
|
-
provider: @provider
|
116
|
-
author: @author
|
113
|
+
footer: @footer&.to_hash,
|
114
|
+
image: @image&.to_hash,
|
115
|
+
thumbnail: @thumbnail&.to_hash,
|
116
|
+
video: @video&.to_hash,
|
117
|
+
provider: @provider&.to_hash,
|
118
|
+
author: @author&.to_hash,
|
117
119
|
fields: @fields.map(&:to_hash)
|
118
120
|
}
|
119
121
|
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: discordrb-webhooks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- meew0
|
8
|
+
- swarley
|
8
9
|
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2020-12-06 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rest-client
|
@@ -16,14 +17,14 @@ dependencies:
|
|
16
17
|
requirements:
|
17
18
|
- - ">="
|
18
19
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
20
|
+
version: 2.0.0
|
20
21
|
type: :runtime
|
21
22
|
prerelease: false
|
22
23
|
version_requirements: !ruby/object:Gem::Requirement
|
23
24
|
requirements:
|
24
25
|
- - ">="
|
25
26
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
27
|
+
version: 2.0.0
|
27
28
|
description: A client for Discord's webhooks to fit alongside [discordrb](https://rubygems.org/gems/discordrb).
|
28
29
|
email:
|
29
30
|
- ''
|
@@ -36,7 +37,7 @@ files:
|
|
36
37
|
- lib/discordrb/webhooks/client.rb
|
37
38
|
- lib/discordrb/webhooks/embeds.rb
|
38
39
|
- lib/discordrb/webhooks/version.rb
|
39
|
-
homepage: https://github.com/
|
40
|
+
homepage: https://github.com/shardlab/discordrb
|
40
41
|
licenses:
|
41
42
|
- MIT
|
42
43
|
metadata: {}
|
@@ -48,15 +49,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
48
49
|
requirements:
|
49
50
|
- - ">="
|
50
51
|
- !ruby/object:Gem::Version
|
51
|
-
version: 2.
|
52
|
+
version: '2.5'
|
52
53
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
54
|
requirements:
|
54
55
|
- - ">="
|
55
56
|
- !ruby/object:Gem::Version
|
56
57
|
version: '0'
|
57
58
|
requirements: []
|
58
|
-
|
59
|
-
rubygems_version: 2.7.7
|
59
|
+
rubygems_version: 3.1.4
|
60
60
|
signing_key:
|
61
61
|
specification_version: 4
|
62
62
|
summary: Webhook client for discordrb
|