discorb 0.13.0 → 0.13.1

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.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build_main.yml +1 -0
  3. data/.github/workflows/build_version.yml +1 -0
  4. data/.github/workflows/crowdin.yml +32 -0
  5. data/.gitignore +3 -1
  6. data/.yardopts +2 -0
  7. data/Changelog.md +399 -388
  8. data/Gemfile +5 -1
  9. data/README.md +1 -1
  10. data/Rakefile +139 -9
  11. data/crowdin.yml +2 -0
  12. data/docs/Examples.md +2 -0
  13. data/docs/application_command.md +7 -5
  14. data/docs/cli/irb.md +2 -0
  15. data/docs/cli/new.md +2 -0
  16. data/docs/cli/run.md +3 -1
  17. data/docs/cli/setup.md +4 -2
  18. data/docs/cli.md +2 -0
  19. data/docs/events.md +6 -4
  20. data/docs/extension.md +2 -2
  21. data/docs/faq.md +4 -2
  22. data/docs/license.md +2 -0
  23. data/docs/tutorial.md +4 -3
  24. data/docs/voice_events.md +2 -0
  25. data/lib/discorb/app_command.rb +8 -7
  26. data/lib/discorb/application.rb +1 -1
  27. data/lib/discorb/channel.rb +100 -76
  28. data/lib/discorb/client.rb +13 -15
  29. data/lib/discorb/common.rb +3 -1
  30. data/lib/discorb/emoji.rb +5 -7
  31. data/lib/discorb/emoji_table.rb +3891 -3891
  32. data/lib/discorb/event.rb +8 -7
  33. data/lib/discorb/exe/show.rb +2 -0
  34. data/lib/discorb/extension.rb +1 -1
  35. data/lib/discorb/flag.rb +1 -1
  36. data/lib/discorb/gateway.rb +9 -13
  37. data/lib/discorb/guild.rb +63 -89
  38. data/lib/discorb/guild_template.rb +12 -9
  39. data/lib/discorb/http.rb +82 -44
  40. data/lib/discorb/integration.rb +3 -0
  41. data/lib/discorb/interaction/response.rb +27 -25
  42. data/lib/discorb/interaction/root.rb +8 -0
  43. data/lib/discorb/invite.rb +3 -2
  44. data/lib/discorb/member.rb +41 -12
  45. data/lib/discorb/message.rb +28 -17
  46. data/lib/discorb/modules.rb +19 -26
  47. data/lib/discorb/role.rb +15 -11
  48. data/lib/discorb/sticker.rb +8 -12
  49. data/lib/discorb/user.rb +7 -7
  50. data/lib/discorb/voice_state.rb +8 -5
  51. data/lib/discorb/webhook.rb +38 -47
  52. data/lib/discorb.rb +1 -1
  53. data/po/yard.pot +7772 -5154
  54. data/sig/discorb.rbs +3316 -3819
  55. data/template-replace/scripts/locale_ja.rb +62 -0
  56. metadata +5 -3
data/lib/discorb/event.rb CHANGED
@@ -90,8 +90,7 @@ module Discorb
90
90
 
91
91
  #
92
92
  # Create a scheduled event for the guild.
93
- # @macro async
94
- # @macro http
93
+ # @async
95
94
  #
96
95
  # @param [:stage_instance, :voice, :external] type The type of event to create.
97
96
  # @param [String] name The name of the event.
@@ -103,6 +102,8 @@ module Discorb
103
102
  # @param [:guild_only] privacy_level The privacy level of the event. This must be `:guild_only`.
104
103
  # @param [:active, :completed, :canceled] status The status of the event.
105
104
  #
105
+ # @return [Async::Task<Discorb::ScheduledEvent>] The event that was created.
106
+ #
106
107
  # @see Event#start
107
108
  # @see Event#cancel
108
109
  # @see Event#complete
@@ -194,8 +195,9 @@ module Discorb
194
195
 
195
196
  #
196
197
  # Deletes the event.
197
- # @macro async
198
- # @macro http
198
+ # @async
199
+ #
200
+ # @return [Async::Task<void>] The task.
199
201
  #
200
202
  def delete!
201
203
  Async do
