java.lang.Object
io.github.unknowncoder56.javaslc.User
io.github.unknowncoder56.javaslc.Bot

public class Bot extends User
The main class of the library containing all important methods, like to run the bot. This class cannot be instantiated directly, use BotBuilder instead.
See Also:
  • Method Details

    • run

      public void run()
      The method to run the bot. This method will throw a RuntimeException if the prefix, token or bot user ID is not set in the BotBuilder or later in Bot.
    • send

      public CompletableFuture<Void> send(String message, long serverId)
      This method sends a message to a server. This method will throw a RuntimeException if the bot is not in the server. To fix it add it to a server with join(long).
      Parameters:
      message - The message to send.
      serverId - The ID of the server to send the message to.
      Returns:
      A CompletableFuture that will be completed when the message is sent.
      See Also:
    • join

      public CompletableFuture<Void> join(long serverId)
      This method joins a server. This method will throw a RuntimeException if the bot is already in the server.
      Parameters:
      serverId - The ID of the server to join.
      Returns:
      A CompletableFuture that will be completed when the bot has joined the server.
    • change

      public CompletableFuture<Void> change(Bot.ChangeKey changeKey, String changeValue)
      This method changes a bot property defined in the Bot.ChangeKey enum.
      Parameters:
      changeKey - The key of the value to change.
      changeValue - The value to change the key to.
      Returns:
      A CompletableFuture that will be completed when the value is changed.
      See Also:
    • getPrefix

      public String getPrefix()
      Gets the prefix of the bot.
      Returns:
      The prefix of the bot.
    • setPrefix

      public void setPrefix(String prefix)
      Sets the prefix of the bot.
      Parameters:
      prefix - The prefix to set.
    • getStartListener

      public StartListener getStartListener()
      Gets the StartListener of the bot.
      Returns:
      The StartListener of the bot.
    • setStartListener

      public void setStartListener(StartListener startListener)
      Sets the StartListener of the bot.
      Parameters:
      startListener - The StartListener to set.
    • getBotUserId

      public long getBotUserId()
      Gets the user ID of the bot.
      Returns:
      The user ID of the bot.
    • getCommandListeners

      public ArrayList<CommandListener> getCommandListeners()
      Gets the list of CommandListeners of the bot.
      Returns:
      An ArrayList containing the CommandListeners of the bot.
    • addCommandListener

      public void addCommandListener(CommandListener commandListener)
      Adds a CommandListener to the bot.
      Parameters:
      commandListener - The CommandListener to add.