From ed92ac6dc86849e75c58eda09a274dfd5b88d073 Mon Sep 17 00:00:00 2001 From: DroidDevelopment Date: Tue, 10 Dec 2024 18:36:21 -0500 Subject: [PATCH] Message events. --- lib/discordrb/events/message.rb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/discordrb/events/message.rb b/lib/discordrb/events/message.rb index f72446691..7aaa8c04b 100644 --- a/lib/discordrb/events/message.rb +++ b/lib/discordrb/events/message.rb @@ -18,9 +18,10 @@ module Respondable # @param allowed_mentions [Hash, Discordrb::AllowedMentions, false, nil] Mentions that are allowed to ping on this message. `false` disables all pings # @param message_reference [Message, String, Integer, nil] The message, or message ID, to reply to if any. # @param components [View, Array, nil] A collection of components to attach to the message. + # @param flags [Integer] Flags for this message. Currently only SUPPRESS_EMBEDS (1 << 2) and SUPPRESS_NOTIFICATIONS (1 << 12) can be set. # @return [Discordrb::Message] the message that was sent - def send_message(content, tts = false, embed = nil, attachments = nil, allowed_mentions = nil, message_reference = nil, components = nil) - channel.send_message(content, tts, embed, attachments, allowed_mentions, message_reference, components) + def send_message(content, tts = false, embed = nil, attachments = nil, allowed_mentions = nil, message_reference = nil, components = nil, flags = nil) + channel.send_message(content, tts, embed, attachments, allowed_mentions, message_reference, components, flags) end # The same as {#send_message}, but yields a {Webhooks::Embed} for easy building of embedded content inside a block. @@ -32,11 +33,12 @@ def send_message(content, tts = false, embed = nil, attachments = nil, allowed_m # @param allowed_mentions [Hash, Discordrb::AllowedMentions, false, nil] Mentions that are allowed to ping on this message. `false` disables all pings # @param message_reference [Message, String, Integer, nil] The message, or message ID, to reply to if any. # @param components [View, Array, nil] A collection of components to attach to the message. + # @param flags [Integer] Flags for this message. Currently only SUPPRESS_EMBEDS (1 << 2) and SUPPRESS_NOTIFICATIONS (1 << 12) can be set. # @yield [embed] Yields the embed to allow for easy building inside a block. # @yieldparam embed [Discordrb::Webhooks::Embed] The embed from the parameters, or a new one. # @return [Message] The resulting message. - def send_embed(message = '', embed = nil, attachments = nil, tts = false, allowed_mentions = nil, message_reference = nil, components = nil, &block) - channel.send_embed(message, embed, attachments, tts, allowed_mentions, message_reference, components, &block) + def send_embed(message = '', embed = nil, attachments = nil, tts = false, allowed_mentions = nil, message_reference = nil, components = nil, flags = nil, &block) + channel.send_embed(message, embed, attachments, tts, allowed_mentions, message_reference, components, flags, &block) end # Sends a temporary message to the channel this message was sent in, right now. @@ -47,8 +49,9 @@ def send_embed(message = '', embed = nil, attachments = nil, tts = false, allowe # @param attachments [Array] Files that can be referenced in embeds via `attachment://file.png` # @param allowed_mentions [Hash, Discordrb::AllowedMentions, false, nil] Mentions that are allowed to ping on this message. `false` disables all pings # @param components [View, Array, nil] A collection of components to attach to the message. - def send_temporary_message(content, timeout, tts = false, embed = nil, attachments = nil, allowed_mentions = nil, components = nil) - channel.send_temporary_message(content, timeout, tts, embed, attachments, allowed_mentions, components) + # @param flags [Integer] Flags for this message. Currently only SUPPRESS_EMBEDS (1 << 2) and SUPPRESS_NOTIFICATIONS (1 << 12) can be set. + def send_temporary_message(content, timeout, tts = false, embed = nil, attachments = nil, allowed_mentions = nil, components = nil, flags = nil) + channel.send_temporary_message(content, timeout, tts, embed, attachments, allowed_mentions, components, flags) end # Adds a string to be sent after the event has finished execution. Avoids problems with rate limiting because only