Interface DiscordService

All Known Implementing Classes:
JDADiscordService

public interface DiscordService
A class which provides numerous methods to interact with EssentialsX Discord.
  • Method Details

    • sendMessage

      void sendMessage(MessageType type, String message, boolean allowGroupMentions)
      Sends a message to a message type channel.
      Parameters:
      type - The message type/destination of this message.
      message - The exact message to be sent.
      allowGroupMentions - Whether the message should allow the pinging of roles, @here, or @everyone.
    • sendChatMessage

      void sendChatMessage(Player player, String chatMessage)
      Sends a chat message to the default chat channel with the same format used for regular chat messages specified in the EssentialsX Discord configuration.

      Note: Messages sent with this method will not fire a DiscordChatMessageEvent.

      Parameters:
      player - The player who send the message.
      chatMessage - The chat message the player has sent.
    • sendChatMessage

      void sendChatMessage(net.essentialsx.api.v2.ChatType chatType, Player player, String chatMessage)
      Sends a chat message to the appropriate chat channel depending on the chat type with the format specified for that type in the EssentialsX Discord configuration.

      Note: Messages sent with this method will not fire a DiscordChatMessageEvent.

      Parameters:
      player - The player who send the message.
      chatMessage - The chat message the player has sent.
    • isRegistered

      boolean isRegistered(String key)
      Checks if a MessageType by the given key is already registered.
      Parameters:
      key - The MessageType key to check.
      Returns:
      true if a MessageType with the provided key is registered, otherwise false.
    • registerMessageType

      void registerMessageType(Plugin plugin, MessageType type)
      Registers a message type to be used in the future.

      In the future, this method will automatically populate the message type in the EssentialsX Discord config.

      Parameters:
      type - The MessageType to be registered.
    • getInteractionController

      InteractionController getInteractionController()
      Gets the InteractionController instance.
      Returns:
      the InteractionController instance.
    • getMemberById

      Gets an InteractionMember by their Discord ID.
      Parameters:
      id - The ID of the member to look up.
      Returns:
      A future which will complete with the member or null if none is reachable.
    • getRole

      InteractionRole getRole(String id)
      Gets an InteractionRole by its Discord ID.
      Parameters:
      id - The ID of the role to look up.
      Returns:
      the role or null if none by that ID exists.
    • modifyMemberRoles

      CompletableFuture<Void> modifyMemberRoles(InteractionMember member, Collection<InteractionRole> addRoles, Collection<InteractionRole> removeRoles)
      Adds or removes roles to the given InteractionMember.
      Parameters:
      member - The member to add/remove roles to/from.
      addRoles - The roles to add to the member, or null to add none.
      removeRoles - The roles to remove from the member, or null to remove none.
      Returns:
      A future which will complete when all requests operations have been completed.
    • getInviteUrl

      String getInviteUrl()
      Gets the Discord invite URL given in the EssentialsX Discord configuration.
    • getUnsafe

      Unsafe getUnsafe()
      Gets unstable API that is subject to change at any time.
      Returns:
      the unsafe instance.
      See Also: