discorb 0.13.1 → 0.13.2

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: 2ab7661480ef3de4adbdd46bb59617cb37db17f991f88b263512abe3550e6982
4
- data.tar.gz: c7e92a338b7a71c1b8163aa1a3f801c9256ba72f48a56f42fa481f0c75497793
3
+ metadata.gz: 3ae808ab0fb5c588da2f4b3e895dab373429853b8de022a7a69c3ed7e3c93c30
4
+ data.tar.gz: 7f81fb48031fe5945264669a8f5535c1d11917cc846484f2289b3d5f23a7e3a2
5
5
  SHA512:
6
- metadata.gz: 6b61672c6acc2048420b3f19688a6e72ee1069feb84b7938074cbc2fc39bc9409734d72895317a1b9af1095cc72c138ef0da61ff2b08bcbb05509f239133fd2f
7
- data.tar.gz: 66c1bc5804c7e4646fc9cd1ad9fe8e089e311f42a7251b4b4ff398217fcb25b6d7aa9f7166e35067b9bfecb94cd52b2e66585cede7a3d136cd38ef38232a793d
6
+ metadata.gz: 84dd57449819f7ac91a5ee441f659ad76a4687640751fcda54bc10a588ebedf3ced335e19d295c90a4011ecd0a9a56a3b1b66f003109d54e64ee3769a98c28c3
7
+ data.tar.gz: 948820d9e4b77eafdeee77c559e99380863ec400f6d0d0156f921aeb503090d809d55cfa8ee28d7a394d7db444a4081e8c0c832919f481b1f21be1d26f3832b5
@@ -21,8 +21,8 @@ jobs:
21
21
  bundler-cache: true
22
22
  - name: Set up git settings
23
23
  run: |
24
- git config --global user.email "action@github.com"
25
- git config --global user.name "GitHub Action"
24
+ git config --global user.email "actions@github.com"
25
+ git config --global user.name "GitHub Actions"
26
26
  - name: Clone pages
27
27
  env:
28
28
  SSH_SECRET: ${{ secrets.SSH }}
@@ -33,7 +33,7 @@ jobs:
33
33
  git clone git@github.com:discorb-lib/discorb-lib.github.io /tmp/pages
34
34
  - name: Install dependencies
35
35
  run: |
36
- bundle config --local with 'docs'
36
+ bundle config --local with 'docs development'
37
37
  bundle install
38
38
  gem update uri
39
39
  - name: Generate document
data/Changelog.md CHANGED
@@ -6,6 +6,14 @@
6
6
 
7
7
  ## v0.13
8
8
 
9
+ ### v0.13.2
10
+
11
+ - Fix: Fix MESSAGE_DELETE_BULK event
12
+ - Fix: Delete VoiceState from `Guild#voice_states` when member leaves
13
+ - Add: Add `VoiceChannel#members`, `VoiceChannel#voice_states`
14
+ - Add: Add `StageChannel#members`, `StageChannel#voice_states`, `StageChannel#audiences`, `StageChannel#speakers`
15
+ - Fix: Ignore errors on closing websocket
16
+
9
17
  ### v0.13.1
10
18
 
11
19
  - Add: `Discorb::Integration#locale`, `Discorb::Integration#guild_locale`
data/Rakefile CHANGED
@@ -158,22 +158,22 @@ namespace :document do
158
158
  iputs "Building all versions"
159
159
  FileUtils.rm_rf("doc") rescue nil
160
160
  FileUtils.cp_r("./template-replace/.", "./tmp-template-replace")
161
- Rake::Task["document:yard"].invoke
162
- Rake::Task["document:replace:html"].invoke
163
- Rake::Task["document:replace:css"].invoke
164
- Rake::Task["document:replace:eol"].invoke
165
- Rake::Task["document:replace:locale"].invoke
161
+ Rake::Task["document:yard"].execute
162
+ Rake::Task["document:replace:html"].execute
163
+ Rake::Task["document:replace:css"].execute
164
+ Rake::Task["document:replace:eol"].execute
165
+ Rake::Task["document:replace:locale"].execute
166
166
  tags = `git tag`.force_encoding("utf-8").split("\n").sort_by { |t| t[1..].split(".").map(&:to_i) }
167
167
  tags.each do |tag|
168
168
  sh "git checkout #{tag} -f"
169
169
  iputs "Building #{tag}"
170
170
  FileUtils.cp_r("./tmp-template-replace/.", "./template-replace")
171
171
  version = tag.delete_prefix("v")
