discorb 0.9.0 → 0.9.5
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.
- checksums.yaml +4 -4
 - data/.github/workflows/build_main.yml +2 -0
 - data/Changelog.md +28 -1
 - data/README.md +6 -6
 - data/Rakefile +7 -1
 - data/assets/banner.svg +101 -101
 - data/docs/application_command.md +8 -7
 - data/docs/cli/run.md +3 -3
 - data/docs/faq.md +1 -1
 - data/docs/license.md +1 -1
 - data/lib/discorb/app_command.rb +12 -10
 - data/lib/discorb/application.rb +3 -3
 - data/lib/discorb/asset.rb +2 -2
 - data/lib/discorb/audit_logs.rb +7 -7
 - data/lib/discorb/channel.rb +10 -10
 - data/lib/discorb/common.rb +3 -3
 - data/lib/discorb/components.rb +2 -2
 - data/lib/discorb/embed.rb +2 -2
 - data/lib/discorb/emoji.rb +3 -3
 - data/lib/discorb/error.rb +2 -2
 - data/lib/discorb/exe/init.rb +8 -8
 - data/lib/discorb/exe/run.rb +1 -1
 - data/lib/discorb/extend.rb +21 -0
 - data/lib/discorb/extension.rb +1 -1
 - data/lib/discorb/file.rb +19 -1
 - data/lib/discorb/gateway.rb +10 -12
 - data/lib/discorb/gateway_requests.rb +1 -1
 - data/lib/discorb/guild.rb +7 -7
 - data/lib/discorb/guild_template.rb +4 -4
 - data/lib/discorb/http.rb +1 -1
 - data/lib/discorb/integration.rb +3 -3
 - data/lib/discorb/interaction.rb +104 -35
 - data/lib/discorb/invite.rb +2 -2
 - data/lib/discorb/log.rb +1 -1
 - data/lib/discorb/member.rb +1 -1
 - data/lib/discorb/message.rb +34 -10
 - data/lib/discorb/modules.rb +11 -9
 - data/lib/discorb/permission.rb +2 -2
 - data/lib/discorb/presence.rb +8 -8
 - data/lib/discorb/rate_limit.rb +1 -1
 - data/lib/discorb/reaction.rb +1 -1
 - data/lib/discorb/role.rb +2 -2
 - data/lib/discorb/sticker.rb +3 -3
 - data/lib/discorb/user.rb +2 -2
 - data/lib/discorb/utils/colored_puts.rb +3 -3
 - data/lib/discorb/utils.rb +1 -1
 - data/lib/discorb/voice_state.rb +3 -3
 - data/lib/discorb/webhook.rb +7 -8
 - data/lib/discorb.rb +1 -1
 - data/sig/discorb.rbs +2 -2
 - data/template-replace/files/css/common.css +25 -0
 - data/template-replace/files/favicon.png +0 -0
 - data/template-replace/scripts/arrow.rb +7 -0
 - data/template-replace/scripts/favicon.rb +9 -0
 - metadata +5 -2
 
    
        data/lib/discorb/interaction.rb
    CHANGED
    
    | 
         @@ -33,7 +33,7 @@ module Discorb 
     | 
|
| 
       33 
33 
     | 
    
         
             
                @interaction_type = nil
         
     | 
| 
       34 
34 
     | 
    
         
             
                @interaction_name = nil
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
                #  
     | 
| 
      
 36 
     | 
    
         
            +
                # @private
         
     | 
| 
       37 
37 
     | 
    
         
             
                def initialize(client, data)
         
     | 
| 
       38 
38 
     | 
    
         
             
                  @client = client
         
     | 
| 
       39 
39 
     | 
    
         
             
                  @id = Snowflake.new(data[:id])
         
     | 
| 
         @@ -71,10 +71,10 @@ module Discorb 
     | 
|
| 
       71 
71 
     | 
    
         
             
                end
         
     | 
| 
       72 
72 
     | 
    
         | 
| 
       73 
73 
     | 
    
         
             
                class << self
         
     | 
| 
       74 
     | 
    
         
            -
                  #  
     | 
| 
      
 74 
     | 
    
         
            +
                  # @private
         
     | 
| 
       75 
75 
     | 
    
         
             
                  attr_reader :interaction_type, :interaction_name, :event_name
         
     | 
| 
       76 
76 
     | 
    
         | 
| 
       77 
     | 
    
         
            -
                  #  
     | 
| 
      
 77 
     | 
    
         
            +
                  # @private
         
     | 
| 
       78 
78 
     | 
    
         
             
                  def make_interaction(client, data)
         
     | 
| 
       79 
79 
     | 
    
         
             
                    interaction = nil
         
     | 
| 
       80 
80 
     | 
    
         
             
                    descendants.each do |klass|
         
     | 
| 
         @@ -87,7 +87,7 @@ module Discorb 
     | 
|
| 
       87 
87 
     | 
    
         
             
                    interaction
         
     | 
| 
       88 
88 
     | 
    
         
             
                  end
         
     | 
| 
       89 
89 
     | 
    
         | 
| 
       90 
     | 
    
         
            -
                  #  
     | 
| 
      
 90 
     | 
    
         
            +
                  # @private
         
     | 
| 
       91 
91 
     | 
    
         
             
                  def descendants
         
     | 
| 
       92 
92 
     | 
    
         
             
                    ObjectSpace.each_object(Class).select { |klass| klass < self }
         
     | 
| 
       93 
93 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -131,6 +131,8 @@ module Discorb 
     | 
|
| 
       131 
131 
     | 
    
         
             
                  # @param [Array<Discorb::Component>, Array<Array<Discorb::Component>>] components The components to send.
         
     | 
| 
       132 
132 
     | 
    
         
             
                  # @param [Boolean] ephemeral Whether to make the response ephemeral.
         
     | 
| 
       133 
133 
     | 
    
         
             
                  #
         
     | 
| 
      
 134 
     | 
    
         
            +
                  # @return [Discorb::Interaction::SourceResponse::CallbackMessage, Discorb::Webhook::Message] The callback message.
         
     | 
| 
      
 135 
     | 
    
         
            +
                  #
         
     | 
| 
       134 
136 
     | 
    
         
             
                  def post(content = nil, tts: false, embed: nil, embeds: nil, allowed_mentions: nil, components: nil, ephemeral: false)
         
     | 
| 
       135 
137 
     | 
    
         
             
                    Async do
         
     | 
| 
       136 
138 
     | 
    
         
             
                      payload = {}
         
     | 
| 
         @@ -165,14 +167,78 @@ module Discorb 
     | 
|
| 
       165 
167 
     | 
    
         
             
                      end
         
     | 
| 
       166 
168 
     | 
    
         
             
                      payload[:flags] = (ephemeral ? 1 << 6 : 0)
         
     | 
