Interface MessageAuthor

    • Method Detail

      • getMessage

        Message getMessage​()
        Gets the message.
        Returns:
        The message.
      • getDisplayName

        default String getDisplayName​()
        Gets the display name of the author.
        Returns:
        The display name of the author.
      • getDiscriminatedName

        default String getDiscriminatedName​()
        If the author is a user, gets the discriminated name of the user, e. g. Bastian#8222, otherwise just gets the name of the author.
        Returns:
        The discriminated name of the user or the name of the author.
      • getDiscriminator

        Optional<String> getDiscriminator​()
        Gets the discriminator of the author if the author is a user.
        Returns:
        The discriminator of the author if the author is a user.
      • getAvatar

        Icon getAvatar​()
        Gets the avatar of the author.
        Returns:
        The avatar of the author.
      • isUser

        boolean isUser​()
        Checks if the author of the message is a user.

        A user might be a human user using any number of Discord client applications or a bot user connecting via Discord's bot api. See isRegularUser() and isBotUser() for further detail.

        The opposite of this method is isWebhook().

        Returns:
        Whether the author is a user or not.
      • isBotOwner

        default boolean isBotOwner​()
        Checks if the author is the owner of the current account. Always returns false if logged in to a user account.
        Returns:
        Whether the author is the owner of the current account.
      • isBotUser

        default boolean isBotUser​()
        Checks if the author is a bot user.

        Keep in mind, that if this returns false, it does not mean that the message was sent by a regular user. It's still possible that the message was sent via a webhook.

        Returns:
        Whether the author is a bot user.
      • isRegularUser

        default boolean isRegularUser​()
        Checks if the author is a regular user.

        Keep in mind, that if this returns false, it does not mean that the message was sent by a bot user. It's still possible that the message was sent via a webhook.

        Returns:
        Whether the author is a regular user.
      • canCreateChannelsOnServer

        default boolean canCreateChannelsOnServer​()
        Checks if the author can create new channels on the server where the message was sent. Always returns false if the author is not a user or the message was not sent on a server.
        Returns:
        Whether the author can create channels on the server or not.
      • canViewAuditLogOfServer

        default boolean canViewAuditLogOfServer​()
        Checks if the author can view the audit log of the server where the message was sent. Always returns false if the author is not a user or the message was not sent on a server.
        Returns:
        Whether the author can view the audit log of the server or not.
      • canChangeOwnNicknameOnServer

        default boolean canChangeOwnNicknameOnServer​()
        Checks if the author can change its own nickname in the server where the message was sent. Always returns false if the author is not a user or the message was not sent on a server.
        Returns:
        Whether the author can change its own nickname in the server or not.
      • canManageNicknamesOnServer

        default boolean canManageNicknamesOnServer​()
        Checks if the author can manage nicknames on the server where the message was sent. Always returns false if the author is not a user or the message was not sent on a server.
        Returns:
        Whether the author can manage nicknames on the server or not.
      • canMuteMembersOnServer

        default boolean canMuteMembersOnServer​()
        Checks if the author can mute members on the server where the message was sent. Always returns false if the author is not a user or the message was not sent on a server.
        Returns:
        Whether the author can mute members on the server or not.
      • canDeafenMembersOnServer

        default boolean canDeafenMembersOnServer​()
        Checks if the author can deafen members on the server where the message was sent. Always returns false if the author is not a user or the message was not sent on a server.
        Returns:
        Whether the author can deafen members on the server or not.
      • canMoveMembersOnServer

        default boolean canMoveMembersOnServer​()
        Checks if the author can move members on the server where the message was sent. Always returns false if the author is not a user or the message was not sent on a server.
        Returns:
        Whether the author can move members on the server or not.
      • canManageEmojisOnServer

        default boolean canManageEmojisOnServer​()
        Checks if the author can manage emojis on the server where the message was sent. Always returns false if the author is not a user or the message was not sent on a server.
        Returns:
        Whether the author can manage emojis on the server or not.
      • canManageRolesOnServer

        default boolean canManageRolesOnServer​()
        Checks if the author can manage roles on the server where the message was sent. Always returns false if the author is not a user or the message was not sent on a server.
        Returns:
        Whether the author can manage roles on the server or not.
      • canManageServer

        default boolean canManageServer​()
        Checks if the author can manage the server where the message was sent. Always returns false if the author is not a user or the message was not sent on a server.
        Returns:
        Whether the author can manage the server or not.
      • canKickUsersFromServer

        default boolean canKickUsersFromServer​()
        Checks if the author can kick users from the server where the message was sent. Always returns false if the author is not a user or the message was not sent on a server.
        Returns:
        Whether the author can kick users from the server or not.
      • canKickUserFromServer

        default boolean canKickUserFromServer​(User userToKick)
        Checks if the author can kick the user from the server where the message was sent. This methods also considers the position of the user roles. Always returns false if the author is not a user or the message was not sent on a server.
        Parameters:
        userToKick - The user which should be kicked.
        Returns:
        Whether the author can kick the user from the server or not.
      • canBanUsersFromServer

        default boolean canBanUsersFromServer​()
        Checks if the author can ban users from the server where the message was sent. Always returns false if the author is not a user or the message was not sent on a server.
        Returns:
        Whether the author can ban users from the server or not.
      • canBanUserFromServer

        default boolean canBanUserFromServer​(User userToBan)
        Checks if the author can ban the user from the server where the message was sent. This methods also considers the position of the user roles. Always returns false if the author is not a user or the message was not sent on a server.
        Parameters:
        userToBan - The user which should be banned.
        Returns:
        Whether the author can ban the user from the server or not.
      • canSeeChannel

        default boolean canSeeChannel​()
        Checks if the author can see the channel where the message was sent. In private chats (private channel or group channel) this always returns true if the user is part of the chat. Always returns false if the author is not a user or the message was not sent on a server.
        Returns:
        Whether the author can see the channel or not.
      • canSeeAllChannelsInCategory

        default boolean canSeeAllChannelsInCategory​()
        Checks if the author can see all channels in the category of the channel where the message was sent. Always returns false if the author is not a user. Always returns true if the channel is not categorizable or has no category.
        Returns:
        Whether the user can see all channels in this category or not.
      • canCreateInstantInviteToTextChannel

        default boolean canCreateInstantInviteToTextChannel​()
        Checks if the author can create an instant invite to the channel where the message was sent. Always returns false if the author is not a user or the message was not sent on a server.
        Returns:
        Whether the author can create an instant invite to the channel or not.
      • canWriteInTextChannel

        default boolean canWriteInTextChannel​()
        Checks if the author can send messages in the channel where the message was sent. In private chats (private channel or group channel) this always returns true if the user is part of the chat. Please notice, this does not check if a user has blocked private messages! Always returns false if the author is not a user.
        Returns:
        Whether the author can write messages in the channel or not.
      • canUseExternalEmojisInTextChannel

        default boolean canUseExternalEmojisInTextChannel​()
        Checks if the author can use external emojis in the channel where the message was sent. In private chats (private channel or group channel) this always returns true if the author is part of the chat. Please notice, this does not check if a user has blocked private messages! It also doesn't check if the user is even able to send any external emojis (twitch subscription or nitro). Always returns false if the author is not a user.
        Returns:
        Whether the author can use external emojis in the channel or not.
      • canEmbedLinksInTextChannel

        default boolean canEmbedLinksInTextChannel​()
        Checks if the author can use embed links in the channel where the message was sent. In private chats (private channel or group channel) this always returns true if the author is part of the chat. Please notice, this does not check if a user has blocked private messages! Always returns false if the author is not a user.
        Returns:
        Whether the author can embed links in the channel or not.
      • canReadMessageHistoryOfTextChannel

        default boolean canReadMessageHistoryOfTextChannel​()
        Checks if the author can read the message history of the channel where the message was sent. In private chats (private channel or group channel) this always returns true if the user is part of the chat. Always returns false if the author is not a user.
        Returns:
        Whether the author can read the message history of the channel or not.
      • canUseTtsInTextChannel

        default boolean canUseTtsInTextChannel​()
        Checks if the author can use tts (text to speech) in the channel where the message was sent. In private chats (private channel or group channel) this always returns true if the user is part of the chat. Please notice, this does not check if a user has blocked private messages! Always returns false if the author is not a user.
        Returns:
        Whether the author can use tts in the channel or not.
      • canAttachFilesToTextChannel

        default boolean canAttachFilesToTextChannel​()
        Checks if the author can attach files in the channel where the message was sent. Always returns false if the author is not a user.
        Returns:
        Whether the author can attach files in the channel or not.
      • canAddNewReactionsInTextChannel

        default boolean canAddNewReactionsInTextChannel​()
        Checks if the author is allowed to add new reactions to messages in the channel where the message was sent. Always returns false if the author is not a user.
        Returns:
        Whether the author is allowed to add new reactions to messages in the channel or not.
      • canManageMessagesInTextChannel

        default boolean canManageMessagesInTextChannel​()
        Checks if the author can manage messages (delete or pin them or remove reactions of others) in the channel where the message was sent. In private chats (private channel or group channel) this always returns true if the user is part of the chat. Always returns false if the author is not a user.
        Returns:
        Whether the author can manage messages in the channel or not.
      • canRemoveReactionsOfOthersInTextChannel

        default boolean canRemoveReactionsOfOthersInTextChannel​()
        Checks if the author can remove reactions of other users in the channel where the message was sent. In private chats (private channel or group channel) this always returns true if the user is part of the chat. Always returns false if the author is not a user.
        Returns:
        Whether the author can remove reactions of others in the channel or not.
      • canMentionEveryoneInTextChannel

        default boolean canMentionEveryoneInTextChannel​()
        Checks if the author can mention everyone (@everyone) in the channel where the message was sent. In private chats (private channel or group channel) this always returns true if the user is part of the chat. Always returns false if the author is not a user.
        Returns:
        Whether the given user can mention everyone (@everyone) or not.
      • canConnectToVoiceChannel

        default boolean canConnectToVoiceChannel​()
        Checks if the author can connect to the voice channel where the message was sent. In private chats (private channel or group channel) this always returns true if the user is part of the chat. Always returns false if the author is not a user or if the channel is not a voice channel.
        Returns:
        Whether the author can connect to the voice channel or not.
      • canMuteUsersInVoiceChannel

        default boolean canMuteUsersInVoiceChannel​()
        Checks if the author can mute other users in the voice channel where the message was sent. In private chats (private channel or group channel) this always returns @{code false}. Always returns false if the author is not a user or if the channel is not a voice channel.
        Returns:
        Whether the author can mute other users in the voice channel or not.
      • canAddNewReactionsToMessage

        default boolean canAddNewReactionsToMessage​()
        Checks if the author is allowed to add new reactions to the message. Always returns false if the author is not a user.
        Returns:
        Whether the author is allowed to add new reactions to the message or not.
      • canDeleteMessage

        default boolean canDeleteMessage​()
        Checks if the author can delete the message. Always returns false if the author is not a user.
        Returns:
        Whether the author can delete the message or not.
      • isServerAdmin

        default boolean isServerAdmin​()
        Checks if the author is an administrator of the server where the message was sent. Always returns false if the author is not a user or the message was not sent on a server.
        Returns:
        Whether the author is an administrator of the server or not.
      • asUser

        default Optional<User> asUser​()
        Gets the author as user.
        Returns:
        The author as user.
      • isWebhook

        boolean isWebhook​()
        Checks if the author is a webhook.

        The opposite of this method is isUser().

        Returns:
        Whether the author is a webhook or not.
      • isYourself

        default boolean isYourself​()
        Gets if this author is the user of the connected account.
        Returns:
        Whether this author is the user of the connected account or not.
        See Also:
        DiscordApi.getYourself()