Interface Message

All Superinterfaces:
Entity, HasChannel, Snowflake, Timestamped
All Known Implementing Classes:
MessageImpl

public interface Message extends Snowflake, HasChannel
A single message in Discord.
Since:
9/4/18.
Author:
amy
  • Method Details

    • type

      @Nonnull @CheckReturnValue MessageType type()
      The type of message. Use this to tell normal messages from system messages.
      Returns:
      enum representing the message type. Never null.
    • tts

      @CheckReturnValue boolean tts()
      Whether or not the message was sent using the /TTS command, making clients read
      the message aloud using their text-to-speech engine.
      Returns:
      True if the message is to be spoken, false otherwise.
    • timestamp

      @Nonnull @CheckReturnValue OffsetDateTime timestamp()
      When the message was sent.
      Returns:
      Date and time the message was sent.
    • pinned

      @CheckReturnValue boolean pinned()
      Whether the message is pinned.
      This will always be false on new messages.
      Returns:
      True if the message is pinned, false otherwise.
    • mentionsEveryone

      @CheckReturnValue boolean mentionsEveryone()
      Whether the message mentions everyone.
      Returns:
      True if the message mentions everyone, false otherwise.
    • nonce

      @Nullable @CheckReturnValue String nonce()
      The message's nonce snowflake.
      Nonces are used to validating messages have been sent, as two identical messages
      with the same nonce are considered to be re-sent due to network errors.
      Returns:
      unique String nonce for the message. Can be null.
    • mentionedUsers

      @Nonnull @CheckReturnValue List<User> mentionedUsers()
      List of users @mentioned by this message.
      Returns:
      List of Users. Never null.
    • mentionedMembers

      @Nonnull @CheckReturnValue List<Member> mentionedMembers()
      A list of members mentioned by this message. Will contain the same users as mentionedUsers(). Will always be empty for DMs.
      Returns:
      List of members. Never null.
    • referencedMessage

      @Nullable @CheckReturnValue Message referencedMessage()
      The message that was referenced by this message. Used for inline replies. If null, the message was deleted. If present and not null, it is the message that this message is replying to. If not present and the type is MessageType.REPLY, the backend couldn't fetch the relevant message.
      Returns:
      A message reference.
    • mentionedRoles

      @Nonnull @CheckReturnValue default io.reactivex.rxjava3.core.Observable<Role> mentionedRoles()
      List of roles @mentioned by this message.
      All users with these roles will also be mentioned
      Returns:
      List of roles. Never null.
    • mentionedRoleIds

      @Nonnull @CheckReturnValue List<String> mentionedRoleIds()
      List of the ids of all roles @mentioned by this message.
      All users with at least one of these roles will also be mentioned.
      Returns:
      List of role ids. Never null.
    • member

      @Nullable @CheckReturnValue Member member()
      The author of the message, as a member of the guild.
      Can be null if the author is no longer in the guild, or if the message was sent
      by a fake user.
      Returns:
      Member representation of the author. Can be null.
    • embeds

      @Nonnull @CheckReturnValue List<Embed> embeds()
      List of embeds in the message.
      Returns:
      List of embeds. Never null.
    • editedTimestamp

      @Nullable @CheckReturnValue OffsetDateTime editedTimestamp()
      When the message was last edited, if ever.
      Previous edits are not exposed, only the most recent.
      Returns:
      The date and time the message was last edited. Null if the message was never edited.
    • content

      @Nonnull @CheckReturnValue String content()
      The message's content. Is just an empty string for embed-only messages.
      Returns:
      String containing the message body. Never null.
    • channel

      @Nonnull @CheckReturnValue default io.reactivex.rxjava3.core.Maybe<MessageChannel> channel()
      The channel this message was sent in.
      Returns:
      The MessageChannel object representing the channel this message was sent in. Should not be null.
    • author

      @Nonnull @CheckReturnValue User author()
      Guild-agnostic representation of the author of the message.
      Returns:
      The author of the message. Never null.
      See Also:
    • attachments

      @Nonnull @CheckReturnValue List<Message.Attachment> attachments()
      List of files sent with the message.
      Returns:
      List of files sent with the message. Never null.
    • reactions

      @Nonnull @CheckReturnValue List<Message.Reaction> reactions()
      List of reactions added to the message.
      This list will not be updated.
      Returns:
      List of reactions added to the message. Never null.
    • activity

      @Nullable @CheckReturnValue Message.MessageActivity activity()
      Returns:
      The message's activity. Sent in Rich Presence-related embeds. May be null.
    • application

      @Nullable @CheckReturnValue Message.MessageApplication application()
      Returns:
      The message's application. Sent in Rich Presence-related embeds. May be null.
    • messageReference

      @Nullable @CheckReturnValue MessageReference messageReference()
      Returns:
      Reference data sent with crossposted messages.
    • flagsRaw

      @CheckReturnValue int flagsRaw()
      Returns:
      Raw bits of flags set on this message.
    • stickers

      @Nonnull @CheckReturnValue List<Sticker> stickers()
      Returns:
      The stickers sent with this message.
    • flags

      @Nonnull @CheckReturnValue default Set<MessageFlag> flags()
      Returns:
      The set of flags set on this message.
    • mentionedChannels

      @Nonnull @CheckReturnValue List<ChannelMention> mentionedChannels()
      Returns:
      All channels mentioned in this message. Not all messages will have this, nor will all channels mentioned in a message have a corresponding mention object.
    • components

      @Nonnull @CheckReturnValue List<MessageComponent> components()
      Returns:
      All components attached to this message. Top-level components must be ActionRows.
    • guildId

      @Nullable @CheckReturnValue default String guildId()
      The snowflake ID of the guild this message was sent in.
      Returns:
      String representing the guild ID. Null if sent in DMs, or if fetched/created via REST API.
    • guildIdAsLong

      @CheckReturnValue long guildIdAsLong()
      The snowflake ID of the guild this message was sent in.
      Returns:
      Long representing the guild ID. Null if sent in DMs.
    • guild

      @Nonnull @CheckReturnValue default io.reactivex.rxjava3.core.Maybe<Guild> guild()
      The guild this message was sent in. May be null.
      Returns:
      The Guild object for the guild this message was sent in. Will be null if the message is a DM.
    • webhookId

      @Nullable @CheckReturnValue default String webhookId()
      The snowflake ID of the webhook this message was sent by.
      Returns:
      String representing the webhook ID. Null if not sent by a webhook.
    • webhookIdAsLong

      @CheckReturnValue long webhookIdAsLong()
      The snowflake ID of the webhook this message was sent by.
      Returns:
      Long representing the webhook ID. 0 if not sent by a webhook.
    • asReference

      default MessageReference asReference()
      Returns:
      A reference to this message, usable for ex. quoting.
    • react

      @Nonnull default io.reactivex.rxjava3.core.Completable react(@Nonnull Emoji emoji)
      Adds a reaction to this message.
      Note: this object will not be updated.
      Parameters:
      emoji - Emoji to react with.
      Returns:
      Future for the reaction.
    • react

      @Nonnull default io.reactivex.rxjava3.core.Completable react(@Nonnull String emoji)
      Adds a reaction to this message.
      Note: this object will not be updated.
      Parameters:
      emoji - Emoji to react with.
      Returns:
      Future for the reaction.
    • delete

      @Nonnull default io.reactivex.rxjava3.core.Completable delete(@Nullable String reason)
    • delete

      @Nonnull @CheckReturnValue default io.reactivex.rxjava3.core.Completable delete()
    • edit

      @Nonnull @CheckReturnValue default io.reactivex.rxjava3.core.Single<Message> edit(@Nonnull String content)
    • edit

      @Nonnull @CheckReturnValue default io.reactivex.rxjava3.core.Single<Message> edit(@Nonnull Embed embed)
    • edit

      @Nonnull @CheckReturnValue default io.reactivex.rxjava3.core.Single<Message> edit(@Nonnull Message message)
    • edit

      @Nonnull @CheckReturnValue default io.reactivex.rxjava3.core.Single<Message> edit(@Nonnull MessageOptions options)
    • respond

      @Nonnull @CheckReturnValue default io.reactivex.rxjava3.core.Single<Message> respond(@Nonnull String content)
      Send a message in the same channel as this message. This does not send a reply; see reply(String, boolean) for that functionality.
      Parameters:
      content - The message data to respond with.
      Returns:
      A Single that completes with the newly-created message.
    • respond

      @Nonnull @CheckReturnValue default io.reactivex.rxjava3.core.Single<Message> respond(@Nonnull Embed embed)
      Send a message in the same channel as this message. This does not send a reply; see reply(Embed, boolean) for that functionality.
      Parameters:
      embed - The message data to respond with.
      Returns:
      A Single that completes with the newly-created message.
    • respond

      @Nonnull @CheckReturnValue default io.reactivex.rxjava3.core.Single<Message> respond(@Nonnull Message message)
      Send a message in the same channel as this message. This does not send a reply; see reply(Message, boolean) for that functionality.
      Parameters:
      message - The message data to respond with.
      Returns:
      A Single that completes with the newly-created message.
    • respond

      @Nonnull @CheckReturnValue default io.reactivex.rxjava3.core.Single<Message> respond(@Nonnull MessageOptions options)
      Send a message in the same channel as this message. This does not send a reply; see reply(MessageOptions, boolean) for that functionality.
      Parameters:
      options - The message data to respond with.
      Returns:
      A Single that completes with the newly-created message.
    • reply

      @Nonnull @CheckReturnValue default io.reactivex.rxjava3.core.Single<Message> reply(@Nonnull String content, boolean ping)
      Reply to this message. This uses Discord's inline replies feature.
      Parameters:
      content - The message data to reply with.
      ping - Whether or not the reply should ping the user.
      Returns:
      A Single that completes with the newly-created message.
    • reply

      @Nonnull @CheckReturnValue default io.reactivex.rxjava3.core.Single<Message> reply(@Nonnull Embed embed, boolean ping)
      Reply to this message. This uses Discord's inline replies feature.
      Parameters:
      embed - The message data to reply with.
      ping - Whether or not the reply should ping the user.
      Returns:
      A Single that completes with the newly-created message.
    • reply

      @Nonnull @CheckReturnValue default io.reactivex.rxjava3.core.Single<Message> reply(@Nonnull Message message, boolean ping)
      Reply to this message. This uses Discord's inline replies feature.
      Parameters:
      message - The message data to reply with.
      ping - Whether or not the reply should ping the user.
      Returns:
      A Single that completes with the newly-created message.
    • reply

      @Nonnull @CheckReturnValue default io.reactivex.rxjava3.core.Single<Message> reply(@Nonnull MessageOptions options, boolean ping)
      Reply to this message. This uses Discord's inline replies feature.
      Parameters:
      options - The message data to reply with.
      Returns:
      A Single that completes with the newly-created message.
    • isRickRoll

      default boolean isRickRoll()
    • isGnome

      default boolean isGnome()