| 
       167 
169 
     | 
    
         | 
| 
       168 
     | 
    
         
            -
                      if @responded
         
     | 
| 
       169 
     | 
    
         
            -
             
     | 
| 
       170 
     | 
    
         
            -
             
     | 
| 
       171 
     | 
    
         
            -
             
     | 
| 
       172 
     | 
    
         
            -
             
     | 
| 
       173 
     | 
    
         
            -
             
     | 
| 
       174 
     | 
    
         
            -
             
     | 
| 
      
 170 
     | 
    
         
            +
                      ret = if @responded
         
     | 
| 
      
 171 
     | 
    
         
            +
                          _resp, data = @client.http.post("/webhooks/#{@application_id}/#{@token}", payload).wait
         
     | 
| 
      
 172 
     | 
    
         
            +
                          webhook = Webhook::URLWebhook.new("/webhooks/#{@application_id}/#{@token}")
         
     | 
| 
      
 173 
     | 
    
         
            +
                          Webhook::Message.new(webhook, data, @client)
         
     | 
| 
      
 174 
     | 
    
         
            +
                        elsif @defered
         
     | 
| 
      
 175 
     | 
    
         
            +
                          @client.http.patch("/webhooks/#{@application_id}/#{@token}/messages/@original", payload).wait
         
     | 
| 
      
 176 
     | 
    
         
            +
                          CallbackMessage.new(@client, payload, @application_id, @token)
         
     | 
| 
      
 177 
     | 
    
         
            +
                        else
         
     | 
| 
      
 178 
     | 
    
         
            +
                          @client.http.post("/interactions/#{@id}/#{@token}/callback", { type: 4, data: payload }).wait
         
     | 
| 
      
 179 
     | 
    
         
            +
                          CallbackMessage.new(@client, payload, @application_id, @token)
         
     | 
| 
      
 180 
     | 
    
         
            +
                        end
         
     | 
| 
       175 
181 
     | 
    
         
             
                      @responded = true
         
     | 
| 
      
 182 
     | 
    
         
            +
                      ret
         
     | 
| 
      
 183 
     | 
    
         
            +
                    end
         
     | 
| 
      
 184 
     | 
    
         
            +
                  end
         
     | 
| 
      
 185 
     | 
    
         
            +
             
     | 
| 
      
 186 
     | 
    
         
            +
                  class CallbackMessage
         
     | 
| 
      
 187 
     | 
    
         
            +
                    # @private
         
     | 
| 
      
 188 
     | 
    
         
            +
                    def initialize(client, data, application_id, token)
         
     | 
| 
      
 189 
     | 
    
         
            +
                      @client = client
         
     | 
| 
      
 190 
     | 
    
         
            +
                      @data = data
         
     | 
| 
      
 191 
     | 
    
         
            +
                      @application_id = application_id
         
     | 
| 
      
 192 
     | 
    
         
            +
                      @token = token
         
     | 
| 
      
 193 
     | 
    
         
            +
                    end
         
     | 
| 
      
 194 
     | 
    
         
            +
             
     | 
| 
      
 195 
     | 
    
         
            +
                    #
         
     | 
| 
      
 196 
     | 
    
         
            +
                    # Edits the callback message.
         
     | 
| 
      
 197 
     | 
    
         
            +
                    # @macro async
         
     | 
| 
      
 198 
     | 
    
         
            +
                    # @macro http
         
     | 
| 
      
 199 
     | 
    
         
            +
                    # @macro edit
         
     | 
| 
      
 200 
     | 
    
         
            +
                    #
         
     | 
| 
      
 201 
     | 
    
         
            +
                    # @param [String] content The new content of the message.
         
     | 
| 
      
 202 
     | 
    
         
            +
                    # @param [Discorb::Embed] embed The new embed of the message.
         
     | 
| 
      
 203 
     | 
    
         
            +
                    # @param [Array<Discorb::Embed>] embeds The new embeds of the message.
         
     | 
| 
      
 204 
     | 
    
         
            +
                    # @param [Array<Discorb::Attachment>] attachments The attachments to remain.
         
     | 
| 
      
 205 
     | 
    
         
            +
                    # @param [Discorb::File] file The file to send.
         
     | 
| 
      
 206 
     | 
    
         
            +
                    # @param [Array<Discorb::File>] files The files to send.
         
     | 
| 
      
 207 
     | 
    
         
            +
                    #
         
     | 
| 
      
 208 
     | 
    
         
            +
                    def edit(
         
     | 
| 
      
 209 
     | 
    
         
            +
                      content = :unset,
         
     | 
| 
      
 210 
     | 
    
         
            +
                      embed: :unset, embeds: :unset,
         
     | 
| 
      
 211 
     | 
    
         
            +
                      file: :unset, files: :unset,
         
     | 
| 
      
 212 
     | 
    
         
            +
                      attachments: :unset
         
     | 
| 
      
 213 
     | 
    
         
            +
                    )
         
     | 
| 
      
 214 
     | 
    
         
            +
                      Async do
         
     | 
| 
      
 215 
     | 
    
         
            +
                        payload = {}
         
     | 
| 
      
 216 
     | 
    
         
            +
                        payload[:content] = content if content != :unset
         
     | 
| 
      
 217 
     | 
    
         
            +
                        payload[:embeds] = embed ? [embed.to_hash] : [] if embed != :unset
         
     | 
| 
      
 218 
     | 
    
         
            +
                        payload[:embeds] = embeds.map(&:to_hash) if embeds != :unset
         
     | 
| 
      
 219 
     | 
    
         
            +
                        payload[:attachments] = attachments.map(&:to_hash) if attachments != :unset
         
     | 
| 
      
 220 
     | 
    
         
            +
                        files = [file] if file != :unset
         
     | 
| 
      
 221 
     | 
    
         
            +
                        if files == :unset
         
     | 
| 
      
 222 
     | 
    
         
            +
                          headers = {
         
     | 
| 
      
 223 
     | 
    
         
            +
                            "Content-Type" => "application/json",
         
     | 
| 
      
 224 
     | 
    
         
            +
                          }
         
     | 
| 
      
 225 
     | 
    
         
            +
                        else
         
     | 
| 
      
 226 
     | 
    
         
            +
                          headers, payload = HTTP.multipart(payload, files)
         
     | 
| 
      
 227 
     | 
    
         
            +
                        end
         
     | 
| 
      
 228 
     | 
    
         
            +
                        @client.http.patch("/webhooks/#{@application_id}/#{@token}/messages/@original", payload, headers: headers).wait
         
     | 
| 
      
 229 
     | 
    
         
            +
                      end
         
     | 
| 
      
 230 
     | 
    
         
            +
                    end
         
     | 
| 
      
 231 
     | 
    
         
            +
             
     | 