172
- Rake::Task["document:yard"].invoke
173
- Rake::Task["document:replace:html"].invoke
174
- Rake::Task["document:replace:css"].invoke
175
- Rake::Task["document:replace:eol"].invoke
176
- Rake::Task["document:replace:locale"].invoke
172
+ Rake::Task["document:yard"].execute
173
+ Rake::Task["document:replace:html"].execute
174
+ Rake::Task["document:replace:css"].execute
175
+ Rake::Task["document:replace:eol"].execute
176
+ Rake::Task["document:replace:locale"].execute
177
177
  FileUtils.cp_r("./doc/.", "./tmp-doc")
178
178
  FileUtils.rm_rf("doc")
179
179
  end
@@ -216,12 +216,12 @@ namespace :document do
216
216
  end
217
217
  end
218
218
  ENV["rake_locale"] = "ja"
219
- Rake::Task["document:yard"].invoke
220
- Rake::Task["document:replace"].invoke
219
+ Rake::Task["document:yard"].execute
220
+ Rake::Task["document:replace"].execute
221
221
  end
222
222
 
223
223
  task :en do
224
- Rake::Task["document"].invoke("locale:en")
224
+ Rake::Task["document"].execute("locale:en")
225
225
  end
226
226
  end
227
227
  end
@@ -603,6 +603,11 @@ module Discorb
603
603
  # @return [nil] If the user limit is not set.
604
604
  attr_reader :user_limit
605
605
 
606
+ # @!attribute [r] members
607
+ # @return [Array<Discorb::Member>] The members in the voice channel.
608
+ # @!attribute [r] voice_states
609
+ # @return [Array<Discorb::VoiceState>] The voice states associated with the voice channel.
610
+
606
611
  include Connectable
607
612
 
608
613
  @channel_type = 2
@@ -636,6 +641,14 @@ module Discorb
636
641
 
637
642
  alias modify edit
638
643
 
644
+ def voice_states
645
+ guild.voice_states.select { |state| state.channel&.id == @id }
646
+ end
647
+
648
+ def members
649
+ voice_states.map(&:member)
650
+ end
651
+
639
652
  private
640
653
 
641
654
  def _set_data(data)
@@ -735,6 +748,22 @@ module Discorb
735
748
  end
736
749
  end
737
750
 
751
+ def voice_states
752
+ guild.voice_states.select { |state| state.channel&.id == @id }
753
+ end
754
+
755
+ def members
756
+ voice_states.map(&:member)
757
+ end
758
+
759
+ def speakers
760
+ voice_states.filter { |state| !state.suppress? }.map(&:member)
761
+ end
762
+
763
+ def audiences
764
+ voice_states.filter { |state| state.suppress? }.map(&:member)
765
+ end
766
+
738
767
  private
739
768
 
740
769
  def _set_data(data)
@@ -795,7 +824,6 @@ module Discorb
795
824
  # @macro members_intent
796
825
  # @return [Discorb::Member] The owner of the thread.
797
826
 
798
-
799
827
  include Messageable
800
828
  @channel_type = nil
801
829
 
@@ -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.1"
7
+ VERSION = "0.13.2"
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
 
@@ -506,7 +506,7 @@ module Discorb
506
506
  @log.info "Connecting to gateway..."
507
507
  end
508
508
  Async do
509
- @connection&.close unless no_close
509
+ @connection&.close rescue nil unless no_close
510
510
  @http = HTTP.new(self)
511
511
  _, gateway_response = @http.get("/gateway").wait
512
512
  gateway_url = gateway_response[:url]
@@ -884,6 +884,7 @@ module Discorb
884
884
  current = VoiceState.new(self, data)
885
885
  guild.voice_states[data[:user_id]] = current
886
886
  else
887
+ guild.voice_states.remove(data[:user_id]) if data[:channel_id].nil?
887
888
  old = VoiceState.new(self, current.instance_variable_get(:@data))
888
889
  current.send(:_set_data, data)
889
890
  end
@@ -1007,7 +1008,7 @@ module Discorb
1007
1008
  message.instance_variable_set(:@deleted, true)
1008
1009
  messages.push(message)
1009
1010
  else
1010
- messages.push(UnknownDeleteBulkMessage.new(self, id))
1011
+ messages.push(UnknownDeleteBulkMessage.new(self, id, data))
1011
1012
  end
1012
1013
  end
1013
1014
  dispatch(:message_delete_bulk, messages)
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.1
4
+ version: 0.13.2
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-28 00:00:00.000000000 Z
11
+ date: 2021-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async