fastlane-plugin-discord_notifier 0.1.3 → 0.1.4

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: 34904451f95c7fc5f7a7c6306dcaa08ed9b498d1a62ae6d8a1b9439be9d25a67
4
- data.tar.gz: 10e21236b5c92cc5b7b05f616a9f0a96dce3924ded74db51705006da42a05a8c
3
+ metadata.gz: b391585c5e6d46d1480e5149371199262d98d770f99f7e8b55a7d80cf12e3197
4
+ data.tar.gz: d5ed3d201dac80c5856f5b6cd61e80a136f052328774f356544ac0e61ef62f50
5
5
  SHA512:
6
- metadata.gz: 6990534b086feb52ad1b41573e12332e249032e0d9a23b7762c9500c84350d11a3632048281f1b6f5fc02a4d0d297611178e26891f200d733490ecebc788a626
7
- data.tar.gz: eb630d1beefc4c8494780275b056d051784c9d7bc8306ab237fb7ad774dde6a0eb7548017fb406736d9ed7d9f93044e214e9c72ef2f1a8cd94cb9634812ef357
6
+ metadata.gz: 3579f3517446cf0584ccba90d186deffaf6213f98482f9c4c760ab789af177581c1674a8757465752cdd087392b1998cb30ff88a923dd35d63b5bb556b89900c
7
+ data.tar.gz: 2d231de4565551db57d9d97aeeb79cbc00cbed5bf01c0cdda1dfe76ea23762d3fdd982143e24d05621010a2b62be51f8990188949aedda5c6235378f3a00bc90
data/README.md CHANGED
@@ -25,10 +25,22 @@ discord_notifier(
25
25
  webhook_url:"<discord webhook url>",
26
26
  title: "<a title>",
27
27
  description: "<a description>",
28
- success: "<true/false>",
29
- color: "FFFFF",
30
- thumbnail_url:"<thumbnail url>",
31
- image_url:"<image url>"
28
+ fields:[
29
+ {
30
+ name:"<some name>",
31
+ value:"<some value>"
32
+ },
33
+ {
34
+ name:"<some name>",
35
+ value:"<some value>"
36
+ inline: true
37
+ },
38
+ {
39
+ name:"<some name>",
40
+ value:"<some value>"
41
+ inline: true
42
+ }
43
+ ]
32
44
  )
33
45
  ```
34
46
 
@@ -41,18 +53,19 @@ discord_notifier(
41
53
  | description | Message description | false
42
54
  | thumbnail_url | Thumbnail url | true
43
55
  | image_url | Message image url | true
44
- | success | Show file differences that haven't been staged | true
56
+ | success | Setting to true will turn the message sidebar green whereas false will turn it to red. If `color` is set, it will override the default behaviour of `success` | true
45
57
  | color | The color defined will be attributed to the message sidebar. The sidebar by default uses #4BB543 if `success` is set to true and #CC0000 if set to false. If color is set, it overrides the default color described before. | true
46
58
  | gravatar_email | If set, then the author's image will be replaced by the resolved gravatar. If not and the next 3 keys are set, the author's image will be set as the user's discord avatar | true
47
59
  | bot_token | Token of bot assigned to discord server | true
48
60
  | client_id | Client id retrieved upon bot creation | true
49
- | discord_user_id | User id of the discord user | true
61
+ | discord_user_id | User id of the discord user. Setting it as an env variable is suggested so that different users use their own id | true
62
+ | fields | Array of extra `name`, `value` pairs to add to a message. Setting `inline` to true will combine fields in the same row | true
50
63
 
51
64
  **Note on the Bot**: Currently the bot is needed in case you want to retrieve your discord user's data. the plugin is using the user's name and avatar to assign them to the author of the message. Create a [discord application](https://discordapp.com/developers/applications), then a new bot and finally assign it to your server. You will need the bot token, the client id and your discord user's id to successfully retrieve all the necessary data.
52
65
 
53
66
  ## Example
54
67
 
55
- Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
68
+ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`. You can also use a [visualizer](https://leovoel.github.io/embed-visualizer/) to see how discord formats your messages using all the aforementioned keys.
56
69
 
57
70
  ## Run tests for this plugin
58
71
 
@@ -10,6 +10,7 @@ module Fastlane
10
10
 
11
11
  UI.message("Notifying Discord")
12
12
 
13
+
13
14
  color = params[:success] ? "4BB543" : "CC0000"
14
15
 
15
16
  unless params[:color].nil? || params[:color] == 0
@@ -49,6 +50,11 @@ module Fastlane
49
50
  )
50
51
  embed.colour = color
51
52
  embed.timestamp = Time.now
53
+
54
+ params[:fields].each { |item|
55
+
56
+ embed.add_field(name: item[:name], value: item[:value], inline: item[:inline])
57
+ } unless params[:fields].nil?
52
58
  end
53
59
  end
54
60
  end
@@ -132,6 +138,11 @@ module Fastlane
132
138
  env_name: "DISCORD_USER_ID",
133
139
  optional: true,
134
140
  type: String
141
+ ),
142
+ FastlaneCore::ConfigItem.new(
143
+ key: :fields,
144
+ optional: true,
145
+ type: Array
135
146
  )
136
147
  ]
137
148
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module DiscordNotifier
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-discord_notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikos Theodosis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-18 00:00:00.000000000 Z
11
+ date: 2020-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry