Class DiscordParser

java.lang.Object
com.github.alex1304.ultimategdbot.api.utils.DiscordParser

public class DiscordParser
extends Object
Contains utility methods to parse a user input into a Discord entity.
  • Method Summary

    Modifier and Type Method Description
    static reactor.core.publisher.Mono<discord4j.core.object.entity.GuildChannel> parseGuildChannel​(Bot bot, discord4j.core.object.util.Snowflake guildId, String str)
    Parses the input into a Discord channel.
    static reactor.core.publisher.Mono<discord4j.core.object.entity.Role> parseRole​(Bot bot, discord4j.core.object.util.Snowflake guildId, String str)
    Parses the input into a Discord role.
    static reactor.core.publisher.Mono<discord4j.core.object.entity.User> parseUser​(Bot bot, String str)
    Parses the input into a Discord user.

    Methods inherited from class java.lang.Object

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

    • parseUser

      public static reactor.core.publisher.Mono<discord4j.core.object.entity.User> parseUser​(Bot bot, String str)
      Parses the input into a Discord user. Emits IllegalArgumentException if not found.
      Parameters:
      bot - the bot used to make requests to Discord
      str - the input
      Returns:
      a Mono emitting the found user
    • parseRole

      public static reactor.core.publisher.Mono<discord4j.core.object.entity.Role> parseRole​(Bot bot, discord4j.core.object.util.Snowflake guildId, String str)
      Parses the input into a Discord role. Emits IllegalArgumentException if not found.
      Parameters:
      bot - the bot used to make requests to Discord
      guildId - the ID of the guild the desired role belongs to
      str - the input
      Returns:
      a Mono emitting the found role
    • parseGuildChannel

      public static reactor.core.publisher.Mono<discord4j.core.object.entity.GuildChannel> parseGuildChannel​(Bot bot, discord4j.core.object.util.Snowflake guildId, String str)
      Parses the input into a Discord channel. Emits IllegalArgumentException if not found.
      Parameters:
      bot - the bot used to make requests to Discord
      guildId - the ID of the guild the desired channel belongs to
      str - the input
      Returns:
      a Mono emitting the found channel