| 
      
 232 
     | 
    
         
            +
                    alias modify edit
         
     | 
| 
      
 233 
     | 
    
         
            +
             
     | 
| 
      
 234 
     | 
    
         
            +
                    #
         
     | 
| 
      
 235 
     | 
    
         
            +
                    # Deletes the callback message.
         
     | 
| 
      
 236 
     | 
    
         
            +
                    # @note This will fail if the message is ephemeral.
         
     | 
| 
      
 237 
     | 
    
         
            +
                    #
         
     | 
| 
      
 238 
     | 
    
         
            +
                    def delete!
         
     | 
| 
      
 239 
     | 
    
         
            +
                      Async do
         
     | 
| 
      
 240 
     | 
    
         
            +
                        @client.http.delete("/webhooks/#{@application_id}/#{@token}/messages/@original").wait
         
     | 
| 
      
 241 
     | 
    
         
            +
                      end
         
     | 
| 
       176 
242 
     | 
    
         
             
                    end
         
     | 
| 
       177 
243 
     | 
    
         
             
                  end
         
     | 
| 
       178 
244 
     | 
    
         
             
                end
         
     | 
| 
         @@ -296,28 +362,31 @@ module Discorb 
     | 
|
| 
       296 
362 
     | 
    
         
             
                          options = data[:options]
         
     | 
| 
       297 
363 
     | 
    
         
             
                        end
         
     | 
| 
       298 
364 
     | 
    
         
             
                      end
         
     | 
| 
       299 
     | 
    
         
            -
                      options ||= []
         
     | 
| 
       300 
     | 
    
         
            -
                      options.map! do |option|
         
     | 
| 
       301 
     | 
    
         
            -
                        case option[:type]
         
     | 
| 
       302 
     | 
    
         
            -
                        when 3, 4, 5, 10
         
     | 
| 
       303 
     | 
    
         
            -
                          option[:value]
         
     | 
| 
       304 
     | 
    
         
            -
                        when 6
         
     | 
| 
       305 
     | 
    
         
            -
                          guild.members[option[:value]] || guild.fetch_member(option[:value]).wait
         
     | 
| 
       306 
     | 
    
         
            -
                        when 7
         
     | 
| 
       307 
     | 
    
         
            -
                          guild.channels[option[:value]] || guild.fetch_channels.wait.find { |channel| channel.id == option[:value] }
         
     | 
| 
       308 
     | 
    
         
            -
                        when 8
         
     | 
| 
       309 
     | 
    
         
            -
                          guild.roles[option[:value]] || guild.fetch_roles.wait.find { |role| role.id == option[:value] }
         
     | 
| 
       310 
     | 
    
         
            -
                        when 9
         
     | 
| 
       311 
     | 
    
         
            -
                          guild.members[option[:value]] || guild.roles[option[:value]] || guild.fetch_member(option[:value]).wait || guild.fetch_roles.wait.find { |role| role.id == option[:value] }
         
     | 
| 
       312 
     | 
    
         
            -
                        end
         
     | 
| 
       313 
     | 
    
         
            -
                      end
         
     | 
| 
       314 
365 
     | 
    
         | 
| 
       315 
366 
     | 
    
         
             
                      unless (command = @client.bottom_commands.find { |c| c.to_s == name && c.type_raw == 1 })
         
     | 
| 
       316 
367 
     | 
    
         
             
                        @client.log.warn "Unknown command name #{name}, ignoreing"
         
     | 
| 
       317 
368 
     | 
    
         
             
                        next
         
     | 
| 
       318 
369 
     | 
    
         
             
                      end
         
     | 
| 
       319 
370 
     | 
    
         | 
| 
       320 
     | 
    
         
            -
                      command. 
     | 
| 
      
 371 
     | 
    
         
            +
                      option_map = command.options.map { |k, v| [k.to_s, v[:default]] }.to_h
         
     | 
| 
      
 372 
     | 
    
         
            +
                      options ||= []
         
     | 
| 
      
 373 
     | 
    
         
            +
                      options.each do |option|
         
     | 
| 
      
 374 
     | 
    
         
            +
                        val = case option[:type]
         
     | 
| 
      
 375 
     | 
    
         
            +
                          when 3, 4, 5, 10
         
     | 
| 
      
 376 
     | 
    
         
            +
                            option[:value]
         
     | 
| 
      
 377 
     | 
    
         
            +
                          when 6
         
     | 
| 
      
 378 
     | 
    
         
            +
                            guild.members[option[:value]] || guild.fetch_member(option[:value]).wait
         
     | 
| 
      
 379 
     | 
    
         
            +
                          when 7
         
     | 
| 
      
 380 
     | 
    
         
            +
                            guild.channels[option[:value]] || guild.fetch_channels.wait.find { |channel| channel.id == option[:value] }
         
     | 
| 
      
 381 
     | 
    
         
            +
                          when 8
         
     | 
| 
      
 382 
     | 
    
         
            +
                            guild.roles[option[:value]] || guild.fetch_roles.wait.find { |role| role.id == option[:value] }
         
     | 
| 
      
 383 
     | 
    
         
            +
                          when 9
         
     | 
| 
      
 384 
     | 
    
         
            +
                            guild.members[option[:value]] || guild.roles[option[:value]] || guild.fetch_member(option[:value]).wait || guild.fetch_roles.wait.find { |role| role.id == option[:value] }
         
     | 
| 
      
 385 
     | 
    
         
            +
                          end
         
     | 
| 
      
 386 
     | 
    
         
            +
                        option_map[option[:name]] = val
         
     | 
| 
      
 387 
     | 
    
         
            +
                      end
         
     | 
| 
      
 388 
     | 
    
         
            +
             
     | 
| 
      
 389 
     | 
    
         
            +
                      command.block.call(self, *command.options.map { |k, v| option_map[k.to_s] })
         
     | 
| 
       321 
390 
     | 
    
         
             
                    end
         
     | 
| 
       322 
391 
     | 
    
         
             
                  end
         
     | 
| 
       323 
392 
     | 
    
         
             
                end
         
     | 
| 
         @@ -351,7 +420,7 @@ module Discorb 
     | 
|
| 
       351 
420 
     | 
    
         
             
                  private
         
     | 
| 
       352 
421 
     | 
    
         | 
| 
       353 
422 
     | 
    
         
             
                  def _set_data(data)
         
     | 
| 
       354 
     | 
    
         
            -
                    @target = Message.new(@client, data[:resolved][:messages][data[:target_id].to_sym])
         
     | 
| 
      
 423 
     | 
    
         
            +
                    @target = Message.new(@client, data[:resolved][:messages][data[:target_id].to_sym].merge(guild_id: @guild_id.to_s))
         
     | 
| 
       355 
424 
     | 
    
         
             
                    @client.commands.find { |c| c.name == data[:name] && c.type_raw == 3 }.block.call(self, @target)
         
     | 
| 
       356 
425 
     | 
    
         
             
                  end
         
     | 
| 
       357 
426 
     | 
    
         
             
                end
         
     | 
| 
         @@ -363,10 +432,10 @@ module Discorb 
     | 
|
| 
       363 
432 
     | 
    
         
             
                end
         
     | 
| 
       364 
433 
     | 
    
         | 
| 
       365 
434 
     | 
    
         
             
                class << self
         
     | 
| 
       366 
     | 
    
         
            -
                  #  
     | 
| 
      
 435 
     | 
    
         
            +
                  # @private
         
     | 
| 
       367 
436 
     | 
    
         
             
                  attr_reader :command_type
         
     | 
| 
       368 
437 
     | 
    
         | 
| 
       369 
     | 
    
         
            -
                  #  
     | 
| 
      
 438 
     | 
    
         
            +
                  # @private
         
     | 
| 
       370 
439 
     | 
    
         
             
                  def make_interaction(client, data)
         
     | 
| 
       371 
440 
     | 
    
         
             
                    nested_classes.each do |klass|
         
     | 
| 
       372 
441 
     | 
    
         
             
                      return klass.new(client, data) if !klass.command_type.nil? && klass.command_type == data[:data][:type]
         
     | 
| 
         @@ -375,7 +444,7 @@ module Discorb 
     | 
|
| 
       375 
444 
     | 
    
         
             
                    CommandInteraction.new(client, data)
         
     | 
| 
       376 
445 
     | 
    
         
             
                  end
         
     | 
| 
       377 
446 
     | 
    
         | 
| 
       378 
     | 
    
         
            -
                  #  
     | 
| 
      
 447 
     | 
    
         
            +
                  # @private
         
     | 
| 
       379 
448 
     | 
    
         
             
                  def nested_classes
         
     | 
| 
       380 
449 
     | 
    
         
             
                    constants.select { |c| const_get(c).is_a? Class }.map { |c| const_get(c) }
         
     | 
| 
       381 
450 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -395,17 +464,17 @@ module Discorb 
     | 
|
| 
       395 
464 
     | 
    
         
             
                @interaction_type = 3
         
     | 
| 
       396 
465 
     | 
    
         
             
                @interaction_name = :message_component
         
     | 
| 
       397 
466 
     | 
    
         | 
| 
       398 
     | 
    
         
            -
                #  
     | 
| 
      
 467 
     | 
    
         
            +
                # @private
         
     | 
| 
       399 
468 
     | 
    
         
             
                def initialize(client, data)
         
     | 
| 
       400 
469 
     | 
    
         
             
                  super
         
     | 
| 
       401 
470 
     | 
    
         
             
                  @message = Message.new(@client, data[:message].merge({ member: data[:member] }))
         
     | 
| 
       402 
471 
     | 
    
         
             
                end
         
     | 
| 
       403 
472 
     | 
    
         | 
| 
       404 
473 
     | 
    
         
             
                class << self
         
     | 
| 
       405 
     | 
    
         
            -
                  #  
     | 
| 
      
 474 
     | 
    
         
            +
                  # @private
         
     | 
| 
       406 
475 
     | 
    
         
             
                  attr_reader :component_type
         
     | 
| 
       407 
476 
     | 
    
         | 
| 
       408 
     | 
    
         
            -
                  #  
     | 
| 
      
 477 
     | 
    
         
            +
                  # @private
         
     | 
| 
       409 
478 
     | 
    
         
             
                  def make_interaction(client, data)
         
     | 
| 
       410 
479 
     | 
    
         
             
                    nested_classes.each do |klass|
         
     | 
| 
       411 
480 
     | 
    
         
             
                      return klass.new(client, data) if !klass.component_type.nil? && klass.component_type == data[:data][:component_type]
         
     | 
| 
         @@ -414,7 +483,7 @@ module Discorb 
     | 
|
| 
       414 
483 
     | 
    
         
             
                    MessageComponentInteraction.new(client, data)
         
     | 
| 
       415 
484 
     | 
    
         
             
                  end
         
     | 
| 
       416 
485 
     | 
    
         | 
| 
       417 
     | 
    
         
            -
                  #  
     | 
| 
      
 486 
     | 
    
         
            +
                  # @private
         
     | 
| 
       418 
487 
     | 
    
         
             
                  def nested_classes
         
     | 
| 
       419 
488 
     | 
    
         
             
                    constants.select { |c| const_get(c).is_a? Class }.map { |c| const_get(c) }
         
     | 
| 
       420 
489 
     | 
    
         
             
                  end
         
     | 
    
        data/lib/discorb/invite.rb
    CHANGED
    
    | 
         @@ -72,7 +72,7 @@ module Discorb 
     | 
|
| 
       72 
72 
     | 
    
         
             
                  2 => :guild,
         
     | 
| 
       73 
73 
     | 
    
         
             
                }.freeze
         
     | 
| 
       74 
74 
     | 
    
         | 
| 
       75 
     | 
    
         
            -
                #  
     | 
| 
      
 75 
     | 
    
         
            +
                # @private
         
     | 
| 
       76 
76 
     | 
    
         
             
                def initialize(client, data, gateway)
         
     | 
| 
       77 
77 
     | 
    
         
             
                  @client = client
         
     | 
| 
       78 
78 
     | 
    
         
             
                  @data = data[:data]
         
     | 
| 
         @@ -138,7 +138,7 @@ module Discorb 
     | 
|
| 
       138 
138 
     | 
    
         
             
                end
         
     | 
| 
       139 
139 
     | 
    
         | 
| 
       140 
140 
     | 
    
         
             
                class << self
         
     | 
| 
       141 
     | 
    
         
            -
                  #  
     | 
| 
      
 141 
     | 
    
         
            +
                  # @private
         
     | 
| 
       142 
142 
     | 
    
         
             
                  attr_reader :target_types
         
     | 
| 
       143 
143 
     | 
    
         
             
                end
         
     | 
| 
       144 
144 
     | 
    
         
             
              end
         
     | 
    
        data/lib/discorb/log.rb
    CHANGED
    
    
    
        data/lib/discorb/member.rb
    CHANGED
    
    
    
        data/lib/discorb/message.rb
    CHANGED
    
    | 
         @@ -29,7 +29,7 @@ module Discorb 
     | 
|
| 
       29 
29 
     | 
    
         
             
                  @replied_user = replied_user
         
     | 
| 
       30 
30 
     | 
    
         
             
                end
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
                #  
     | 
| 
      
 32 
     | 
    
         
            +
                # @private
         
     | 
| 
       33 
33 
     | 
    
         
             
                def to_hash(other = nil)
         
     | 
| 
       34 
34 
     | 
    
         
             
                  payload = {
         
     | 
| 
       35 
35 
     | 
    
         
             
                    parse: %w[everyone roles users],
         
     | 
| 
         @@ -183,8 +183,32 @@ module Discorb 
     | 
|
| 
       183 
183 
     | 
    
         
             
                # @!attribute [r] embed
         
     | 
| 
       184 
184 
     | 
    
         
             
                #   @return [Discorb::Embed] The embed of the message.
         
     | 
| 
       185 
185 
     | 
    
         
             
                #   @return [nil] If the message has no embed.
         
     | 
| 
      
 186 
     | 
    
         
            +
                # @!attribute [r] embed?
         
     | 
| 
      
 187 
     | 
    
         
            +
                #   @return [Boolean] Whether the message has an embed.
         
     | 
| 
      
 188 
     | 
    
         
            +
                # @!attribute [r] reply?
         
     | 
| 
      
 189 
     | 
    
         
            +
                #   @return [Boolean] Whether the message is a reply.
         
     | 
| 
      
 190 
     | 
    
         
            +
                # @!attribute [r] dm?
         
     | 
| 
      
 191 
     | 
    
         
            +
                #   @return [Boolean] Whether the message was sent in a DM.
         
     | 
| 
      
 192 
     | 
    
         
            +
                # @!attribute [r] guild?
         
     | 
| 
      
 193 
     | 
    
         
            +
                #   @return [Boolean] Whether the message was sent in a guild.
         
     | 
| 
      
 194 
     | 
    
         
            +
             
     | 
| 
      
 195 
     | 
    
         
            +
                def embed?
         
     | 
| 
      
 196 
     | 
    
         
            +
                  @embeds.any?
         
     | 
| 
      
 197 
     | 
    
         
            +
                end
         
     | 
| 
      
 198 
     | 
    
         
            +
             
     | 
| 
      
 199 
     | 
    
         
            +
                def reply?
         
     | 
| 
      
 200 
     | 
    
         
            +
                  !@message_reference.nil?
         
     | 
| 
      
 201 
     | 
    
         
            +
                end
         
     | 
| 
      
 202 
     | 
    
         
            +
             
     | 
| 
      
 203 
     | 
    
         
            +
                def dm?
         
     | 
| 
      
 204 
     | 
    
         
            +
                  @guild_id.nil?
         
     | 
| 
      
 205 
     | 
    
         
            +
                end
         
     | 
| 
      
 206 
     | 
    
         
            +
             
     | 
| 
      
 207 
     | 
    
         
            +
                def guild?
         
     | 
| 
      
 208 
     | 
    
         
            +
                  !@guild_id.nil?
         
     | 
| 
      
 209 
     | 
    
         
            +
                end
         
     | 
| 
       186 
210 
     | 
    
         | 
| 
       187 
     | 
    
         
            -
                #  
     | 
| 
      
 211 
     | 
    
         
            +
                # @private
         
     | 
| 
       188 
212 
     | 
    
         
             
                def initialize(client, data, no_cache: false)
         
     | 
| 
       189 
213 
     | 
    
         
             
                  @client = client
         
     | 
| 
       190 
214 
     | 
    
         
             
                  @data = {}
         
     | 
| 
         @@ -272,11 +296,11 @@ module Discorb 
     | 
|
| 
       272 
296 
     | 
    
         
             
                # @param [Array<Discorb::Component>, Array<Array<Discorb::Component>>] components The components to send.
         
     | 
| 
       273 
297 
     | 
    
         
             
                # @param [Boolean] supress Whether to supress embeds.
         
     | 
| 
       274 
298 
     | 
    
         
             
                #
         
     | 
| 
       275 
     | 
    
         
            -
                def edit( 
     | 
| 
       276 
     | 
    
         
            -
             
     | 
| 
      
 299 
     | 
    
         
            +
                def edit(content = nil, embed: nil, embeds: nil, allowed_mentions: nil,
         
     | 
| 
      
 300 
     | 
    
         
            +
                                        components: nil, supress: nil)
         
     | 
| 
       277 
301 
     | 
    
         
             
                  Async do
         
     | 
| 
       278 
     | 
    
         
            -
                    channel.edit_message(@id,  
     | 
| 
       279 
     | 
    
         
            -
             
     | 
| 
      
 302 
     | 
    
         
            +
                    channel.edit_message(@id, content, embed: embed, embeds: embeds, allowed_mentions: allowed_mentions,
         
     | 
| 
      
 303 
     | 
    
         
            +
                                                       components: components, supress: supress).wait
         
     | 
| 
       280 
304 
     | 
    
         
             
                  end
         
     | 
| 
       281 
305 
     | 
    
         
             
                end
         
     | 
| 
       282 
306 
     | 
    
         | 
| 
         @@ -616,7 +640,7 @@ module Discorb 
     | 
|
| 
       616 
640 
     | 
    
         
             
                  # @return [Discorb::User] The user.
         
     | 
| 
       617 
641 
     | 
    
         
             
                  attr_reader :user
         
     | 
| 
       618 
642 
     | 
    
         | 
| 
       619 
     | 
    
         
            -
                  #  
     | 
| 
      
 643 
     | 
    
         
            +
                  # @private
         
     | 
| 
       620 
644 
     | 
    
         
             
                  def initialize(client, data)
         
     | 
| 
       621 
645 
     | 
    
         
             
                    @id = Snowflake.new(data[:id])
         
     | 
| 
       622 
646 
     | 
    
         
             
                    @name = data[:name]
         
     | 
| 
         @@ -641,20 +665,20 @@ module Discorb 
     | 
|
| 
       641 
665 
     | 
    
         
             
                    5 => :join_request,
         
     | 
| 
       642 
666 
     | 
    
         
             
                  }
         
     | 
| 
       643 
667 
     | 
    
         | 
| 
       644 
     | 
    
         
            -
                  #  
     | 
| 
      
 668 
     | 
    
         
            +
                  # @private
         
     | 
| 
       645 
669 
     | 
    
         
             
                  def initialize(data)
         
     | 
| 
       646 
670 
     | 
    
         
             
                    @name = data[:name]
         
     | 
| 
       647 
671 
     | 
    
         
             
                    @type = self.class.type(data[:type])
         
     | 
| 
       648 
672 
     | 
    
         
             
                  end
         
     | 
| 
       649 
673 
     | 
    
         | 
| 
       650 
674 
     | 
    
         
             
                  class << self
         
     | 
| 
       651 
     | 
    
         
            -
                    #  
     | 
| 
      
 675 
     | 
    
         
            +
                    # @private
         
     | 
| 
       652 
676 
     | 
    
         
             
                    attr_reader :type
         
     | 
| 
       653 
677 
     | 
    
         
             
                  end
         
     | 
| 
       654 
678 
     | 
    
         
             
                end
         
     | 
| 
       655 
679 
     | 
    
         | 
| 
       656 
680 
     | 
    
         
             
                class << self
         
     | 
| 
       657 
     | 
    
         
            -
                  #  
     | 
| 
      
 681 
     | 
    
         
            +
                  # @private
         
     | 
| 
       658 
682 
     | 
    
         
             
                  attr_reader :message_type
         
     | 
| 
       659 
683 
     | 
    
         
             
                end
         
     | 
| 
       660 
684 
     | 
    
         
             
              end
         
     | 
    
        data/lib/discorb/modules.rb
    CHANGED
    
    | 
         @@ -113,7 +113,7 @@ module Discorb 
     | 
|
| 
       113 
113 
     | 
    
         
             
                        end
         
     | 
| 
       114 
114 
     | 
    
         
             
                      end
         
     | 
| 
       115 
115 
     | 
    
         
             
                      tmp_components << tmp_row
         
     | 
| 
       116 
     | 
    
         
            -
                      payload[:flags] = (supress ? 1 << 2 : 0) unless  
     | 
| 
      
 116 
     | 
    
         
            +
                      payload[:flags] = (supress ? 1 << 2 : 0) unless supress.nil?
         
     | 
| 
       117 
117 
     | 
    
         
             
                      payload[:components] = tmp_components.filter { |c| c.length.positive? }.map { |c| { type: 1, components: c.map(&:to_hash) } }
         
     | 
| 
       118 
118 
     | 
    
         
             
                    end
         
     | 
| 
       119 
119 
     | 
    
         
             
                    @client.http.patch("/channels/#{channel_id.wait}/messages/#{message_id}", payload).wait
         
     | 
| 
         @@ -192,18 +192,20 @@ module Discorb 
     | 
|
| 
       192 
192 
     | 
    
         
             
                #   end
         
     | 
| 
       193 
193 
     | 
    
         
             
                #
         
     | 
| 
       194 
194 
     | 
    
         
             
                def typing
         
     | 
| 
       195 
     | 
    
         
            -
                   
     | 
| 
       196 
     | 
    
         
            -
                     
     | 
| 
       197 
     | 
    
         
            -
                       
     | 
| 
       198 
     | 
    
         
            -
                         
     | 
| 
      
 195 
     | 
    
         
            +
                  if block_given?
         
     | 
| 
      
 196 
     | 
    
         
            +
                    begin
         
     | 
| 
      
 197 
     | 
    
         
            +
                      post_task = Async do
         
     | 
| 
      
 198 
     | 
    
         
            +
                        loop do
         
     | 
| 
       199 
199 
     | 
    
         
             
                          @client.http.post("/channels/#{@id}/typing", {})
         
     | 
| 
       200 
200 
     | 
    
         
             
                          sleep(5)
         
     | 
| 
       201 
201 
     | 
    
         
             
                        end
         
     | 
| 
       202 
     | 
    
         
            -
                        yield
         
     | 
| 
       203 
     | 
    
         
            -
                      ensure
         
     | 
| 
       204 
     | 
    
         
            -
                        post_task.stop
         
     | 
| 
       205 
202 
     | 
    
         
             
                      end
         
     | 
| 
       206 
     | 
    
         
            -
             
     | 
| 
      
 203 
     | 
    
         
            +
                      yield
         
     | 
| 
      
 204 
     | 
    
         
            +
                    ensure
         
     | 
| 
      
 205 
     | 
    
         
            +
                      post_task.stop
         
     | 
| 
      
 206 
     | 
    
         
            +
                    end
         
     | 
| 
      
 207 
     | 
    
         
            +
                  else
         
     | 
| 
      
 208 
     | 
    
         
            +
                    Async do |task|
         
     | 
| 
       207 
209 
     | 
    
         
             
                      @client.http.post("/channels/#{@id}/typing", {})
         
     | 
| 
       208 
210 
     | 
    
         
             
                    end
         
     | 
| 
       209 
211 
     | 
    
         
             
                  end
         
     | 
    
        data/lib/discorb/permission.rb
    CHANGED
    
    | 
         @@ -138,7 +138,7 @@ module Discorb 
     | 
|
| 
       138 
138 
     | 
    
         
             
                }.freeze
         
     | 
| 
       139 
139 
     | 
    
         
             
                @bits = @raw_bits.transform_values { |v| 1 << v }.freeze
         
     | 
| 
       140 
140 
     | 
    
         | 
| 
       141 
     | 
    
         
            -
                #  
     | 
| 
      
 141 
     | 
    
         
            +
                # @private
         
     | 
| 
       142 
142 
     | 
    
         
             
                def initialize(allow, deny)
         
     | 
| 
       143 
143 
     | 
    
         
             
                  @allow = allow
         
     | 
| 
       144 
144 
     | 
    
         
             
                  @deny = deny
         
     | 
| 
         @@ -248,7 +248,7 @@ module Discorb 
     | 
|
| 
       248 
248 
     | 
    
         
             
                end
         
     | 
| 
       249 
249 
     | 
    
         | 
| 
       250 
250 
     | 
    
         
             
                class << self
         
     | 
| 
       251 
     | 
    
         
            -
                  #  
     | 
| 
      
 251 
     | 
    
         
            +
                  # @private
         
     | 
| 
       252 
252 
     | 
    
         
             
                  attr_reader :bits
         
     | 
| 
       253 
253 
     | 
    
         | 
| 
       254 
254 
     | 
    
         
             
                  #
         
     | 
    
        data/lib/discorb/presence.rb
    CHANGED
    
    | 
         @@ -19,7 +19,7 @@ module Discorb 
     | 
|
| 
       19 
19 
     | 
    
         
             
                # @!attribute [r] activity
         
     | 
| 
       20 
20 
     | 
    
         
             
                #   @return [Discorb::Presence::Activity] The activity of the presence.
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
                #  
     | 
| 
      
 22 
     | 
    
         
            +
                # @private
         
     | 
| 
       23 
23 
     | 
    
         
             
                def initialize(client, data)
         
     | 
| 
       24 
24 
     | 
    
         
             
                  @client = client
         
     | 
| 
       25 
25 
     | 
    
         
             
                  @data = data
         
     | 
| 
         @@ -89,7 +89,7 @@ module Discorb 
     | 
|
| 
       89 
89 
     | 
    
         
             
                    5 => :competing,
         
     | 
| 
       90 
90 
     | 
    
         
             
                  }
         
     | 
| 
       91 
91 
     | 
    
         | 
| 
       92 
     | 
    
         
            -
                  #  
     | 
| 
      
 92 
     | 
    
         
            +
                  # @private
         
     | 
| 
       93 
93 
     | 
    
         
             
                  def initialize(data)
         
     | 
| 
       94 
94 
     | 
    
         
             
                    @name = data[:name]
         
     | 
| 
       95 
95 
     | 
    
         
             
                    @type = self.class.activity_types[data[:type]]
         
     | 
| 
         @@ -140,7 +140,7 @@ module Discorb 
     | 
|
| 
       140 
140 
     | 
    
         
             
                    # @return [Time] The end time of the activity.
         
     | 
| 
       141 
141 
     | 
    
         
             
                    attr_reader :end
         
     | 
| 
       142 
142 
     | 
    
         | 
| 
       143 
     | 
    
         
            -
                    #  
     | 
| 
      
 143 
     | 
    
         
            +
                    # @private
         
     | 
| 
       144 
144 
     | 
    
         
             
                    def initialize(data)
         
     | 
| 
       145 
145 
     | 
    
         
             
                      @start = data[:start] && Time.at(data[:start])
         
     | 
| 
       146 
146 
     | 
    
         
             
                      @end = data[:end] && Time.at(data[:end])
         
     | 
