discorb 0.5.4 → 0.6.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.
data/lib/discorb/error.rb CHANGED
@@ -67,6 +67,12 @@ module Discorb
67
67
  end
68
68
  end
69
69
 
70
+ #
71
+ # Represents a 401 error.
72
+ #
73
+ class UnauthorizedError < HTTPError
74
+ end
75
+
70
76
  #
71
77
  # Represents a 403 error.
72
78
  #
@@ -88,7 +94,7 @@ module Discorb
88
94
  @client.close!
89
95
  DiscorbError.instance_method(:initialize).bind(self).call(<<~MESSAGE)
90
96
  The client is banned from CloudFlare.
91
- Hint: Try to increase the number of requests per second, e.g. Use sleep in between requests.
97
+ Hint: Try to decrease the number of requests per second, e.g. Use sleep in between requests.
92
98
  MESSAGE
93
99
  end
94
100
  end
data/lib/discorb/event.rb CHANGED
@@ -11,17 +11,17 @@ module Discorb
11
11
  attr_reader :block
12
12
  # @return [Symbol] the event id.
13
13
  attr_reader :id
14
- # @return [Hash] the event discriminator.
15
- attr_reader :discriminator
14
+ # @return [Hash] the event metadata.
15
+ attr_reader :metadata
16
16
  # @return [Boolean] whether the event is once or not.
17
17
  attr_reader :once
18
18
  alias once? once
19
19
 
20
- def initialize(block, id, discriminator)
20
+ def initialize(block, id, metadata)
21
21
  @block = block
22
22
  @id = id
23
- @once = discriminator.fetch(:once, false)
24
- @discriminator = discriminator
23
+ @once = metadata.fetch(:once, false)
24
+ @metadata = metadata
25
25
  @rescue = nil
26
26
  end
27
27
 
@@ -171,10 +171,10 @@ if (dir = ARGV[0])
171
171
  $path += "/#{dir}"
172
172
  if Dir.exist?($path)
173
173
  if Dir.empty?($path)
174
- gputs "Found \e[30m#{dir}\e[90m and empty, using this directory."
174
+ iputs "Found \e[30m#{dir}\e[90m and empty, using this directory."
175
175
  else
176
176
  if $values[:force]
177
- gputs "Found \e[30m#{dir}\e[90m and not empty, but force is on, using this directory."
177
+ iputs "Found \e[30m#{dir}\e[90m and not empty, but force is on, using this directory."
178
178
  else
179
179
  eputs "Directory \e[31m#{dir}\e[91m already exists and not empty. Use \e[31m-f\e[91m to force."
180
180
  exit
@@ -182,7 +182,7 @@ if (dir = ARGV[0])
182
182
  end
183
183
  else
184
184
  Dir.mkdir($path)
185
- gputs "Couldn't find \e[30m#{dir}\e[90m, created directory."
185
+ iputs "Couldn't find \e[30m#{dir}\e[90m, created directory."
186
186
  end
187
187
  Dir.chdir($path)
188
188
  end
@@ -2,6 +2,7 @@
2
2
  require "optparse"
3
3
  require "json"
4
4
  require "discorb/utils/colored_puts"
5
+ require "io/console"
5
6
 
6
7
  ARGV.delete_at 0
7
8
  # @!visibility private
@@ -20,6 +21,7 @@ options = {
20
21
  log_file: nil,
21
22
  log_color: nil,
22
23
  setup: nil,
24
+ token: false,
23
25
  }
24
26
  opt.on("-d", "--deamon", "Run as a daemon.") { |v| options[:daemon] = v }
25
27
  opt.on("-l", "--log-level LEVEL", "Log level.") do |v|
@@ -33,6 +35,7 @@ end
33
35
  opt.on("-f", "--log-file FILE", "File to write log to.") { |v| options[:log_file] = v }
34
36
  opt.on("-c", "--[no-]log-color", "Whether to colorize log output.") { |v| options[:log_color] = v }
35
37
  opt.on("-s", "--setup", "Whether to setup application commands.") { |v| options[:setup] = v }
38
+ opt.on("-t", "--token [ENV]", "The name of the environment variable to use for token, or just `-t` or `--token` for intractive prompt.") { |v| options[:token] = v }
36
39
  opt.parse!(ARGV)
37
40
 
38
41
  script = ARGV[0]
@@ -42,6 +45,15 @@ script ||= "main.rb"
42
45
  ENV["DISCORB_CLI_FLAG"] = "run"
43
46
  ENV["DISCORB_CLI_OPTIONS"] = JSON.generate(options)
44
47
 
48
+ if options[:token]
49
+ ENV["DISCORB_CLI_TOKEN"] = ENV[options[:token]]
50
+ raise "#{options[:token]} is not set." if ENV["DISCORB_CLI_TOKEN"].nil?
51
+ elsif options[:token].nil? || options[:token] == "-"
52
+ print "\e[90mPlease enter your token: \e[m"
53
+ ENV["DISCORB_CLI_TOKEN"] = $stdin.noecho(&:gets).chomp
54
+ puts ""
55
+ end
56
+
45
57
  begin
46
58
  load script
47
59
  rescue LoadError
@@ -4,19 +4,32 @@ require "discorb/utils/colored_puts"
4
4
 
5
5
  ARGV.delete_at 0
6
6
 
7
+ options = {
8
+ guilds: nil,
9
+ }
10
+
7
11
  opt = OptionParser.new <<~BANNER
8
12
  This command will setup application commands.
9
13
 
10
- Usage: discorb setup [script]
14
+ Usage: discorb setup [options] [script]
11
15
 
12
16
  script The script to setup.
13
17
  BANNER
18
+ opt.on("-g", "--guild ID", Array, "The guild ID to setup, use comma for setup commands in multiple guilds, or `global` for setup global commands.") { |v| options[:guilds] = v }
14
19
  opt.parse!(ARGV)
15
20
 
16
21
  script = ARGV[0]
17
22
  script ||= "main.rb"
18
23
  ENV["DISCORB_CLI_FLAG"] = "setup"
19
24
 
25
+ if options[:guilds] == ["global"]
26
+ ENV["DISCORB_SETUP_GUILDS"] = "global"
27
+ elsif options[:guilds]
28
+ ENV["DISCORB_SETUP_GUILDS"] = options[:guilds].join(",")
29
+ else
30
+ ENV["DISCORB_SETUP_GUILDS"] = nil
31
+ end
32
+
20
33
  begin
21
34
  load script
22
35
  rescue LoadError
@@ -8,7 +8,7 @@ module Discorb
8
8
  # @abstract
9
9
  #
10
10
  module Extension
11
- include Discorb::Command::Handler
11
+ include Discorb::ApplicationCommand::Handler
12
12
  undef setup_commands
13
13
 
14
14
  @events = {}
@@ -19,18 +19,18 @@ module Discorb
19
19
  #
20
20
  # @param [Symbol] event_name The name of the event.
21
21
  # @param [Symbol] id The id of the event. Used to delete the event.
22
- # @param [Hash] discriminator Other discriminators.
22
+ # @param [Hash] metadata Other metadata.
23
23
  # @param [Proc] block The block to execute when the event is triggered.
24
24
  #
25
25
  # @return [Discorb::Event] The event.
26
26
  #
27
- def event(event_name, id: nil, **discriminator, &block)
27
+ def event(event_name, id: nil, **metadata, &block)
28
28
  raise ArgumentError, "Event name must be a symbol" unless event_name.is_a?(Symbol)
29
29
  raise ArgumentError, "block must be a Proc" unless block.is_a?(Proc)
30
30
 
31
31
  @events[event_name] ||= []
32
- discriminator[:extension] = self.name
33
- @events[event_name] << Discorb::Event.new(block, id, discriminator)
32
+ metadata[:extension] = self.name
33
+ @events[event_name] << Discorb::Event.new(block, id, metadata)
34
34
  end
35
35
 
36
36
  #
@@ -38,18 +38,18 @@ module Discorb
38
38
  #
39
39
  # @param [Symbol] event_name The name of the event.
40
40
  # @param [Symbol] id The id of the event. Used to delete the event.
41
- # @param [Hash] discriminator Other discriminators.
41
+ # @param [Hash] metadata Other metadata.
42
42
  # @param [Proc] block The block to execute when the event is triggered.
43
43
  #
44
44
  # @return [Discorb::Event] The event.
45
45
  #
46
- def once_event(event_name, id: nil, **discriminator, &block)
47
- event(event_name, id: id, once: true, **discriminator, &block)
46
+ def once_event(event_name, id: nil, **metadata, &block)
47
+ event(event_name, id: id, once: true, **metadata, &block)
48
48
  end
49
49
 
50
50
  # @return [Hash{Symbol => Array<Discorb::Event>}] The events of the extension.
51
51
  attr_reader :events
52
- # @return [Array<Discorb::Command::Command] The commands of the extension.
52
+ # @return [Array<Discorb::ApplicationCommand::Command>] The commands of the extension.
53
53
  attr_reader :commands
54
54
  # @private
55
55
  attr_reader :bottom_commands
@@ -90,7 +90,7 @@ module Discorb
90
90
  #
91
91
  # @param [Boolean] force Whether to force fetching the message.
92
92
  #
93
- # @return [Discorb::Message] The message.
93
+ # @return [Async::Task<Discorb::Message>] The message.
94
94
  def fetch_message(force: false)
95
95
  Async do
96
96
  next @message if !force && @message
@@ -139,7 +139,7 @@ module Discorb
139
139
  #
140
140
  # @param [Boolean] force Whether to force fetching the message.
141
141
  #
142
- # @return [Discorb::Message] The message.
142
+ # @return [Async::Task<Discorb::Message>] The message.
143
143
  def fetch_message(force: false)
144
144
  Async do
145
145
  next @message if !force && @message
@@ -191,7 +191,7 @@ module Discorb
191
191
  #
192
192
  # @param [Boolean] force Whether to force fetching the message.
193
193
  #
194
- # @return [Discorb::Message] The message.
194
+ # @return [Async::Task<Discorb::Message>] The message.
195
195
  def fetch_message(force: false)
196
196
  Async do
197
197
  next @message if !force && @message
@@ -265,7 +265,7 @@ module Discorb
265
265
  # @macro async
266
266
  # @macro http
267
267
  #
268
- # @return [Discorb::Message] The message.
268
+ # @return [Async::Task<Discorb::Message>] The message.
269
269
  def fetch_message
270
270
  Async do
271
271
  channel.fetch_message(@id).wait
@@ -513,7 +513,6 @@ module Discorb
513
513
  case payload[:op]
514
514
  when 10
515
515
  @heartbeat_interval = data[:heartbeat_interval]
516
- @tasks << handle_heartbeat(@heartbeat_interval)
517
516
  if @first
518
517
  payload = {
519
518
  token: @token,
@@ -523,6 +522,13 @@ module Discorb
523
522
  }
524
523
  payload[:presence] = @identify_presence if @identify_presence
525
524
  send_gateway(2, **payload)
525
+ Async do
526
+ sleep 2
527
+ next unless @uncached_guilds.nil?
528
+
529
+ raise ClientError, "Failed to connect to gateway.\nHint: This usually means that your intents are invalid."
530
+ exit 1
531
+ end
526
532
  else