@@ -207,8 +209,7 @@ module Discorb
207
209
 
208
210
  #
209
211
  # Fetches the event users.
210
- # @macro async
211
- # @macro http
212
+ # @async
212
213
  #
213
214
  # @note You can fetch all of members by not specifying a parameter.
214
215
  #
@@ -218,7 +219,7 @@ module Discorb
218
219
  # @param [Boolean] with_member Whether to include the member object of the event. Defaults to `false`.
219
220
  # This should be used for manual fetching of members.
220
221
  #
221
- # @return [Array<Discorb::Member>] The event users.
222
+ # @return [Async::Task<Array<Discorb::Member>>] The event users.
222
223
  #
223
224
  def fetch_users(limit = nil, before: nil, after: nil, with_member: true)
224
225
  Async do
@@ -2,7 +2,9 @@
2
2
 
3
3
  require "etc"
4
4
  require "discorb"
5
+
5
6
  puts "\e[90mRuby:\e[m #{RUBY_VERSION}"
6
7
  puts "\e[90mdiscorb:\e[m #{Discorb::VERSION}"
7
8
  uname = Etc.uname
8
9
  puts "\e[90mSystem:\e[m #{uname[:sysname]} #{uname[:release]}"
10
+ puts "\e[90mPlatform:\e[m #{RUBY_PLATFORM}"
@@ -4,7 +4,7 @@ module Discorb
4
4
  #
5
5
  # Abstract class to make extension.
6
6
  # Include from this module to make your own extension.
7
- # @see file:docs/extension.md
7
+ # @see file:docs/extension.md Extension
8
8
  # @abstract
9
9
  #
10
10
  module Extension
data/lib/discorb/flag.rb CHANGED
@@ -92,7 +92,7 @@ module Discorb
92
92
  #
93
93
  # @return [Discorb::Flag] The negation of the flag.
94
94
  #
95
- def ~@
95
+ def ~
96
96
  self.class.new(~@value)
97
97
  end
98
98
 
@@ -94,8 +94,7 @@ module Discorb
94
94
 
95
95
  # Fetch the message.
96
96
  # If message is cached, it will be returned.
97
- # @macro async
98
- # @macro http
97
+ # @async
99
98
  #
100
99
  # @param [Boolean] force Whether to force fetching the message.
101
100
  #
@@ -143,8 +142,7 @@ module Discorb
143
142
 
144
143
  # Fetch the message.
145
144
  # If message is cached, it will be returned.
146
- # @macro async
147
- # @macro http
145
+ # @async
148
146
  #
149
147
  # @param [Boolean] force Whether to force fetching the message.
150
148
  #
@@ -195,8 +193,7 @@ module Discorb
195
193
 
196
194
  # Fetch the message.
197
195
  # If message is cached, it will be returned.
198
- # @macro async
199
- # @macro http
196
+ # @async
200
197
  #
201
198
  # @param [Boolean] force Whether to force fetching the message.
202
199
  #
@@ -293,8 +290,7 @@ module Discorb
293
290
  end
294
291
 
295
292
  # Fetch the message.
296
- # @macro async
297
- # @macro http
293
+ # @async
298
294
  #
299
295
  # @return [Async::Task<Discorb::Message>] The message.
300
296
  def fetch_message
@@ -503,14 +499,14 @@ module Discorb
503
499
  module Handler
504
500
  private
505
501
 
506
- def connect_gateway(reconnect)
502
+ def connect_gateway(reconnect, no_close: false)
507
503
  if reconnect
508
504
  @log.info "Reconnecting to gateway..."
509
505
  else
510
506
  @log.info "Connecting to gateway..."
511
507
  end
512
508
  Async do
513
- @connection&.close
509
+ @connection&.close unless no_close
514
510
  @http = HTTP.new(self)
515
511
  _, gateway_response = @http.get("/gateway").wait
516
512
  gateway_url = gateway_response[:url]
@@ -537,9 +533,9 @@ module Discorb
537
533
  end
538
534
  end
539
535
  end
