Skip to content

Commit

Permalink
Message events.
Browse files Browse the repository at this point in the history
  • Loading branch information
Droid00000 committed Dec 10, 2024
1 parent 476897a commit ed92ac6
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/discordrb/events/message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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<Hash>, 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.
Expand All @@ -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<Hash>, 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.
Expand All @@ -47,8 +49,9 @@ def send_embed(message = '', embed = nil, attachments = nil, tts = false, allowe
# @param attachments [Array<File>] 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<Hash>, 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
Expand Down

0 comments on commit ed92ac6

Please sign in to comment.