Class Bot

java.lang.Object
com.github.alex1304.ultimategdbot.api.Bot

public class Bot
extends java.lang.Object
Represents the bot itself.
  • Method Summary

    Modifier and Type Method Description
    static Bot buildFromProperties​(java.util.Properties props, java.util.Properties pluginsProps)  
    reactor.core.publisher.Mono<discord4j.core.object.entity.ApplicationInfo> getApplicationInfo()
    Get the application info of the bot
    reactor.core.publisher.Mono<discord4j.core.object.entity.Channel> getAttachmentsChannel()
    Gets the channel where the bot can send attachments for its embeds.
    CommandKernel getCommandKernel()
    Gets the command kernel of this bot.
    Database getDatabase()
    Gets the database of the bot.
    reactor.core.publisher.Mono<discord4j.core.object.entity.Channel> getDebugLogChannel()
    Gets the channel where the bot sends messages for debugging purposes.
    PaginationControls getDefaultPaginationControls()
    Gets the default emojis used for pagination controls configured for the bot.
    java.lang.String getDefaultPrefix()
    Gets the default prefix.
    reactor.core.publisher.Flux<discord4j.core.DiscordClient> getDiscordClients()
    Gets the Flux containing the discord client for each shard.
    reactor.core.publisher.Mono<java.lang.String> getEmoji​(java.lang.String emojiName)
    Gets the String representation of an emoji installed on one of the emoji servers.
    reactor.core.publisher.Flux<discord4j.core.object.entity.GuildEmoji> getInstalledEmojis()
    Gets all emojis installed.
    int getInteractiveMenuTimeout()
    Gets the maximum time in seconds that the bot should wait for a user interaction when an interactive menu is open.
    discord4j.core.DiscordClient getMainDiscordClient()
    Gets the discord client representing shard 0.
    java.util.Set<Plugin> getPlugins()
    Gets a Set containing all successfully loaded plugins.
    java.lang.String getToken()
    Get the bot token.
    void installEmojis()
    Gathers all emojis from the configured emoji guilds and put them in cache.
    boolean isCorePluginDisabled()
    Gets whether the core plugin is disabled.
    reactor.core.publisher.Mono<discord4j.core.object.entity.Message> log​(java.lang.String message)
    Sends a message into the debug log channel.
    reactor.core.publisher.Mono<discord4j.core.object.entity.Message> log​(java.util.function.Consumer<discord4j.core.spec.MessageCreateSpec> spec)
    Sends a message into the debug log channel.
    reactor.core.publisher.Mono<java.lang.Void> start()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getToken

      public java.lang.String getToken()
      Get the bot token.
      Returns:
      the token
    • getDefaultPrefix

      public java.lang.String getDefaultPrefix()
      Gets the default prefix.
      Returns:
      the default prefix
    • getMainDiscordClient

      public discord4j.core.DiscordClient getMainDiscordClient()
      Gets the discord client representing shard 0.
      Returns:
      the discord client
    • getDiscordClients

      public reactor.core.publisher.Flux<discord4j.core.DiscordClient> getDiscordClients()
      Gets the Flux containing the discord client for each shard.
      Returns:
      a Flux of discord client
    • getDatabase

      public Database getDatabase()
      Gets the database of the bot.
      Returns:
      the database
    • getInteractiveMenuTimeout

      public int getInteractiveMenuTimeout()
      Gets the maximum time in seconds that the bot should wait for a user interaction when an interactive menu is open.
      Returns:
      the value as int (in seconds)
    • getDefaultPaginationControls

      public PaginationControls getDefaultPaginationControls()
      Gets the default emojis used for pagination controls configured for the bot.
      Returns:
      a PaginationControls instance
    • getDebugLogChannel

      public reactor.core.publisher.Mono<discord4j.core.object.entity.Channel> getDebugLogChannel()
      Gets the channel where the bot sends messages for debugging purposes.
      Returns:
      a Mono emitting the debug log channel
    • getAttachmentsChannel

      public reactor.core.publisher.Mono<discord4j.core.object.entity.Channel> getAttachmentsChannel()
      Gets the channel where the bot can send attachments for its embeds.
      Returns:
      a Mono emitting the attachments channel
    • log

      public reactor.core.publisher.Mono<discord4j.core.object.entity.Message> log​(java.lang.String message)
      Sends a message into the debug log channel.
      Parameters:
      message - the message to send
      Returns:
      a Mono emitting the message sent
    • log

      public reactor.core.publisher.Mono<discord4j.core.object.entity.Message> log​(java.util.function.Consumer<discord4j.core.spec.MessageCreateSpec> spec)
      Sends a message into the debug log channel.
      Parameters:
      spec - the spec of the message to send
      Returns:
      a Mono emitting the message sent
    • installEmojis

      public void installEmojis()
      Gathers all emojis from the configured emoji guilds and put them in cache. Subsequent calls of this method will remove the old cache and perform the installation again.
    • getInstalledEmojis

      public reactor.core.publisher.Flux<discord4j.core.object.entity.GuildEmoji> getInstalledEmojis()
      Gets all emojis installed. An emoji qualifies as "installed" if it is present in one of the emoji guilds configured in bot.properties.
      Returns:
      a Flux emitting the installed emojis.
    • getEmoji

      public reactor.core.publisher.Mono<java.lang.String> getEmoji​(java.lang.String emojiName)
      Gets the String representation of an emoji installed on one of the emoji servers. If the emoji is not found, the returned value is the given name wrapped in colons.
      Parameters:
      emojiName - the name of the emoji to look for
      Returns:
      a Mono emitting the emoji code corresponding to the given name
    • getCommandKernel

      public CommandKernel getCommandKernel()
      Gets the command kernel of this bot.
      Returns:
      the command kernel
    • getPlugins

      public java.util.Set<Plugin> getPlugins()
      Gets a Set containing all successfully loaded plugins.
      Returns:
      a Set of Plugin
    • getApplicationInfo

      public reactor.core.publisher.Mono<discord4j.core.object.entity.ApplicationInfo> getApplicationInfo()
      Get the application info of the bot
      Returns:
      a Mono emitting the application info
    • isCorePluginDisabled

      public boolean isCorePluginDisabled()
      Gets whether the core plugin is disabled.
      Returns:
      a boolean
    • buildFromProperties

      public static Bot buildFromProperties​(java.util.Properties props, java.util.Properties pluginsProps)
    • start

      public reactor.core.publisher.Mono<java.lang.Void> start()