540
- rescue Async::Wrapper::Cancelled, OpenSSL::SSL::SSLError, Async::Wrapper::WaitError, EOFError => e
541
- @log.error "Gateway connection closed: #{e.class}: #{e.message}"
542
- connect_gateway(true)
536
+ rescue Async::Wrapper::Cancelled, OpenSSL::SSL::SSLError, Async::Wrapper::WaitError, EOFError, Errno::EPIPE => e
537
+ @log.error "Gateway connection closed accidentally: #{e.class}: #{e.message}"
538
+ connect_gateway(true, no_close: true)
543
539
  else # should never happen
544
540
  connect_gateway(true)
545
541
  end
data/lib/discorb/guild.rb CHANGED
@@ -28,7 +28,7 @@ module Discorb
28
28
  attr_reader :features
29
29
  # @return [:none, :elevated] The MFA level of the guild.
30
30
  attr_reader :mfa_level
31
- # @return [Discorb::Guild::SystemChannelFlag] The flag for the system channel.
31
+ # @return [Discorb::SystemChannelFlag] The flag for the system channel.
32
32
  attr_reader :system_channel_flags
33
33
  # @return [Time] Time that representing when bot has joined the guild.
34
34
  attr_reader :joined_at
@@ -162,8 +162,9 @@ module Discorb
162
162
 
163
163
  #
164
164
  # Leave the guild.
165
- # @macro async
166
- # @macro http
165
+ # @async
166
+ #
167
+ # @return [Async::Task<void>] The task.
167
168
  #
168
169
  def leave!
169
170
  Async do
@@ -174,8 +175,7 @@ module Discorb
174
175
 
175
176
  #
176
177
  # Fetch scheduled events for the guild.
177
- # @macro async
178
- # @macro http
178
+ # @async
179
179
  #
180
180
  # @param [Boolean] with_user_count Whether to include the user count in the events.
181
181
  # Defaults to `true`.
@@ -191,13 +191,12 @@ module Discorb
191
191
 
192
192
  #
193
193
  # Fetch the scheduled event by ID.
194
- # @macro async
195
- # @macro http
194
+ # @async
196
195
  #
197
196
  # @param [#to_s] id The ID of the scheduled event.
198
197
  #
199
- # @return [Discorb::ScheduledEvent] The event with the given ID.
200
- # @return [nil] If no event with the given ID exists.
198
+ # @return [Async::Task<Discorb::ScheduledEvent>] The event with the given ID.
199
+ # @return [Async::Task<nil>] If no event with the given ID exists.
201
200
  #
202
201
  def fetch_scheduled_event(id)
203
202
  Async do
@@ -211,6 +210,7 @@ module Discorb
211
210
 
212
211
  #
213
212
  # Create a scheduled event for the guild.
213
+ # @async
214
214
  #
215
215
  # @param [:stage_instance, :voice, :external] type The type of event to create.
216
216
  # @param [String] name The name of the event.
@@ -221,7 +221,7 @@ module Discorb
221
221
  # @param [String, nil] location The location of the event. Defaults to `nil`.
222
222
  # @param [:guild_only] privacy_level The privacy level of the event. This must be `:guild_only`.
223
223
  #
224
- # @return [Discorb::ScheduledEvent] The created event.
224
+ # @return [Async::Task<Discorb::ScheduledEvent>] The created event.
225
225
  #