527
533
  payload = {
528
534
  token: @token,
@@ -540,7 +546,7 @@ module Discorb
540
546
  connect_gateway(false)
541
547
  else
542
548
  @log.info "Connection is not resumable, reconnecting with opcode 2"
543
- task.sleep(2)
549
+ sleep(2)
544
550
  @connection.close
545
551
  connect_gateway(true)
546
552
  end
@@ -555,7 +561,7 @@ module Discorb
555
561
 
556
562
  def handle_heartbeat(interval)
557
563
  Async do |task|
558
- task.sleep((interval / 1000.0 - 1) * rand)
564
+ sleep((interval / 1000.0 - 1) * rand)
559
565
  loop do
560
566
  @heartbeat_before = Time.now.to_f
561
567
  @connection.write({ op: 1, d: @last_s }.to_json)
@@ -578,6 +584,12 @@ module Discorb
578
584
  @session_id = data[:session_id]
579
585
  @user = ClientUser.new(self, data[:user])
580
586
  @uncached_guilds = data[:guilds].map { |g| g[:id] }
587
+ if @uncached_guilds == []
588
+ @ready = true
589
+ dispatch(:ready)
590
+ @log.info("Guilds were cached")
591
+ end
592
+ @tasks << handle_heartbeat(@heartbeat_interval)
581
593
  when "GUILD_CREATE"
582
594
  if @uncached_guilds.include?(data[:id])
583
595
  Guild.new(self, data, true)
data/lib/discorb/guild.rb CHANGED
@@ -175,7 +175,7 @@ module Discorb
175
175
  # @macro http
176
176
  # @note This querys the API every time. We recommend using {#emojis} instead.
177
177
  #
178
- # @return [Discorb::Dictionary{Discorb::Snowflake => Discorb::CustomEmoji}] A dictionary of emoji in the guild.
178
+ # @return [Async::Task<Discorb::Dictionary{Discorb::Snowflake => Discorb::CustomEmoji}>] A dictionary of emoji in the guild.
179
179
  #
180
180
  def fetch_emoji_list
181
181
  Async do
@@ -201,7 +201,7 @@ module Discorb
201
201
  #
202
202
  # @param [#to_s] id The emoji id.
203
203
  #
204
- # @return [Discorb::CustomEmoji] The emoji with the given id.
204
+ # @return [Async::Task<Discorb::CustomEmoji>] The emoji with the given id.
205
205
  #
206
206
  def fetch_emoji(id)
207
207
  _resp, data = @client.http.get("/guilds/#{@id}/emojis/#{id}").wait
@@ -217,7 +217,7 @@ module Discorb
217
217
  # @param [Discorb::Image] image The image of the emoji.
218
218
  # @param [Array<Discorb::Role>] roles A list of roles to give the emoji.
219
219
  #
220
- # @return [Discorb::CustomEmoji] The created emoji.
220
+ # @return [Async::Task<Discorb::CustomEmoji>] The created emoji.
221
221
  #
222
222
  def create_emoji(name, image, roles: [])
223
223
  _resp, data = @client.http.post(
@@ -236,7 +236,7 @@ module Discorb
236
236
  # @macro async
237
237
  # @macro http
238
238
  #
239
- # @return [Array<Discorb::Webhook>] A list of webhooks in the guild.
239
+ # @return [Async::Task<Array<Discorb::Webhook>>] A list of webhooks in the guild.
240
240
  #
241
241
  def fetch_webhooks
242
242
  Async do
@@ -250,7 +250,7 @@ module Discorb
250
250
  # @macro async
251
251
  # @macro http
252
252
  #
253
- # @return [Discorb::AuditLog] The audit log of the guild.
253
+ # @return [Async::Task<Discorb::AuditLog>] The audit log of the guild.
254
254
  #
255
255
  def fetch_audit_log
256
256
  Async do
@@ -264,7 +264,7 @@ module Discorb
264
264
  # @macro async
265
265
  # @macro http
266
266
  #
267
- # @return [Array<Discorb::Channel>] A list of channels in the guild.
267
+ # @return [Async::Task<Array<Discorb::Channel>>] A list of channels in the guild.
268
268
  #
269
269
  def fetch_channels
270
270
  Async do
@@ -288,7 +288,7 @@ module Discorb
288
288
  # @param [Discorb::CategoryChannel] parent The parent of the channel.
289
289
  # @param [String] reason The reason for creating the channel.
290
290
  #
291
- # @return [Discorb::TextChannel] The created text channel.
291
+ # @return [Async::Task<Discorb::TextChannel>] The created text channel.
292
292
  #
293
293
  def create_text_channel(
294
294
  name, topic: nil, rate_limit_per_user: nil, slowmode: nil, position: nil, nsfw: nil, permission_overwrites: nil, parent: nil, reason: nil
@@ -333,7 +333,7 @@ module Discorb
333
333
  # @param [Discorb::CategoryChannel] parent The parent of the channel.
334
334
  # @param [String] reason The reason for creating the channel.
335
335
  #
336
- # @return [Discorb::VoiceChannel] The created voice channel.
336
+ # @return [Async::Task<Discorb::VoiceChannel>] The created voice channel.
337
337
  #
338
338
  def create_voice_channel(
339
339
  name, bitrate: 64, user_limit: nil, position: nil, permission_overwrites: nil, parent: nil, reason: nil
@@ -373,7 +373,7 @@ module Discorb
373
373
  # @param [Discorb::CategoryChannel] parent The parent of the channel.
374
374
  # @param [String] reason The reason for creating the channel.
375
375
  #
376
- # @return [Discorb::CategoryChannel] The created category channel.
376
+ # @return [Async::Task<Discorb::CategoryChannel>] The created category channel.
377
377
  #
378
378
  def create_category_channel(name, position: nil, permission_overwrites: nil, parent: nil, reason: nil)
379
379
  Async do
@@ -412,7 +412,7 @@ module Discorb
412
412
  # @param [Discorb::CategoryChannel] parent The parent of the channel.
413
413
  # @param [String] reason The reason for creating the channel.
414
414
  #
415
- # @return [Discorb::StageChannel] The created stage channel.
415
+ # @return [Async::Task<Discorb::StageChannel>] The created stage channel.
416
416
  #
417
417
  def create_stage_channel(name, bitrate: 64, position: nil, permission_overwrites: nil, parent: nil, reason: nil)
418
418
  Async do
@@ -453,7 +453,7 @@ module Discorb
453
453
  # @param [Discorb::CategoryChannel] parent The parent of the channel.
454
454
  # @param [String] reason The reason for creating the channel.
455
455
  #
456
- # @return [Discorb::NewsChannel] The created news channel.
456
+ # @return [Async::Task<Discorb::NewsChannel>] The created news channel.
457
457
  #
458
458
  def create_news_channel(
459
459
  name, topic: nil, rate_limit_per_user: nil, slowmode: nil, position: nil, nsfw: nil, permission_overwrites: nil, parent: nil, reason: nil
@@ -489,7 +489,7 @@ module Discorb
489
489
  # @macro async
490
490
  # @macro http
491
491
  #
492
- # @return [Array<Discorb::ThreadChannel>] The list of threads.
492
+ # @return [Async::Task<Array<Discorb::ThreadChannel>>] The list of threads.
493
493
  #
494
494
  def fetch_active_threads
495
495
  Async do
@@ -506,8 +506,8 @@ module Discorb
506
506
  #
507
507
  # @param [#to_s] id The ID of the member to fetch.
508
508
  #
509
- # @return [Discorb::Member] The member.
510
- # @return [nil] If the member is not found.
509
+ # @return [Async::Task<Discorb::Member>] The member.
510
+ # @return [Async::Task<nil>] If the member is not found.
511
511
  #
512
512
  def fetch_member(id)
513
513
  Async do
@@ -527,7 +527,7 @@ module Discorb
527
527
  # @param [String] name The name of the member to search for.
528
528
  # @param [Integer] limit The maximum number of members to return.
529
529
  #
530
- # @return [Array<Discorb::Member>] The list of members.
530
+ # @return [Async::Task<Array<Discorb::Member>>] The list of members.
531
531
  #
532
532
  def fetch_members_named(name, limit: 1)
533
533
  Async do
@@ -541,8 +541,8 @@ module Discorb
541
541
  # @macro async
542
542
  # @macro http
543
543
  #
544
- # @return [Discorb::Member] The member.
545
- # @return [nil] If the member is not found.
544
+ # @return [Async::Task<Discorb::Member>] The member.
545
+ # @return [Async::Task<nil>] If the member is not found.
546
546
  #
547
547
  def fetch_member_named(...)
548
548
  Async do
@@ -585,7 +585,7 @@ module Discorb
585
585
  # @macro async
586
586
  # @macro http
587
587
  #
588
- # @return [Array<Discorb::Guild::Ban>] The list of bans.
588
+ # @return [Async::Task<Array<Discorb::Guild::Ban>>] The list of bans.
589
589
  #
590
590
  def fetch_bans
591
591
  Async do
@@ -601,8 +601,8 @@ module Discorb
601
601
  #
602
602
  # @param [Discorb::User] user The user to fetch.
603
603
  #
604
- # @return [Discorb::Guild::Ban] The ban.
605
- # @return [nil] If the ban is not found.
604
+ # @return [Async::Task<Discorb::Guild::Ban>] The ban.
605
+ # @return [Async::Task<nil>] If the ban is not found.
606
606
  #
607
607
  def fetch_ban(user)
608
608
  Async do
@@ -621,7 +621,7 @@ module Discorb
621
621
  #
622
622
  # @param [Discorb::User] user The user to check.
623
623
  #
624
- # @return [Boolean] Whether the user was banned.
624
+ # @return [Async::Task<Boolean>] Whether the user was banned.
625
625
  #
626
626
  def banned?(user)
627
627
  Async do
@@ -638,7 +638,7 @@ module Discorb
638
638
  # @param [Integer] delete_message_days The number of days to delete messages.
639
639
  # @param [String] reason The reason for banning the member.
640
640
  #
641
- # @return [Discorb::Guild::Ban] The ban.
641
+ # @return [Async::Task<Discorb::Guild::Ban>] The ban.
642
642
  #
643
643
  def ban_member(member, delete_message_days: 0, reason: nil)
644
644
  Async do
@@ -668,7 +668,7 @@ module Discorb
668
668
  # @macro async
669
669
  # @macro http
670
670
  #
671
- # @return [Array<Discorb::Role>] The list of roles.
671
+ # @return [Async::Task<Array<Discorb::Role>>] The list of roles.
672
672
  #
673
673
  def fetch_roles
674
674
  Async do
@@ -688,7 +688,7 @@ module Discorb
688
688
  # @param [Boolean] mentionable Whether the role should be mentionable.
689
689
  # @param [String] reason The reason for creating the role.
690
690
  #
691
- # @return [Discorb::Role] The role.
691
+ # @return [Async::Task<Discorb::Role>] The role.
692
692
  #
693
693
  def create_role(name = nil, color: nil, hoist: nil, mentionable: nil, reason: nil)
694
694
  Async do
@@ -712,7 +712,7 @@ module Discorb
712
712
  # @param [Integer] days The number of days to prune.
713
713
  # @param [Array<Discorb::Role>] roles The roles that include for pruning.
714
714
  #
715
- # @return [Integer] The number of members that will be pruned.
715
+ # @return [Async::Task<Integer>] The number of members that will be pruned.
716
716
  #
717
717
  def fetch_prune(days = 7, roles: [])
718
718
  Async do
@@ -735,7 +735,7 @@ module Discorb
735
735
  # @param [Array<Discorb::Role>] roles The roles that include for pruning.
736
736
  # @param [String] reason The reason for pruning.
737
737
  #
738
- # @return [Integer] The number of members that were pruned.
738
+ # @return [Async::Task<Integer>] The number of members that were pruned.
739
739
  #
740
740
  def prune(days = 7, roles: [], reason: nil)
741
741
  Async do
@@ -751,7 +751,7 @@ module Discorb
751
751
  # @macro async
752
752
  # @macro http
753
753
  #
754
- # @return [Array<Discorb::VoiceRegion>] The available voice regions.
754
+ # @return [Async::Task<Array<Discorb::VoiceRegion>>] The available voice regions.
755
755
  #
756
756
  def fetch_voice_regions
757
757
  Async do
@@ -765,7 +765,7 @@ module Discorb
765
765
  # @macro async
766
766
  # @macro http
767
767
  #
768
- # @return [Array<Invite>] The invites.
768
+ # @return [Async::Task<Array<Invite>>] The invites.
769
769
  #
770
770
  def fetch_invites
771
771
  Async do
@@ -779,7 +779,7 @@ module Discorb
779
779
  # @macro async
780
780
  # @macro http
781
781
  #
782
- # @return [Array<Discorb::Integration>] The integrations.
782
+ # @return [Async::Task<Array<Discorb::Integration>>] The integrations.
783
783
  #
784
784
  def fetch_integrations
785
785
  Async do
@@ -793,7 +793,7 @@ module Discorb
793
793
  # @macro async
794
794
  # @macro http
795
795
  #
796
- # @return [Discorb::Guild::Widget] The widget.
796
+ # @return [Async::Task<Discorb::Guild::Widget>] The widget.
797
797
  #
798
798
  def fetch_widget
799
799
  Async do
@@ -807,7 +807,7 @@ module Discorb
807
807
  # @macro async
808
808
  # @macro http
809
809
  #
810
- # @return [Discorb::Guild::VanityInvite] The vanity URL.
810
+ # @return [Async::Task<Discorb::Guild::VanityInvite>] The vanity URL.
811
811
  #
812
812
  def fetch_vanity_invite
813
813
  Async do
@@ -821,7 +821,7 @@ module Discorb
821
821
  # @macro async
822
822
  # @macro http
823
823
  #
824
- # @return [Discorb::Guild::WelcomeScreen] The welcome screen.
824
+ # @return [Async::Task<Discorb::Guild::WelcomeScreen>] The welcome screen.
825
825
  #
826
826
  def fetch_welcome_screen
827
827
  Async do
@@ -835,7 +835,7 @@ module Discorb
835
835
  # @macro async
836
836
  # @macro http
837
837
  #
838
- # @return [Array<Discorb::Sticker::GuildSticker>] The stickers.
838
+ # @return [Async::Task<Array<Discorb::Sticker::GuildSticker>>] The stickers.
839
839
  #
840
840
  def fetch_stickers
841
841
  Async do
@@ -851,8 +851,8 @@ module Discorb
851
851
  #
852
852
  # @param [#to_s] id The ID of the sticker.
853
853
  #
854
- # @return [Discorb::Sticker::GuildSticker] The sticker.
855
- # @return [nil] If the sticker does not exist.
854
+ # @return [Async::Task<Discorb::Sticker::GuildSticker>] The sticker.
855
+ # @return [Async::Task<nil>] If the sticker does not exist.
856
856
  #
857
857
  def fetch_sticker(id)
858
858
  Async do
@@ -869,7 +869,7 @@ module Discorb
869
869
  # @macro async
870
870
  # @macro http
871
871
  #
872
- # @return [Discorb::GuildTemplate] The templates.
872
+ # @return [Async::Task<Discorb::GuildTemplate>] The templates.
873
873
  #
874
874
  def fetch_templates
875
875
  Async do
@@ -882,7 +882,7 @@ module Discorb
882
882
  # Almost the same as {#fetch_templates}, but returns a single template.
883
883
  #
884
884
  # @return [Discorb::GuildTemplate] The template.
885
- # @return [nil] If the template does not exist.
885
+ # @return [Async::Task<nil>] If the template does not exist.
886
886
  #
887
887
  def fetch_template
888
888
  Async do
@@ -897,7 +897,7 @@ module Discorb
897
897
  # @param [String] description The description of the template.
898
898
  # @param [String] reason The reason for creating the template.
899
899
  #
900
- # @return [Discorb::GuildTemplate] The template.
900
+ # @return [Async::Task<Discorb::GuildTemplate>] The template.
901
901
  #
902
902
  def create_template(name, description = nil, reason: nil)
903
903
  Async do