Class DiscordParser


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

      • 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.rest.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.channel.GuildChannel> parseGuildChannel​(Bot bot,
                                                                                                                       discord4j.rest.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