226
226
  def create_scheduled_event(
227
227
  type,
@@ -281,8 +281,7 @@ module Discorb
281
281
 
282
282
  #
283
283
  # Fetch emoji list of the guild.
284
- # @macro async
285
- # @macro http
284
+ # @async
286
285
  # @note This querys the API every time. We recommend using {#emojis} instead.
287
286
  #
288
287
  # @return [Async::Task<Discorb::Dictionary{Discorb::Snowflake => Discorb::CustomEmoji}>] A dictionary of emoji in the guild.
@@ -305,8 +304,7 @@ module Discorb
305
304
 
306
305
  #
307
306
  # Fetch emoji id of the guild.
308
- # @macro async
309
- # @macro http
307
+ # @async
310
308
  # @note This querys the API every time. We recommend using {#emojis} instead.
311
309
  #
312
310
  # @param [#to_s] id The emoji id.
@@ -320,8 +318,7 @@ module Discorb
320
318
 
321
319
  #
322
320
  # Create a custom emoji.
323
- # @macro async
324
- # @macro http
321
+ # @async
325
322
  #
326
323
  # @param [#to_s] name The name of the emoji.
327
324
  # @param [Discorb::Image] image The image of the emoji.
@@ -343,8 +340,7 @@ module Discorb
343
340
 
344
341
  #
345
342
  # Fetch webhooks of the guild.
346
- # @macro async
347
- # @macro http
343
+ # @async
348
344
  #
349
345
  # @return [Async::Task<Array<Discorb::Webhook>>] A list of webhooks in the guild.
350
346
  #
@@ -357,8 +353,7 @@ module Discorb
357
353
 
358
354
  #
359
355
  # Fetch audit log of the guild.
360
- # @macro async
361
- # @macro http
356
+ # @async
362
357
  #
363
358
  # @return [Async::Task<Discorb::AuditLog>] The audit log of the guild.
364
359
  #
@@ -371,8 +366,7 @@ module Discorb
371
366
 
372
367
  #
373
368
  # Fetch channels of the guild.
374
- # @macro async
375
- # @macro http
369
+ # @async
376
370
  #
377
371
  # @return [Async::Task<Array<Discorb::Channel>>] A list of channels in the guild.
378
372
  #
@@ -385,8 +379,7 @@ module Discorb
385
379
 
386
380
  #
387
381
  # Create a new text channel.
388
- # @macro async
389
- # @macro http
382
+ # @async
390
383
  #
391
384
  # @param [String] name The name of the channel.
392
385
  # @param [String] topic The topic of the channel.
@@ -432,8 +425,7 @@ module Discorb
432
425
 
433
426
  #
434
427
  # Create a new voice channel.
435
- # @macro async
436
- # @macro http
428
+ # @async
437
429
  #
438
430
  # @param [String] name The name of the channel.
439
431
  # @param [Integer] bitrate The bitrate of the channel.
@@ -474,8 +466,7 @@ module Discorb
474
466
  end
475
467
 
476
468
  # Create a new category channel.
477
- # @macro async
478
- # @macro http
469
+ # @async
479
470
  #
480
471
  # @param [String] name The name of the channel.
481
472
  # @param [Integer] position The position of the channel.
@@ -512,8 +503,7 @@ module Discorb
512
503
 
513
504
  #
514
505
  # Create a new stage channel.
515
- # @macro async
516
- # @macro http
506
+ # @async
517
507
  #
518
508
  # @param [String] name The name of the channel.
519
509
  # @param [Integer] bitrate The bitrate of the channel.
@@ -550,8 +540,7 @@ module Discorb
550
540
 
551
541
  #
552
542
  # Create a new news channel.
553
- # @macro async
554
- # @macro http
543
+ # @async
555
544
  #
556
545
  # @param [String] name The name of the channel.
557
546
  # @param [String] topic The topic of the channel.
@@ -596,8 +585,7 @@ module Discorb
596
585
 
597
586
  #
598
587
  # Fetch a list of active threads in the guild.
599
- # @macro async
600
- # @macro http
588
+ # @async
601
589
  #
602
590
  # @return [Async::Task<Array<Discorb::ThreadChannel>>] The list of threads.
603
591
  #
@@ -610,8 +598,7 @@ module Discorb
610
598
 
611
599
  #
612
600
  # Fetch a member in the guild.
613
- # @macro async
614
- # @macro http
601
+ # @async
615
602
  #
616
603
  # @param [#to_s] id The ID of the member to fetch.
617
604
  #
@@ -629,8 +616,7 @@ module Discorb
629
616
  end
630
617
 
631
618
  # Fetch members in the guild.
632
- # @macro async
633
- # @macro http
619
+ # @async
634
620
  # @macro members_intent
635
621
  #
636
622
  # @param [Integer] limit The maximum number of members to fetch, 0 for all.
@@ -663,8 +649,7 @@ module Discorb
663
649
 
664
650
  #
665
651
  # Search for members by name in the guild.
666
- # @macro async
667
- # @macro http
652
+ # @async
668
653
  #
669
654
  # @param [String] name The name of the member to search for.
670
655
  # @param [Integer] limit The maximum number of members to return.
@@ -680,8 +665,7 @@ module Discorb
680
665
 
681
666
  #
682
667
  # Almost the same as {#fetch_members_named}, but returns a single member.
683
- # @macro async
684
- # @macro http
668
+ # @async
685
669
  #
686
670
  # @return [Async::Task<Discorb::Member>] The member.
687
671
  # @return [Async::Task<nil>] If the member is not found.
@@ -694,10 +678,13 @@ module Discorb
694
678
 
695
679
  #
696
680
  # Change nickname of client member.
681
+ # @async
697
682
  #
698
683
  # @param [String] nickname The nickname to set.
699
684
  # @param [String] reason The reason for changing the nickname.
700
685
  #
686
+ # @return [Async::Task<void>] The task.
687
+ #
701
688
  def edit_nickname(nickname, reason: nil)
702
689
  Async do
703
690
  @client.http.patch("/guilds/#{@id}/members/@me/nick", { nick: nickname }, audit_log_reason: reason).wait
@@ -710,12 +697,13 @@ module Discorb
710
697
 
711
698
  #
712
699
  # Kick a member from the guild.
713
- # @macro async
714
- # @macro http
700
+ # @async
715
701
  #
716
702
  # @param [Discorb::Member] member The member to kick.
717
703
  # @param [String] reason The reason for kicking the member.
718
704
  #
705
+ # @return [Async::Task<void>] The task.
706
+ #
719
707
  def kick_member(member, reason: nil)
720
708
  Async do
721
709
  @client.http.delete("/guilds/#{@id}/members/#{member.id}", audit_log_reason: reason).wait
@@ -724,8 +712,7 @@ module Discorb
724
712
 
725
713
  #
726
714
  # Fetch a list of bans in the guild.
727
- # @macro async
728
- # @macro http
715
+ # @async
729
716
  #
730
717
  # @return [Async::Task<Array<Discorb::Guild::Ban>>] The list of bans.
731
718
  #
@@ -738,8 +725,7 @@ module Discorb
738
725
 
739
726
  #
740
727
  # Fetch a ban in the guild.
741
- # @macro async
742
- # @macro http
728
+ # @async
743
729
  #
744
730
  # @param [Discorb::User] user The user to fetch.
745
731
  #
@@ -758,8 +744,7 @@ module Discorb
758
744
 
759
745
  #
760
746
  # Checks the user was banned from the guild.
761
- # @macro async
762
- # @macro http
747
+ # @async
763
748
  #
764
749
  # @param [Discorb::User] user The user to check.
765
750
  #
@@ -773,8 +758,7 @@ module Discorb
773
758
 
774
759
  #
775
760
  # Ban a member from the guild.
776
- # @macro async
777
- # @macro http
761
+ # @async
778
762
  #
779
763
  # @param [Discorb::Member] member The member to ban.
780
764
  # @param [Integer] delete_message_days The number of days to delete messages.
@@ -793,12 +777,13 @@ module Discorb
793
777
 
794
778
  #
795
779
  # Unban a user from the guild.
796
- # @macro async
797
- # @macro http
780
+ # @async
798
781
  #
799
782
  # @param [Discorb::User] user The user to unban.
800
783
  # @param [String] reason The reason for unbanning the user.
801
784
  #
785
+ # @return [Async::Task<void>] The task.
786
+ #
802
787
  def unban_user(user, reason: nil)
803
788
  Async do
804
789
  @client.http.delete("/guilds/#{@id}/bans/#{user.id}", audit_log_reason: reason).wait
@@ -807,8 +792,7 @@ module Discorb
807
792
 
808
793
  #
809
794
  # Fetch a list of roles in the guild.
810
- # @macro async
811
- # @macro http
795
+ # @async
812
796
  #
813
797
  # @return [Async::Task<Array<Discorb::Role>>] The list of roles.
814
798
  #
@@ -821,8 +805,7 @@ module Discorb
821
805
 
822
806
  #
823
807
  # Create a role in the guild.
824
- # @macro async
825
- # @macro http
808
+ # @async
826
809
  #
827
810
  # @param [String] name The name of the role.
828
811
  # @param [Discorb::Color] color The color of the role.
@@ -848,8 +831,7 @@ module Discorb
848
831
 
849
832
  #
850
833
  # Fetch how many members will be pruned.
851
- # @macro async
852
- # @macro http
834
+ # @async
853
835
  #
854
836
  # @param [Integer] days The number of days to prune.
855
837
  # @param [Array<Discorb::Role>] roles The roles that include for pruning.
@@ -870,8 +852,7 @@ module Discorb
870
852
 
871
853
  #
872
854
  # Prune members from the guild.
873
- # @macro async
874
- # @macro http
855
+ # @async
875
856
  #
876
857
  # @param [Integer] days The number of days to prune.
877
858
  # @param [Array<Discorb::Role>] roles The roles that include for pruning.
@@ -890,8 +871,7 @@ module Discorb
890
871
 
891
872
  #
892
873
  # Fetch voice regions that are available in the guild.
893
- # @macro async
894
- # @macro http
874
+ # @async
895
875
  #
896
876
  # @return [Async::Task<Array<Discorb::VoiceRegion>>] The available voice regions.
897
877
  #
@@ -904,8 +884,7 @@ module Discorb
904
884
 
905
885
  #
906
886
  # Fetch invites in the guild.
907
- # @macro async
908
- # @macro http
887
+ # @async
909
888
  #
910
889
  # @return [Async::Task<Array<Invite>>] The invites.
911
890
  #
@@ -918,8 +897,7 @@ module Discorb
918
897
 
919
898
  #
920
899
  # Fetch integrations in the guild.
921
- # @macro async
922
- # @macro http
900
+ # @async
923
901
  #
924
902
  # @return [Async::Task<Array<Discorb::Integration>>] The integrations.
925
903
  #
@@ -932,8 +910,7 @@ module Discorb
932
910
 
933
911
  #
934
912
  # Fetch the widget of the guild.
935
- # @macro async
936
- # @macro http
913
+ # @async
937
914
  #
938
915
  # @return [Async::Task<Discorb::Guild::Widget>] The widget.
939
916
  #
@@ -946,8 +923,7 @@ module Discorb
946
923
 
947
924
  #
948
925
  # Fetch the vanity URL of the guild.
949
- # @macro async
950
- # @macro http
926
+ # @async
951
927
  #
952
928
  # @return [Async::Task<Discorb::Guild::VanityInvite>] The vanity URL.
953
929
  #
@@ -960,10 +936,9 @@ module Discorb
960
936
 
961
937
  #
962
938
  # Fetch the welcome screen of the guild.
963
- # @macro async
964
- # @macro http
939
+ # @async
965
940
  #
966
- # @return [Async::Task<Discorb::Guild::WelcomeScreen>] The welcome screen.
941
+ # @return [Async::Task<Discorb::WelcomeScreen>] The welcome screen.
967
942
  #
968
943
  def fetch_welcome_screen
969
944
  Async do
@@ -974,8 +949,7 @@ module Discorb
974
949
 
975
950
  #
976
951
  # Fetch stickers in the guild.
977
- # @macro async
978
- # @macro http
952
+ # @async
979
953
  #
980
954
  # @return [Async::Task<Array<Discorb::Sticker::GuildSticker>>] The stickers.
981
955
  #
@@ -988,8 +962,7 @@ module Discorb
988
962
 
989
963
  #
990
964
  # Fetch the sticker by ID.
991
- # @macro async
992
- # @macro http
965
+ # @async
993
966
  #
994
967
  # @param [#to_s] id The ID of the sticker.
995
968
  #
@@ -1008,8 +981,7 @@ module Discorb
1008
981
 
1009
982
  #
1010
983
  # Fetch templates in the guild.
1011
- # @macro async
1012
- # @macro http
984
+ # @async
1013
985
  #
1014
986
  # @return [Async::Task<Discorb::GuildTemplate>] The templates.
1015
987
  #
@@ -1111,14 +1083,15 @@ module Discorb
1111
1083
 
1112
1084
  #
1113
1085
  # Edit the widget.
1114
- # @macro async
1115
- # @macro http
1086
+ # @async
1116
1087
  # @macro edit
1117
1088
  #
1118
1089
  # @param [Boolean] enabled Whether the widget is enabled.
1119
1090
  # @param [Discorb::GuildChannel] channel The channel.
1120
1091
  # @param [String] reason The reason for editing the widget.
1121
1092
  #
1093
+ # @return [Async::Task<void>] The task.
1094
+ #
1122
1095
  def edit(enabled: nil, channel: nil, reason: nil)
1123
1096
  Async do
1124
1097
  payload = {}
@@ -1366,8 +1339,7 @@ module Discorb
1366
1339
 
1367
1340
  #
1368
1341
  # Edits the welcome screen.
1369
- # @macro async
1370
- # @macro http
1342
+ # @async
1371
1343
  # @macro edit
1372
1344
  #
1373
1345
  # @param [Boolean] enabled Whether the welcome screen is enabled.
@@ -1375,12 +1347,14 @@ module Discorb
1375
1347
  # @param [String] description The description of the welcome screen.
1376
1348
  # @param [String] reason The reason for editing the welcome screen.
1377
1349
  #
1378
- def edit(enabled: :unset, channels: :unset, description: :unset, reason: nil)
1350
+ # @return [Async::Task<void>] The task.
1351
+ #
1352
+ def edit(enabled: Discorb::Unset, channels: Discorb::Unset, description: Discorb::Unset, reason: nil)
1379
1353
  Async do
1380
1354
  payload = {}
1381
- payload[:enabled] = enabled unless enabled == :unset
1382
- payload[:welcome_channels] = channels.map(&:to_hash) unless channels == :unset
1383
- payload[:description] = description unless description == :unset
1355
+ payload[:enabled] = enabled unless enabled == Discorb::Unset
1356
+ payload[:welcome_channels] = channels.map(&:to_hash) unless channels == Discorb::Unset
1357
+ payload[:description] = description unless description == Discorb::Unset
1384
1358
  @client.http.patch("/guilds/#{@guild.id}/welcome-screen", payload, audit_log_reason: reason).wait
1385
1359
  end
1386
1360
  end
@@ -45,18 +45,19 @@ module Discorb
45
45
 
46
46
  #
47
47
  # Edit the template.
48
- # @macro async
49
- # @macro http
48
+ # @async
50
49
  # @macro edit
51
50
  #
52
51
  # @param [String] name The new name of the template.
53
52
  # @param [String] description The new description of the template.
54
53
  #
55
- def edit(name = nil, description = :unset)
54
+ # @return [Async::Task<void>] The task.
55
+ #
56
+ def edit(name = nil, description = Discorb::Unset)
56
57
  Async do
57
58
  payload = {}
58
59
  payload[:name] = name if name
59
- payload[:description] = description if description != :unset
60
+ payload[:description] = description if description != Discorb::Unset
60
61
  @client.http.patch("/guilds/#{@source_guild_id}/templates/#{@code}", payload).wait
61
62
  end
62
63
  end
@@ -65,8 +66,9 @@ module Discorb
65
66
 
66
67
  #
67
68
  # Update the template.
68
- # @macro async
69
- # @macro http
69
+ # @async
70
+ #
71
+ # @return [Async::Task<void>] The task.
70
72
  #
71
73
  def update
72
74
  Async do
@@ -77,8 +79,9 @@ module Discorb
77
79
 
78
80
  #
79
81
  # Delete the template.
80
- # @macro async
81
- # @macro http
82
+ # @async
83
+ #
84
+ # @return [Async::Task<void>] The task.
82
85
  #
83
86
  def delete!
84
87
  Async do
@@ -98,7 +101,7 @@ module Discorb
98
101
  attr_reader :afk_timeout
99
102
  # @return [Discorb::Dictionary{Discorb::Snowflake => Discorb::Role}] A dictionary of roles in the guild.
100
103
  attr_reader :roles
101
- # @return [Discorb::Guild::SystemChannelFlag] The flag for the system channel.
104
+ # @return [Discorb::SystemChannelFlag] The flag for the system channel.
102
105
  attr_reader :system_channel_flags
103
106
  # @return [Discorb::Dictionary{Discorb::Snowflake => Discorb::GuildChannel}] A dictionary of channels in the guild.
104
107
  attr_reader :channels