discorb 0.11.3 → 0.12.2

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.
@@ -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
data/lib/discorb/user.rb CHANGED
@@ -26,6 +26,9 @@ module Discorb
26
26
 
27
27
  include Discorb::Messageable
28
28
 
29
+ # @!attribute [r] mention
30
+ # @return [String] The user's mention.
31
+
29
32
  # @private
30
33
  def initialize(client, data)
31
34
  @client = client
@@ -43,6 +46,10 @@ module Discorb
43
46
  "#{@username}##{@discriminator}"
44
47
  end
45
48
 
49
+ def mention
50
+ "<@#{@id}>"
51
+ end
52
+
46
53
  alias to_s_user to_s
47
54
 
48
55
  def inspect
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: discorb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.3
4
+ version: 0.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - sevenc-nanashi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-17 00:00:00.000000000 Z
11
+ date: 2021-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async
@@ -77,11 +77,13 @@ files:
77
77
  - ".github/ISSUE_TEMPLATE/bug_report.md"
78
78
  - ".github/ISSUE_TEMPLATE/config.yml"
79
79
  - ".github/ISSUE_TEMPLATE/feature_request.md"
80
+ - ".github/PULL_REQUEST_TEMPLATE.md"
80
81
  - ".github/workflows/build_main.yml"
81
82
  - ".github/workflows/build_version.yml"
82
83
  - ".github/workflows/package_register.yml"
83
84
  - ".gitignore"
84
85
  - ".yardopts"
86
+ - CONTRIBUTING.md
85
87
  - Changelog.md
86
88
  - Gemfile
87
89
  - LICENSE.txt
@@ -161,6 +163,11 @@ files:
161
163
  - lib/discorb/integration.rb
162
164
  - lib/discorb/intents.rb
163
165
  - lib/discorb/interaction.rb
166
+ - lib/discorb/interaction/autocomplete.rb
167
+ - lib/discorb/interaction/command.rb
168
+ - lib/discorb/interaction/components.rb
169
+ - lib/discorb/interaction/response.rb
170
+ - lib/discorb/interaction/root.rb
164
171
  - lib/discorb/invite.rb
165
172
  - lib/discorb/log.rb
166
173
  - lib/discorb/member.rb