onyxcord 4.0.0.beta.3 → 4.0.0.beta.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 901e2f688c9dbdba460be0bc9ca04241d8e8d941a956456e43b7169936f9986d
4
- data.tar.gz: b3e2fedd82bf7611f6db22fd7545c33ba6d6ad28356ceb25b3f8dbe00958a507
3
+ metadata.gz: 8c1aef8e235629f3e51f37d82e63ef079cf50a6f88366cc2d97baa4db0db55a2
4
+ data.tar.gz: cf28816af87907143044fa3c58e8a0f1766270d6683da28cd172dc04d450cf45
5
5
  SHA512:
6
- metadata.gz: c6d0ad6d5d2f001a0812247dc63848785f576ec095301984e73d6e35cbfa2b4abf37cad7b0194e13226ee565add9b3b2f3a5a163cd2c6d821aa22afc8cb8e46a
7
- data.tar.gz: ad0d421321d472b94c254347ca48931921fbe4c8e9bc7a27c9d622c7af5a3ba0e98b1e47c5ec950ae6aedd470ccb3a2344ab41bee482f9d0cca405b7e6550ca0
6
+ metadata.gz: fa754a8ea4ef26e1a8dbd77d463df3b41f22b2265579ac9fb0c9f592abd96e39ead4c0bd39877be04c3f96749e0afcaf77420dcd25b3ffd579f9cafd0a564058
7
+ data.tar.gz: fc089a83c0bb67875b4252de1f841f1a170f661c7f2aef70a1efe7943e7b327b06c2747ec3692a62648e64b20eea02b50721722ca10ff42520d8bf15f70d61a3
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OnyxCord
4
- VERSION = '4.0.0.beta.3'
4
+ VERSION = '4.0.0.beta.5'
5
5
  end
@@ -9,19 +9,28 @@ module OnyxCord::Events
9
9
  # @return [Channel] the channel in which this event occurred
10
10
  attr_reader :channel
11
11
 
12
- # Sends a message to the channel this message was sent in, right now. It is usually preferable to use {#<<} instead
13
- # because it avoids rate limiting problems
14
- # @param content [String] The message to send to the channel
15
- # @param tts [true, false] Whether or not this message should be sent using Discord text-to-speech.
16
- # @param embed [Hash, OnyxCord::Webhooks::Embed, nil] The rich embed to append to this message.
17
- # @param attachments [Array<File>] Files that can be referenced in embeds via `attachment://file.png`
18
- # @param allowed_mentions [Hash, OnyxCord::AllowedMentions, false, nil] Mentions that are allowed to ping on this message. `false` disables all pings
19
- # @param message_reference [Message, String, Integer, nil] The message, or message ID, to reply to if any.
20
- # @param components [View, Array<Hash>, nil] A collection of components to attach to the message.
21
- # @param flags [Integer] Flags for this message. Currently only SUPPRESS_EMBEDS (1 << 2), SUPPRESS_NOTIFICATIONS (1 << 12), and IS_COMPONENTS_V2 (1 << 15) can be set.
12
+ # Sends a message to the channel this message was sent in, right now.
13
+ # Supports both positional and keyword arguments:
14
+ #
15
+ # event.send_message('Hello')
16
+ # event.send_message('Hello', false, { title: 'Hi' })
17
+ # event.send_message('Hello', embed: { title: 'Hi' })
18
+ # event.send_message(embed: { title: 'Hi' })
19
+ #
22
20
  # @return [OnyxCord::Message] the message that was sent
23
- def send_message(content, tts = false, embed = nil, attachments = nil, allowed_mentions = nil, message_reference = nil, components = nil, flags = 0)
24
- channel.send_message(content, tts, embed, attachments, allowed_mentions, message_reference, components, flags)
21
+ def send_message(content = nil, tts = false, embed = nil, attachments = nil,
22
+ allowed_mentions = nil, message_reference = nil,
23
+ components = nil, flags = 0,
24
+ embeds: nil, **_kwargs)
25
+ # Support keyword args: event.send_message('text', embed: { ... })
26
+ embeds = Array(embed) if embed && !embeds
27
+ embeds ||= []
28
+
29
+ # Use first embed for backward-compatible positional API
30
+ first_embed = embeds.first
31
+
32
+ channel.send_message(content || '', tts, first_embed, attachments,
33
+ allowed_mentions, message_reference, components, flags)
25
34
  end
26
35
 
27
36
  # The same as {#send_message}, but yields a {Webhooks::Embed} for easy building of embedded content inside a block.
@@ -143,6 +143,9 @@ module OnyxCord
143
143
 
144
144
  alias_method :message, :to_message
145
145
 
146
+ # Discord.js-compatible aliases
147
+ alias reply respond
148
+
146
149
  # @!visibility private
147
150
  def inspect
148
151
  "<Interaction::Message content=#{@content.inspect} embeds=#{@embeds.inspect} channel_id=#{@channel_id} server_id=#{@server_id} author=#{@author.inspect}>"
@@ -325,6 +325,16 @@ module OnyxCord
325
325
  alias delete_original delete_response
326
326
  alias followup send_message
327
327
 
328
+ # Discord.js-compatible aliases
329
+ alias reply respond
330
+ alias deferReply defer
331
+ alias editReply edit_response
332
+ alias deleteReply delete_response
333
+ alias followUp send_message
334
+ alias update update_message
335
+ alias deferUpdate defer_update
336
+ alias showModal show_modal
337
+
328
338
  # @param message [String, Integer, InteractionMessage, Message] The message created by this interaction to be edited.
329
339
  # @param content [String] The message content.
330
340
  # @param embeds [Array<Hash, Webhooks::Embed>] The embeds for the message.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onyxcord
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.beta.3
4
+ version: 4.0.0.beta.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gustavo Silva