Package tv.phantombot

Class PhantomBot

java.lang.Object
tv.phantombot.PhantomBot
All Implemented Interfaces:
Listener

public final class PhantomBot extends Object implements Listener
  • Field Details

    • twitchCacheReady

      public static boolean twitchCacheReady
  • Constructor Details

    • PhantomBot

      public PhantomBot()
      Constructor for PhantomBot object.
  • Method Details

    • instance

      public static PhantomBot instance()
      PhantomBot Instance.
      Returns:
      PhantomBot The current instance of PhantomBot
    • repoVersion

      public String repoVersion()
      Current Repo Of PhantomBot.
      Returns:
      String The current GitHub repository version of PhantomBot.
    • botVersion

      public String botVersion()
      Current Version Of PhantomBot.
      Returns:
      String Display version of PhantomBot.
    • getBotInfo

      public String getBotInfo()
      Used by the panel on the informations tab.
      Returns:
      String PhantomBot information for the Panel.
    • botRevision

      public String botRevision()
      Current Build Revision
      Returns:
      String The build revision of PhantomBot.
    • getBotCreator

      public String getBotCreator()
      Only used on bot boot up for now.
      Returns:
      bot creator
    • botDevelopers

      public String botDevelopers()
      Only used on bot boot up for now.
      Returns:
      bot developers
    • getWebSite

      public String getWebSite()
      Only used on bot boot up for now.
      Returns:
      bot website
    • isYouTubeKeyEmpty

      public boolean isYouTubeKeyEmpty()
      Check to see if YouTube Key is configured.
      Returns:
    • setLevel

      public static void setLevel(Level targetLevel)
    • validateOAuth

      public void validateOAuth()
    • isNightly

      public boolean isNightly()
      Tells you if the build is a nightly.
      Returns:
    • isPrerelease

      @Deprecated(since="3.8.0.0", forRemoval=true) public boolean isPrerelease()
      Deprecated, for removal: This API element is subject to removal in a future version.
      This build type is not used
      Tells you if the build is a pre-release.
    • getAuthFlow

      public TwitchAuthorizationCodeFlow getAuthFlow()
    • reconnect

      public void reconnect()
    • reloadProperties

      public void reloadProperties()
    • setDebugging

      public static void setDebugging(boolean debug)
      Enables or disables the debug mode.
      Parameters:
      debug -
    • setDebuggingLogOnly

      public static void setDebuggingLogOnly(boolean debug)
      Enables or disables log only debug mode.
      Parameters:
      debug -
    • getBotName

      public String getBotName()
      Tells you the bot name.
      Returns:
      bot name
    • getHTTPPanelAndYTHandler

      public HTTPPanelAndYTHandler getHTTPPanelAndYTHandler()
    • getHTTPOAuthHandler

      public HTTPOAuthHandler getHTTPOAuthHandler()
    • getHTTPSetupHandler

      public HttpSetupHandler getHTTPSetupHandler()
    • getDataStore

      public DataStore getDataStore()
      Gives you the current data store
      Returns:
      this.dataStore
    • isExiting

      public boolean isExiting()
      Tells you if the bot is exiting
      Returns:
      exit
    • getChannelName

      public String getChannelName()
      Gives you the channel for that channelName.
      Returns:
    • hasDiscordToken

      public boolean hasDiscordToken()
      Tells you if the discord token has been set.
      Returns:
    • getSession

      public TwitchSession getSession()
      Gives you the session for that channel.
      Returns:
    • getTMI

      public TwitchMessageInterface getTMI()
      Returns:
      The TwitchMessageInterface for the IRC connection
    • checkModuleEnabled

      public boolean checkModuleEnabled(String module)
      Helper method to see if a module is enabled.
      Parameters:
      module - Module name to check for
      Returns:
      boolean If the module is enabled or not
    • getDataStoreType

      public String getDataStoreType()
    • checkDataStore

      public boolean checkDataStore(String table, String key)
      Checks if a value is true in the datastore.
      Parameters:
      table - Db table to check.
      key - Db key to check in that table.
      Returns:
    • getBotInformation

      public String getBotInformation()
      Method that returns the basic bot info.
      Returns:
    • getProperties

      @Deprecated(since="3.6.4.0", forRemoval=true) public CaselessProperties getProperties()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Method that gets the PhantomBot properties.
      Returns:
    • onExit

      public void onExit()
      Used for exiting the bot
    • command

      public void command(CommandEvent event)
    • ircJoinComplete

      public void ircJoinComplete(IrcJoinCompleteEvent event)
      Connected to Twitch.
      Parameters:
      event -
    • handleCommand

      public void handleCommand(String username, String command)
      Handle commands
      Parameters:
      username -
      command -
    • handleCommandSync

      public void handleCommandSync(String username, String command)
      Handle commands
      Parameters:
      username -
      command -
    • main

      public static void main(String[] args) throws IOException
      Load up main
      Parameters:
      args -
      Throws:
      IOException
    • generateRandomString

      public static String generateRandomString(int length)
      gen a random string
      Parameters:
      length -
      Returns:
    • generateRandomString

      public static String generateRandomString(int length, boolean allowSpecial)
    • getOsSuffix

      public static String getOsSuffix()
    • setTwitchCacheReady

      public void setTwitchCacheReady(boolean twitchCacheReady)
      Set the twitch cache
      Parameters:
      twitchCacheReady -
    • toCSV

      public void toCSV(String[] headers, List<String[]> values, String fileName)
      Method to export a Java list to a csv file.
      Parameters:
      headers -
      values -
      fileName -
    • exitError

      public static void exitError()
      End PhantomBot with an error state
    • exitOK

      public static void exitOK()
      End PhantomBot with an OK state
    • getReloadScripts

      public static boolean getReloadScripts()
    • getSilentScriptsLoad

      public static boolean getSilentScriptsLoad()
    • getEnableDebugging

      public static boolean getEnableDebugging()
    • getEnableDebuggingLogOnly

      public static boolean getEnableDebuggingLogOnly()
    • getEnableRhinoDebugger

      public static boolean getEnableRhinoDebugger()
    • getTimeZone

      public static String getTimeZone()
    • getTimeZoneId

      public static ZoneId getTimeZoneId()
    • isInExitState

      public static boolean isInExitState()
    • setSession

      public void setSession(TwitchSession session)
    • panelhandler

      public WsPanelHandler panelhandler()