discorb 0.11.3 → 0.11.4
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/Changelog.md +4 -0
 - data/lib/discorb/channel.rb +0 -42
 - data/lib/discorb/common.rb +1 -1
 - data/lib/discorb/modules.rb +42 -0
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 3154cd1b844888bec798cdead182285e335733206758fddea8c2fd8e0015499e
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 9d0ba163982a7676045dce791409227f2c99c3e28bce29cae25033b85f7485a5
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 20ee7dd354fc5be471617ed61367ceb85bad364cd8e2afd95df9c46453665b61c15d387c2bafb36b295836f5cb02f699edfc3118af4fa6c39e30a52f72904e6d
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: c860a7fa1335a7be40dafa7e9bda5bbfd6a7d7e7790ece875db350b154f3e7ab7f523387b5be4a77f4cae7f43c01b3a726f2c917dd81c2b97502f0097b9b5ecc
         
     | 
    
        data/Changelog.md
    CHANGED
    
    
    
        data/lib/discorb/channel.rb
    CHANGED
    
    | 
         @@ -482,48 +482,6 @@ module Discorb 
     | 
|
| 
       482 
482 
     | 
    
         
             
                  end
         
     | 
| 
       483 
483 
     | 
    
         
             
                end
         
     | 
| 
       484 
484 
     | 
    
         | 
| 
       485 
     | 
    
         
            -
                #
         
     | 
| 
       486 
     | 
    
         
            -
                # Fetch the pinned messages in the channel.
         
     | 
| 
       487 
     | 
    
         
            -
                # @macro async
         
     | 
| 
       488 
     | 
    
         
            -
                # @macro http
         
     | 
| 
       489 
     | 
    
         
            -
                #
         
     | 
| 
       490 
     | 
    
         
            -
                # @return [Async::Task<Array<Discorb::Message>>] The pinned messages in the channel.
         
     | 
| 
       491 
     | 
    
         
            -
                #
         
     | 
| 
       492 
     | 
    
         
            -
                def fetch_pins
         
     | 
| 
       493 
     | 
    
         
            -
                  Async do
         
     | 
| 
       494 
     | 
    
         
            -
                    _resp, data = @client.http.get("/channels/#{@id}/pins").wait
         
     | 
| 
       495 
     | 
    
         
            -
                    data.map { |pin| Message.new(@client, pin) }
         
     | 
| 
       496 
     | 
    
         
            -
                  end
         
     | 
| 
       497 
     | 
    
         
            -
                end
         
     | 
| 
       498 
     | 
    
         
            -
             
     | 
| 
       499 
     | 
    
         
            -
                #
         
     | 
| 
       500 
     | 
    
         
            -
                # Pin a message in the channel.
         
     | 
| 
       501 
     | 
    
         
            -
                # @macro async
         
     | 
| 
       502 
     | 
    
         
            -
                # @macro http
         
     | 
| 
       503 
     | 
    
         
            -
                #
         
     | 
| 
       504 
     | 
    
         
            -
                # @param [Discorb::Message] message The message to pin.
         
     | 
| 
       505 
     | 
    
         
            -
                # @param [String] reason The reason of pinning the message.
         
     | 
| 
       506 
     | 
    
         
            -
                #
         
     | 
| 
       507 
     | 
    
         
            -
                def pin_message(message, reason: nil)
         
     | 
| 
       508 
     | 
    
         
            -
                  Async do
         
     | 
| 
       509 
     | 
    
         
            -
                    @client.http.put("/channels/#{@id}/pins/#{message.id}", {}, audit_log_reason: reason).wait
         
     | 
| 
       510 
     | 
    
         
            -
                  end
         
     | 
| 
       511 
     | 
    
         
            -
                end
         
     | 
| 
       512 
     | 
    
         
            -
             
     | 
| 
       513 
     | 
    
         
            -
                #
         
     | 
| 
       514 
     | 
    
         
            -
                # Unpin a message in the channel.
         
     | 
| 
       515 
     | 
    
         
            -
                # @macro async
         
     | 
| 
       516 
     | 
    
         
            -
                # @macro http
         
     | 
| 
       517 
     | 
    
         
            -
                #
         
     | 
| 
       518 
     | 
    
         
            -
                # @param [Discorb::Message] message The message to unpin.
         
     | 
| 
       519 
     | 
    
         
            -
                # @param [String] reason The reason of unpinning the message.
         
     | 
| 
       520 
     | 
    
         
            -
                #
         
     | 
| 
       521 
     | 
    
         
            -
                def unpin_message(message, reason: nil)
         
     | 
| 
       522 
     | 
    
         
            -
                  Async do
         
     | 
| 
       523 
     | 
    
         
            -
                    @client.http.delete("/channels/#{@id}/pins/#{message.id}", {}, audit_log_reason: reason).wait
         
     | 
| 
       524 
     | 
    
         
            -
                  end
         
     | 
| 
       525 
     | 
    
         
            -
                end
         
     | 
| 
       526 
     | 
    
         
            -
             
     | 
| 
       527 
485 
     | 
    
         
             
                #
         
     | 
| 
       528 
486 
     | 
    
         
             
                # Start thread in the channel.
         
     | 
| 
       529 
487 
     | 
    
         
             
                # @macro async
         
     | 
    
        data/lib/discorb/common.rb
    CHANGED
    
    | 
         @@ -4,7 +4,7 @@ module Discorb 
     | 
|
| 
       4 
4 
     | 
    
         
             
              # @return [String] The API base URL.
         
     | 
| 
       5 
5 
     | 
    
         
             
              API_BASE_URL = "https://discord.com/api/v9"
         
     | 
| 
       6 
6 
     | 
    
         
             
              # @return [String] The version of discorb.
         
     | 
| 
       7 
     | 
    
         
            -
              VERSION = "0.11. 
     | 
| 
      
 7 
     | 
    
         
            +
              VERSION = "0.11.4"
         
     | 
| 
       8 
8 
     | 
    
         
             
              # @return [String] The user agent for the bot.
         
     | 
| 
       9 
9 
     | 
    
         
             
              USER_AGENT = "DiscordBot (https://discorb-lib.github.io #{VERSION}) Ruby/#{RUBY_VERSION}"
         
     | 
| 
       10 
10 
     | 
    
         | 
    
        data/lib/discorb/modules.rb
    CHANGED
    
    | 
         @@ -142,6 +142,48 @@ module Discorb 
     | 
|
| 
       142 
142 
     | 
    
         
             
                  end
         
     | 
| 
       143 
143 
     | 
    
         
             
                end
         
     | 
| 
       144 
144 
     | 
    
         | 
| 
      
 145 
     | 
    
         
            +
                #
         
     | 
| 
      
 146 
     | 
    
         
            +
                # Fetch the pinned messages in the channel.
         
     | 
| 
      
 147 
     | 
    
         
            +
                # @macro async
         
     | 
| 
      
 148 
     | 
    
         
            +
                # @macro http
         
     | 
| 
      
 149 
     | 
    
         
            +
                #
         
     | 
| 
      
 150 
     | 
    
         
            +
                # @return [Async::Task<Array<Discorb::Message>>] The pinned messages in the channel.
         
     | 
| 
      
 151 
     | 
    
         
            +
                #
         
     | 
| 
      
 152 
     | 
    
         
            +
                def fetch_pins
         
     | 
| 
      
 153 
     | 
    
         
            +
                  Async do
         
     | 
| 
      
 154 
     | 
    
         
            +
                    _resp, data = @client.http.get("/channels/#{channel_id.wait}/pins").wait
         
     | 
| 
      
 155 
     | 
    
         
            +
                    data.map { |pin| Message.new(@client, pin) }
         
     | 
| 
      
 156 
     | 
    
         
            +
                  end
         
     | 
| 
      
 157 
     | 
    
         
            +
                end
         
     | 
| 
      
 158 
     | 
    
         
            +
             
     | 
| 
      
 159 
     | 
    
         
            +
                #
         
     | 
| 
      
 160 
     | 
    
         
            +
                # Pin a message in the channel.
         
     | 
| 
      
 161 
     | 
    
         
            +
                # @macro async
         
     | 
| 
      
 162 
     | 
    
         
            +
                # @macro http
         
     | 
| 
      
 163 
     | 
    
         
            +
                #
         
     | 
| 
      
 164 
     | 
    
         
            +
                # @param [Discorb::Message] message The message to pin.
         
     | 
| 
      
 165 
     | 
    
         
            +
                # @param [String] reason The reason of pinning the message.
         
     | 
| 
      
 166 
     | 
    
         
            +
                #
         
     | 
| 
      
 167 
     | 
    
         
            +
                def pin_message(message, reason: nil)
         
     | 
| 
      
 168 
     | 
    
         
            +
                  Async do
         
     | 
| 
      
 169 
     | 
    
         
            +
                    @client.http.put("/channels/#{channel_id.wait}/pins/#{message.id}", {}, audit_log_reason: reason).wait
         
     | 
| 
      
 170 
     | 
    
         
            +
                  end
         
     | 
| 
      
 171 
     | 
    
         
            +
                end
         
     | 
| 
      
 172 
     | 
    
         
            +
             
     | 
| 
      
 173 
     | 
    
         
            +
                #
         
     | 
| 
      
 174 
     | 
    
         
            +
                # Unpin a message in the channel.
         
     | 
| 
      
 175 
     | 
    
         
            +
                # @macro async
         
     | 
| 
      
 176 
     | 
    
         
            +
                # @macro http
         
     | 
| 
      
 177 
     | 
    
         
            +
                #
         
     | 
| 
      
 178 
     | 
    
         
            +
                # @param [Discorb::Message] message The message to unpin.
         
     | 
| 
      
 179 
     | 
    
         
            +
                # @param [String] reason The reason of unpinning the message.
         
     | 
| 
      
 180 
     | 
    
         
            +
                #
         
     | 
| 
      
 181 
     | 
    
         
            +
                def unpin_message(message, reason: nil)
         
     | 
| 
      
 182 
     | 
    
         
            +
                  Async do
         
     | 
| 
      
 183 
     | 
    
         
            +
                    @client.http.delete("/channels/#{channel_id.wait}/pins/#{message.id}", audit_log_reason: reason).wait
         
     | 
| 
      
 184 
     | 
    
         
            +
                  end
         
     | 
| 
      
 185 
     | 
    
         
            +
                end
         
     | 
| 
      
 186 
     | 
    
         
            +
             
     | 
| 
       145 
187 
     | 
    
         
             
                #
         
     | 
| 
       146 
188 
     | 
    
         
             
                # Trigger the typing indicator in the channel.
         
     | 
| 
       147 
189 
     | 
    
         
             
                # @macro async
         
     |