Class DiscordResolver
java.lang.Object
de.chojo.jdautil.parsing.DiscordResolver
Class which can be used to resolve different discord entities from strings.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfuzzyGlobalUserSearch(ShardManager shardManager, String userString) Search a user by fuzzy search.static List<WeightedEntry<Member>> fuzzyGuildTargetSearch(String userString, Collection<Member> targets) Search a user by fuzzy search on a guild.static List<WeightedEntry<Member>> fuzzyGuildUserSearch(Guild guild, String userString) Search a user by fuzzy search on a guild.getGuild(ShardManager shardManager, String guildString) Get guilds by id or name.static Optional<GuildChannel> getGuildChannel(Guild guild, String content) getGuildMember(Guild guild, String memberString) Get a member object from a guild member by id, tag, nickname or effective name.getGuildMembers(Guild guild, Collection<String> memberStrings) Get guild member objects by a list of ids, tags, nickname or effective name.getGuilds(ShardManager shardManager, List<String> guildStrings) Get guilds by ids or names.getGuildUser(Guild guild, String userString) Get a user object by id, tag or name.getGuildUsers(Guild guild, Collection<String> userStrings) Get user objects which are valid on the guild by a list of ids, tags, or name.Get a role from id or name.getRoles(Guild guild, Collection<String> roleStrings) Get roles from a list of role ids and/or names.static Optional<TextChannel> getTextChannel(Guild guild, String channelString) Get a text channels by a list of id or name.static List<TextChannel> getTextChannels(Guild guild, Collection<String> channelStrings) Get a text channels by a list of ids and/or names.getUser(ShardManager shardManager, String userString) Get a user object by id, name or tag.getUserDeepSearch(ShardManager shardManager, String userString, Guild guild) Searches for a user.getUsers(ShardManager shardManager, Collection<String> userStrings) Get user objects from a list of ids, names and/or tags.getValidRoles(Guild guild, String[] args) Returns from a list of role ids all valid roles.getValidRoles(Guild guild, List<String> args) Returns from a list of role ids all valid roles.static List<TextChannel> getValidTextChannels(Guild guild, String[] args) Returns from a list of text channel ids all valid channels.static List<TextChannel> getValidTextChannels(Guild guild, List<String> args) Returns from a list of text channels ids all valid channels.static List<TextChannel> getValidTextChannelsById(Guild guild, List<Long> ids) Returns from a list of text channel ids all valid channels.getValidUserByLong(ShardManager shardManager, List<Long> collect) Get the valid users by id.
-
Constructor Details
-
DiscordResolver
public DiscordResolver()
-
-
Method Details
-
getTextChannel
Get a text channels by a list of id or name.- Parameters:
guild- guild for lookupchannelString- id or name- Returns:
- text channel or null
-
getValidRoles
-
getValidRoles
-
getValidTextChannels
Returns from a list of text channels ids all valid channels.- Parameters:
guild- guild for role lookupargs- array of role id- Returns:
- list of valid roles
-
getValidTextChannels
Returns from a list of text channel ids all valid channels.- Parameters:
guild- guild for channel lookupargs- array of channel ids- Returns:
- list of valid channels
-
getValidTextChannelsById
Returns from a list of text channel ids all valid channels.- Parameters:
guild- guild for channel lookupids- array of channel ids- Returns:
- list of valid channels
-
getValidUserByLong
Get the valid users by id.- Parameters:
shardManager- jda for user lookupcollect- list of long ids- Returns:
- list of valid users.
-
getGuildChannel
-
getGuildUser
-
getGuildMember
-
getTextChannels
Get a text channels by a list of ids and/or names.- Parameters:
guild- guild for lookupchannelStrings- list of ids and/or names- Returns:
- list of text channels without null objects
-
getRoles
Get roles from a list of role ids and/or names.- Parameters:
guild- guild for lookuproleStrings- list of ids and/or names- Returns:
- list of roles. without null objects
-
getRole
-
getGuildMembers
Get guild member objects by a list of ids, tags, nickname or effective name.- Parameters:
guild- guild for lookupmemberStrings- list of member ids, tags, nicknames or effective names- Returns:
- list of member object without nulls
-
getGuildUsers
Get user objects which are valid on the guild by a list of ids, tags, or name.- Parameters:
guild- guild for lookupuserStrings- list of user ids, names and/or tags- Returns:
- list of users without null
-
fuzzyGuildUserSearch
Search a user by fuzzy search on a guild.- Parameters:
guild- guild to searchuserString- user string to search- Returns:
- a list of users. if a direct match was found only 1 user. if guild id is invalid a empty list is returned.
-
fuzzyGuildTargetSearch
public static List<WeightedEntry<Member>> fuzzyGuildTargetSearch(String userString, Collection<Member> targets) Search a user by fuzzy search on a guild.- Parameters:
userString- user string to searchtargets- possible targets- Returns:
- a list of users. if a direct match was found only 1 user. if guild id is invalid a empty list is returned.
-
getUserDeepSearch
public static Optional<User> getUserDeepSearch(ShardManager shardManager, String userString, Guild guild) Searches for a user. First on a guild and after this on all users the bot currently know. Equal to callinggetGuildUser(Guild, String)andgetUser(ShardManager, String).- Parameters:
userString- string for lookupguild- guild for lookup- Returns:
- user object or null if no user is found
-
getUser
Get a user object by id, name or tag.- Parameters:
userString- string for lookup- Returns:
- user object or null if no user is found
-
getUsers
Get user objects from a list of ids, names and/or tags.- Parameters:
userStrings- list of ids, names and/or tags- Returns:
- a list of user objects. without null
-
getGuilds
Get guilds by ids or names.- Parameters:
guildStrings- list of ids and/or names.- Returns:
- list of guilds. without null
-
getGuild
Get guilds by id or name.- Parameters:
guildString- guild id or name- Returns:
- guild object or null
-
fuzzyGlobalUserSearch
Search a user by fuzzy search.- Parameters:
userString- user string to search- Returns:
- a list of users. if a direct match was found only
-