java.lang.Object
io.github.dexrnzacattack.rrdiscordbridge.discord.DiscordBot

public class DiscordBot extends Object
The Discord bot
  • Field Details

    • webhookClient

      public club.minnced.discord.webhook.WebhookClient webhookClient
      The webhook client
    • webhook

      public net.dv8tion.jda.api.entities.Webhook webhook
      The webhook
    • self

      public net.dv8tion.jda.api.entities.User self
      The bot's user
    • jda

      public net.dv8tion.jda.api.JDA jda
      The JDA instance
    • updatePlayerCountRunnable

      public final Runnable updatePlayerCountRunnable
      Updates the player count
  • Constructor Details

    • DiscordBot

      public DiscordBot()
      Creates the bot
  • Method Details

    • start

      public void start() throws InterruptedException
      Starts the bot
      Throws:
      InterruptedException - If the bot is interrupted while starting
    • stop

      public void stop()
      Stops the bot
    • setPlayerCount

      public void setPlayerCount()
      Sets the RPC status
    • setPlayerCount

      public void setPlayerCount(int i)
      Sets the RPC status
      Parameters:
      i - The new player count
    • getName

      public static String getName(net.dv8tion.jda.api.entities.Member member)
    • getName

      public static String getName(net.dv8tion.jda.api.entities.User user)
      Gets the name of a user based on the config settings
      Parameters:
      user - The user
      Returns:
      The name of the user
    • sendPlayerMessage

      public void sendPlayerMessage(String playerName, String message, ICancellable event)
      Sends a message using a webhook that uses the player's name and skin.
      Parameters:
      playerName - The name of the player to use
      message - The message content
      event - The cancellable event
    • sendPlayerMessage

      public void sendPlayerMessage(String playerName, String message)
      Sends a message using a webhook that uses the player's name and skin.
      Parameters:
      playerName - The player name
      message - The message
    • sendPlayerMessage

      public static void sendPlayerMessage(String playerName, String message, club.minnced.discord.webhook.WebhookClient wc)
      Sends a message using a provided webhook that uses the player's name and skin.
      Parameters:
      playerName - The player name
      message - The message
      wc - The webhook
    • sendPlayerMessage

      public void sendPlayerMessage(Settings.Events eventType, String playerName, String message)
      Sends a message using a webhook that uses the player's name and skin.
      Parameters:
      eventType - The event type (used for Settings.enabledEvents).
      playerName - The player name
      message - The message
    • sendPlayerMessage

      public void sendPlayerMessage(String playerName, String playerSkinName, String message)
      Sends a message using a webhook that uses the player's name and skin.
      Parameters:
      playerName - The player name
      playerSkinName - The name of the player that you want to use as the skin
      message - The message
    • sendPlayerMessage

      public void sendPlayerMessage(Settings.Events eventType, String playerName, String playerSkinName, String message)
      Sends a message using a webhook that uses the player's name and skin.
      Parameters:
      eventType - The event type (used for Settings.enabledEvents).
      playerName - The player name
      playerSkinName - The name of the player that you want to use as the skin
      message - The message
    • sendPlayerEvent

      public void sendPlayerEvent(Settings.Events eventType, String playerName, String description, Color color, String title)
      Sends an embed that uses the player's info as the author info to the Discord channel
      Parameters:
      eventType - The event type (used for Settings.enabledEvents).
      playerName - The name of the player that you want to be used for the author info.
      description - Message in the description part of the embed.
      color - Color of the side of the embed.
      title - Message in the title part of the embed.
    • sendPlayerEvent

      public void sendPlayerEvent(Settings.Events eventType, String playerName, String authorName, String description, Color color, String title, String footer)
      Sends an embed that uses the player's skin as the author picture to the Discord channel
      Parameters:
      eventType - The event type (used for Settings.enabledEvents).
      playerName - The name of the player that you want to be used for the author picture.
      authorName - The name of the author that you want to be used for the author name.
      description - Message in the description part of the embed.
      color - Color of the side of the embed.
      title - Message in the title part of the embed.
      footer - Message in the footer part of the embed
    • sendEvent

      public void sendEvent(Settings.Events eventType, net.dv8tion.jda.api.entities.MessageEmbed.AuthorInfo author, String description, Color color, String title)
      Sends an embed for an event
      Parameters:
      eventType - The event type (used for Settings.enabledEvents).
      author - The author info.
      description - Message in the description part of the embed.
      color - Color of the side of the embed.
      title - Message in the title part of the embed.
    • sendMessage

      public void sendMessage(String message)
      Sends a message to the channel
      Parameters:
      message - The message
    • sendMessage

      public static net.dv8tion.jda.api.entities.Message sendMessage(String message, net.dv8tion.jda.api.entities.channel.concrete.TextChannel channel)
      Sends a message to a channel
      Parameters:
      message - The message
      channel - The channel to send the message in
      Returns:
      The sent message
    • sendMessage

      public net.dv8tion.jda.api.entities.Message sendMessage(String message, String channel)
      Sends a message to a channel
      Parameters:
      message - The message
      channel - The channel to send the message in
    • editMessage

      public static void editMessage(String newMessage, net.dv8tion.jda.api.entities.Message msg)
      Edits an existing message
      Parameters:
      newMessage - The new message content
      msg - The message you want to edit