discorb 0.13.2 → 0.13.3

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: 3ae808ab0fb5c588da2f4b3e895dab373429853b8de022a7a69c3ed7e3c93c30
4
- data.tar.gz: 7f81fb48031fe5945264669a8f5535c1d11917cc846484f2289b3d5f23a7e3a2
3
+ metadata.gz: a9a82de8344e0dad10cce48b6a49bb6c520df2980518f5ead7a107d8196d7f6b
4
+ data.tar.gz: 1277c6e8a2e20bd6245952dbc0001874cd7abf80c220dede886e06d9cd034643
5
5
  SHA512:
6
- metadata.gz: 84dd57449819f7ac91a5ee441f659ad76a4687640751fcda54bc10a588ebedf3ced335e19d295c90a4011ecd0a9a56a3b1b66f003109d54e64ee3769a98c28c3
7
- data.tar.gz: 948820d9e4b77eafdeee77c559e99380863ec400f6d0d0156f921aeb503090d809d55cfa8ee28d7a394d7db444a4081e8c0c832919f481b1f21be1d26f3832b5
6
+ metadata.gz: 6ed3a9bb11473db377910096ff3eaa74e4a0c1c7b73afd85975dbd6b4b541620aceb3d4e096ae4268f75590b5c52e1c62250d6e73457b9515ada6895c040a20e
7
+ data.tar.gz: 8bbc17b2bee9cdf935a381bcb6f60b261f243281e9fb65fcc309852f310648d6aa4f41747252431b665355efcd4e26ea6a77be7cf7535a14a495a6a9f1372df3
data/Changelog.md CHANGED
@@ -6,6 +6,11 @@
6
6
 
7
7
  ## v0.13
8
8
 
9
+ ### v0.13.3
10
+
11
+ - Fix: Fix INTEGRATION_xxx event
12
+ - Change: Change description
13
+
9
14
  ### v0.13.2
10
15
 
11
16
  - Fix: Fix MESSAGE_DELETE_BULK event
data/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  ----
11
11
 
12
- discorb is a Discord API wrapper written in Ruby.
12
+ discorb is a Discord API wrapper for Ruby, Using [socketry/async](https://github.com/socketry/async).
13
13
 
14
14
  ## Installation
15
15
 
data/discorb.gemspec CHANGED
@@ -8,7 +8,18 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ["sevenc-nanashi"]
9
9
  spec.email = ["sevenc-nanashi@sevenbot.jp"]
10
10
 
11
- spec.summary = "A discord API wrapper written in Ruby"
11
+ spec.summary = "A Discord API wrapper for Ruby, Using socketry/async."
12
+ spec.description = <<~RDOC
13
+ == discorb
14
+ discorb is a Discord API wrapper for Ruby, Using {socketry/async}[https://github.com/socketry/async].
15
+
16
+ === Contributing
17
+ Bug reports, feature requests, and pull requests are welcome on {the GitHub repository}[https://github.com/discorb-lib/discorb].
18
+
19
+ === License
20
+ This gem is licensed under the MIT License.
21
+
22
+ RDOC
12
23
  spec.homepage = "https://github.com/discorb-lib/discorb"
13
24
  spec.license = "MIT"
14
25
  spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
data/lib/discorb/asset.rb CHANGED
@@ -47,7 +47,7 @@ module Discorb
47
47
  "avatars"
48
48
  when Guild, IncomingWebhook::Guild
49
49
  "icons"
50
- when Application
50
+ when Application, Integration::Application
51
51
  "app-icons"
52
52
  when Application::Team
53
53
  "team-icons"
@@ -4,7 +4,7 @@ module Discorb
4
4
  # @return [String] The API base URL.
5
5
  API_BASE_URL = "https://discord.com/api/v9"
6
6
  # @return [String] The version of discorb.
7
- VERSION = "0.13.2"
7
+ VERSION = "0.13.3"
8
8
  # @return [String] The user agent for the bot.
9
9
  USER_AGENT = "DiscordBot (https://discorb-lib.github.io #{VERSION}) Ruby/#{RUBY_VERSION}"
10
10
 
@@ -108,6 +108,35 @@ module Discorb
108
108
  end
109
109
  end
110
110
 
111
+ #
112
+ # Represents a `INTEGRATION_DELETE` event.
113
+ #
114
+ class IntegrationDeleteEvent < GatewayEvent
115
+ # @return [Discorb::Snowflake] The ID of the integration.
116
+ attr_reader :id
117
+ # @!attribute [r] guild
118
+ # @macro client_cache
119
+ # @return [Discorb::Guild] The guild of the integration.
120
+ # @!attribute [r] user
121
+ # @macro client_cache
122
+ # @return [Discorb::User] The user associated with the integration.
123
+
124
+ # @private
125
+ def initialize(client, data)
126
+ @id = Snowflake.new(data[:id])
127
+ @guild_id = data[:guild_id]
128
+ @user_id = data[:application_id]
129
+ end
130
+
131
+ def guild
132
+ @client.guilds[@guild_id]
133
+ end
134
+
135
+ def user
136
+ @client.users[@user_id]
137
+ end
138
+ end
139
+
111
140
  #
112
141
  # Represents a `MESSAGE_REACTION_REMOVE_ALL` event.
113
142
  #
@@ -866,9 +895,8 @@ module Discorb
866
895
  dispatch(:integration_update, integration)
867
896
  when "INTEGRATION_DELETE"
868
897
  return @log.warn "Unknown guild id #{data[:guild_id]}, ignoring" unless (guild = @guilds[data[:guild_id]])
869
- return @log.warn "Unknown integration id #{data[:id]}, ignoring" unless (integration = guild.integrations.delete(data[:id]))
870
898
 
871
- dispatch(:integration_delete, integration)
899
+ dispatch(:integration_delete, IntegrationDeleteEvent.new(self, data))
872
900
  when "WEBHOOKS_UPDATE"
873
901
  dispatch(:webhooks_update, WebhooksUpdateEvent.new(self, data))
874
902
  when "INVITE_CREATE"
@@ -49,7 +49,6 @@ module Discorb
49
49
  @data = data
50
50
  @guild_id = guild_id
51
51
  _set_data(data)
52
- guild.integrations[@id] = self unless no_cache
53
52
  end
54
53
 
55
54
  def guild
@@ -110,5 +109,35 @@ module Discorb
110
109
  @name = data[:name]
111
110
  end
112
111
  end
112
+
113
+ #
114
+ # Represents an application for an integration.
115
+ #
116
+ class Application < DiscordModel
117
+ # @return [Discorb::Snowflake] The ID of the application.
118
+ attr_reader :id
119
+ # @return [String] The name of the application.
120
+ attr_reader :name
121
+ # @return [Asset] The icon of the application.
122
+ # @return [nil] If the application has no icon.
123
+ attr_reader :icon
124
+ # @return [String] The description of the application.
125
+ attr_reader :description
126
+ # @return [String] The summary of the application.
127
+ attr_reader :summary
128
+ # @return [Discorb::User] The bot user associated with the application.
129
+ # @return [nil] If the application has no bot user.
130
+ attr_reader :bot
131
+
132
+ # @private
133
+ def initialize(client, data)
134
+ @id = Snowflake.new(data[:id])
135
+ @name = data[:name]
136
+ @icon = data[:icon] && Asset.new(self, data[:icon])
137
+ @description = data[:description]
138
+ @summary = data[:summary]
139
+ @bot = data[:bot] and client.users[data[:bot][:id]] || Discorb::User.new(client, data[:bot])
140
+ end
141
+ end
113
142
  end
114
143
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: discorb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.2
4
+ version: 0.13.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - sevenc-nanashi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-31 00:00:00.000000000 Z
11
+ date: 2022-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async
@@ -66,7 +66,16 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.3'
69
- description:
69
+ description: |+
70
+ == discorb
71
+ discorb is a Discord API wrapper for Ruby, Using {socketry/async}[https://github.com/socketry/async].
72
+
73
+ === Contributing
74
+ Bug reports, feature requests, and pull requests are welcome on {the GitHub repository}[https://github.com/discorb-lib/discorb].
75
+
76
+ === License
77
+ This gem is licensed under the MIT License.
78
+
70
79
  email:
71
80
  - sevenc-nanashi@sevenbot.jp
72
81
  executables:
@@ -224,5 +233,6 @@ requirements: []
224
233
  rubygems_version: 3.2.32
225
234
  signing_key:
226
235
  specification_version: 4
227
- summary: A discord API wrapper written in Ruby
236
+ summary: A Discord API wrapper for Ruby, Using socketry/async.
228
237
  test_files: []
238
+ ...