| 
         @@ -156,7 +156,7 @@ module Discorb 
     | 
|
| 
       156 
156 
     | 
    
         
             
                    # @!attribute [r] max_size
         
     | 
| 
       157 
157 
     | 
    
         
             
                    #   @return [Integer] The max size of the party.
         
     | 
| 
       158 
158 
     | 
    
         | 
| 
       159 
     | 
    
         
            -
                    #  
     | 
| 
      
 159 
     | 
    
         
            +
                    # @private
         
     | 
| 
       160 
160 
     | 
    
         
             
                    def initialize(data)
         
     | 
| 
       161 
161 
     | 
    
         
             
                      @id = data[:id]
         
     | 
| 
       162 
162 
     | 
    
         
             
                      @size = data[:size]
         
     | 
| 
         @@ -226,7 +226,7 @@ module Discorb 
     | 
|
| 
       226 
226 
     | 
    
         
             
                    # @return [String] The match secret of the activity.
         
     | 
| 
       227 
227 
     | 
    
         
             
                    attr_reader :match
         
     | 
| 
       228 
228 
     | 
    
         | 
| 
       229 
     | 
    
         
            -
                    #  
     | 
| 
      
 229 
     | 
    
         
            +
                    # @private
         
     | 
| 
       230 
230 
     | 
    
         
             
                    def initialize(data)
         
     | 
| 
       231 
231 
     | 
    
         
             
                      @join = data[:join]
         
     | 
| 
       232 
232 
     | 
    
         
             
                      @spectate = data[:spectate]
         
     | 
| 
         @@ -244,7 +244,7 @@ module Discorb 
     | 
|
| 
       244 
244 
     | 
    
         
             
                    attr_reader :url
         
     | 
| 
       245 
245 
     | 
    
         
             
                    alias text label
         
     | 
| 
       246 
246 
     | 
    
         | 
| 
       247 
     | 
    
         
            -
                    #  
     | 
| 
      
 247 
     | 
    
         
            +
                    # @private
         
     | 
| 
       248 
248 
     | 
    
         
             
                    def initialize(data)
         
     | 
| 
       249 
249 
     | 
    
         
             
                      @label = data[0]
         
     | 
| 
       250 
250 
     | 
    
         
             
                      @url = data[1]
         
     | 
| 
         @@ -252,7 +252,7 @@ module Discorb 
     | 
|
| 
       252 
252 
     | 
    
         
             
                  end
         
     | 
| 
       253 
253 
     | 
    
         | 
| 
       254 
254 
     | 
    
         
             
                  class << self
         
     | 
| 
       255 
     | 
    
         
            -
                    #  
     | 
| 
      
 255 
     | 
    
         
            +
                    # @private
         
     | 
| 
       256 
256 
     | 
    
         
             
                    attr_reader :activity_types
         
     | 
| 
       257 
257 
     | 
    
         
             
                  end
         
     | 
| 
       258 
258 
     | 
    
         
             
                end
         
     | 
| 
         @@ -275,7 +275,7 @@ module Discorb 
     | 
|
| 
       275 
275 
     | 
    
         
             
                  # @!attribute [r] web?
         
     | 
| 
       276 
276 
     | 
    
         
             
                  #   @return [Boolean] Whether the user is not offline on web.
         
     | 
| 
       277 
277 
     | 
    
         | 
| 
       278 
     | 
    
         
            -
                  #  
     | 
| 
      
 278 
     | 
    
         
            +
                  # @private
         
     | 
| 
       279 
279 
     | 
    
         
             
                  def initialize(data)
         
     | 
| 
       280 
280 
     | 
    
         
             
                    @desktop = data[:desktop]&.to_sym || :offline
         
     | 
| 
       281 
281 
     | 
    
         
             
                    @mobile = data[:mobile]&.to_sym || :offline
         
     | 
    
        data/lib/discorb/rate_limit.rb
    CHANGED
    
    
    
        data/lib/discorb/reaction.rb
    CHANGED
    
    
    
        data/lib/discorb/role.rb
    CHANGED
    
    | 
         @@ -36,7 +36,7 @@ module Discorb 
     | 
|
| 
       36 
36 
     | 
    
         | 
| 
       37 
37 
     | 
    
         
             
                include Comparable
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
                #  
     | 
| 
      
 39 
     | 
    
         
            +
                # @private
         
     | 
| 
       40 
40 
     | 
    
         
             
                def initialize(client, guild, data)
         
     | 
| 
       41 
41 
     | 
    
         
             
                  @client = client
         
     | 
| 
       42 
42 
     | 
    
         
             
                  @guild = guild
         
     | 
| 
         @@ -154,7 +154,7 @@ module Discorb 
     | 
|
| 
       154 
154 
     | 
    
         
             
                  # @!attribute [r] integration?
         
     | 
| 
       155 
155 
     | 
    
         
             
                  #   @return [Boolean] Whether the role is an integration role.
         
     | 
| 
       156 
156 
     | 
    
         | 
| 
       157 
     | 
    
         
            -
                  #  
     | 
| 
      
 157 
     | 
    
         
            +
                  # @private
         
     | 
| 
       158 
158 
     | 
    
         
             
                  def initialize(data)
         
     | 
| 
       159 
159 
     | 
    
         
             
                    @bot_id = Snowflake.new(data[:bot_id])
         
     | 
| 
       160 
160 
     | 
    
         
             
                    @integration_id = Snowflake.new(data[:integration_id])
         
     | 
    
        data/lib/discorb/sticker.rb
    CHANGED
    
    | 
         @@ -38,7 +38,7 @@ module Discorb 
     | 
|
| 
       38 
38 
     | 
    
         
             
                  2 => :apng,
         
     | 
| 
       39 
39 
     | 
    
         
             
                  3 => :lottie,
         
     | 
| 
       40 
40 
     | 
    
         
             
                }
         
     | 
| 
       41 
     | 
    
         
            -
                #  
     | 
| 
      
 41 
     | 
    
         
            +
                # @private
         
     | 
| 
       42 
42 
     | 
    
         
             
                def initialize(client, data)
         
     | 
| 
       43 
43 
     | 
    
         
             
                  @client = client
         
     | 
| 
       44 
44 
     | 
    
         
             
                  _set_data(data)
         
     | 
| 
         @@ -116,7 +116,7 @@ module Discorb 
     | 
|
| 
       116 
116 
     | 
    
         
             
                  # @return [Discorb::Asset] The banner of the pack.
         
     | 
| 
       117 
117 
     | 
    
         
             
                  attr_reader :banner
         
     | 
| 
       118 
118 
     | 
    
         | 
| 
       119 
     | 
    
         
            -
                  #  
     | 
| 
      
 119 
     | 
    
         
            +
                  # @private
         
     | 
| 
       120 
120 
     | 
    
         
             
                  def initialize(client, data)
         
     | 
| 
       121 
121 
     | 
    
         
             
                    @client = client
         
     | 
| 
       122 
122 
     | 
    
         
             
                    @id = Snowflake.new(data[:id])
         
     | 
| 
         @@ -150,7 +150,7 @@ module Discorb 
     | 
|
| 
       150 
150 
     | 
    
         
             
                end
         
     | 
| 
       151 
151 
     | 
    
         | 
| 
       152 
152 
     | 
    
         
             
                class << self
         
     | 
| 
       153 
     | 
    
         
            -
                  #  
     | 
| 
      
 153 
     | 
    
         
            +
                  # @private
         
     | 
| 
       154 
154 
     | 
    
         
             
                  attr_reader :sticker_type, :sticker_format
         
     | 
| 
       155 
155 
     | 
    
         
             
                end
         
     | 
| 
       156 
156 
     | 
    
         
             
              end
         
     | 
    
        data/lib/discorb/user.rb
    CHANGED
    
    | 
         @@ -26,7 +26,7 @@ module Discorb 
     | 
|
| 
       26 
26 
     | 
    
         | 
| 
       27 
27 
     | 
    
         
             
                include Discorb::Messageable
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
                #  
     | 
| 
      
 29 
     | 
    
         
            +
                # @private
         
     | 
| 
       30 
30 
     | 
    
         
             
                def initialize(client, data)
         
     | 
| 
       31 
31 
     | 
    
         
             
                  @client = client
         
     | 
| 
       32 
32 
     | 
    
         
             
                  @data = {}
         
     | 
| 
         @@ -73,7 +73,7 @@ module Discorb 
     | 
|
| 
       73 
73 
     | 
    
         | 
| 
       74 
74 
     | 
    
         
             
                alias app_owner? bot_owner?
         
     | 
| 
       75 
75 
     | 
    
         | 
| 
       76 
     | 
    
         
            -
                #  
     | 
| 
      
 76 
     | 
    
         
            +
                # @private
         
     | 
| 
       77 
77 
     | 
    
         
             
                def channel_id
         
     | 
| 
       78 
78 
     | 
    
         
             
                  Async do
         
     | 
| 
       79 
79 
     | 
    
         
             
                    next @dm_channel_id if @dm_channel_id
         
     | 
| 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            #  
     | 
| 
      
 1 
     | 
    
         
            +
            # @private
         
     | 
| 
       2 
2 
     | 
    
         
             
            def sputs(text)
         
     | 
| 
       3 
3 
     | 
    
         
             
              puts "\e[92m#{text}\e[m"
         
     | 
| 
       4 
4 
     | 
    
         
             
            end
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
            #  
     | 
| 
      
 6 
     | 
    
         
            +
            # @private
         
     | 
| 
       7 
7 
     | 
    
         
             
            def eputs(text)
         
     | 
| 
       8 
8 
     | 
    
         
             
              puts "\e[91m#{text}\e[m"
         
     | 
| 
       9 
9 
     | 
    
         
             
            end
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
            #  
     | 
| 
      
 11 
     | 
    
         
            +
            # @private
         
     | 
| 
       12 
12 
     | 
    
         
             
            def iputs(text)
         
     | 
| 
       13 
13 
     | 
    
         
             
              puts "\e[90m#{text}\e[m"
         
     | 
| 
       14 
14 
     | 
    
         
             
            end
         
     | 
    
        data/lib/discorb/utils.rb
    CHANGED
    
    
    
        data/lib/discorb/voice_state.rb
    CHANGED
    
    | 
         @@ -43,7 +43,7 @@ module Discorb 
     | 
|
| 
       43 
43 
     | 
    
         
             
                #   @macro client_cache
         
     | 
| 
       44 
44 
     | 
    
         
             
                #   @return [Discorb::User] The user this voice state is for.
         
     | 
| 
       45 
45 
     | 
    
         | 
| 
       46 
     | 
    
         
            -
                #  
     | 
| 
      
 46 
     | 
    
         
            +
                # @private
         
     | 
| 
       47 
47 
     | 
    
         
             
                def initialize(client, data)
         
     | 
| 
       48 
48 
     | 
    
         
             
                  @client = client
         
     | 
| 
       49 
49 
     | 
    
         
             
                  _set_data(data)
         
     | 
| 
         @@ -132,7 +132,7 @@ module Discorb 
     | 
|
| 
       132 
132 
     | 
    
         
             
                  2 => :guild_only,
         
     | 
| 
       133 
133 
     | 
    
         
             
                }
         
     | 
| 
       134 
134 
     | 
    
         | 
| 
       135 
     | 
    
         
            -
                #  
     | 
| 
      
 135 
     | 
    
         
            +
                # @private
         
     | 
| 
       136 
136 
     | 
    
         
             
                def initialize(client, data, no_cache: false)
         
     | 
| 
       137 
137 
     | 
    
         
             
                  @client = client
         
     | 
| 
       138 
138 
     | 
    
         
             
                  @data = data
         
     | 
| 
         @@ -238,7 +238,7 @@ module Discorb 
     | 
|
| 
       238 
238 
     | 
    
         
             
                attr_reader :custom
         
     | 
| 
       239 
239 
     | 
    
         
             
                alias custom? custom
         
     | 
| 
       240 
240 
     | 
    
         | 
| 
       241 
     | 
    
         
            -
                #  
     | 
| 
      
 241 
     | 
    
         
            +
                # @private
         
     | 
| 
       242 
242 
     | 
    
         
             
                def initialize(data)
         
     | 
| 
       243 
243 
     | 
    
         
             
                  @id = data[:id]
         
     | 
| 
       244 
244 
     | 
    
         
             
                  @name = data[:name]
         
     |