Package com.mrivanplays.jdcf
Class CommandExecutionContext
- java.lang.Object
-
- com.mrivanplays.jdcf.CommandExecutionContext
-
public final class CommandExecutionContext extends java.lang.ObjectRepresents a generic data about theCommandexecuted.
-
-
Constructor Summary
Constructors Constructor Description CommandExecutionContext(@NotNull net.dv8tion.jda.api.entities.Message message, @NotNull java.lang.String alias, boolean fromDispatcher, @NotNull CommandData commandData, @NotNull CommandManager creator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull java.lang.StringgetAlias()Returns the alias which triggered command execution.@NotNull net.dv8tion.jda.api.entities.UsergetAuthor()Returns the discordUseras a whole, author of the command.@NotNull net.dv8tion.jda.api.entities.MessageChannelgetChannel()Returns theMessageChannelwhere the command was executed.@NotNull CommandDatagetCommandData()Returns the data of the command execution triggered.@NotNull CommandManagergetCommandManagerCreator()Returns theCommandManager, whom have initialized this command execution context.@Nullable net.dv8tion.jda.api.entities.GuildgetGuild()Returns theGuildwhere thegetMember()have executed the command if it was executed in a guild.@NotNull net.dv8tion.jda.api.JDAgetJda()Returns the shard from where the command was executed.@Nullable net.dv8tion.jda.api.entities.MembergetMember()Returns the guildMember, author of the command if the command was executed in guild.@NotNull net.dv8tion.jda.api.entities.MessagegetMessage()Returns the whole commandMessage.@Nullable net.dv8tion.jda.api.entities.PrivateChannelgetPrivateChannel()Returns thePrivateChannelif the command was executed in the specifiedauthor's DMs.@Nullable net.dv8tion.jda.api.entities.TextChannelgetTextChannel()Returns theTextChannelif the command was executed in a guild.booleanisFromDispatcher()Returns whenever this context was made from a dispatcherbooleanwasExecutedInGuild()Returns whenever the command was executed in a guild.
-
-
-
Constructor Detail
-
CommandExecutionContext
public CommandExecutionContext(@NotNull @NotNull net.dv8tion.jda.api.entities.Message message, @NotNull @NotNull java.lang.String alias, boolean fromDispatcher, @NotNull @NotNull CommandData commandData, @NotNull @NotNull CommandManager creator)
-
-
Method Detail
-
getChannel
@NotNull public @NotNull net.dv8tion.jda.api.entities.MessageChannel getChannel()
Returns theMessageChannelwhere the command was executed.- Returns:
- channel
-
wasExecutedInGuild
public boolean wasExecutedInGuild()
Returns whenever the command was executed in a guild.- Returns:
trueif executed in guild channel,falseotherwise
-
getTextChannel
@Nullable public @Nullable net.dv8tion.jda.api.entities.TextChannel getTextChannel()
Returns theTextChannelif the command was executed in a guild.- Returns:
- channel or null
-
getPrivateChannel
@Nullable public @Nullable net.dv8tion.jda.api.entities.PrivateChannel getPrivateChannel()
Returns thePrivateChannelif the command was executed in the specifiedauthor's DMs.- Returns:
- channel or null
-
getMember
@Nullable public @Nullable net.dv8tion.jda.api.entities.Member getMember()
Returns the guildMember, author of the command if the command was executed in guild.Keep in mind this is not the same as
getAuthor()- Returns:
- member
-
getAuthor
@NotNull public @NotNull net.dv8tion.jda.api.entities.User getAuthor()
Returns the discordUseras a whole, author of the command.Keep in mind this is not the same as
getMember()- Returns:
- discord user, author
-
getJda
@NotNull public @NotNull net.dv8tion.jda.api.JDA getJda()
Returns the shard from where the command was executed.- Returns:
- shard
-
getMessage
@NotNull public @NotNull net.dv8tion.jda.api.entities.Message getMessage()
Returns the whole commandMessage. It is discouraged to be used for retrieving the text.- Returns:
- message
-
getGuild
@Nullable public @Nullable net.dv8tion.jda.api.entities.Guild getGuild()
Returns theGuildwhere thegetMember()have executed the command if it was executed in a guild.- Returns:
- guild
-
getAlias
@NotNull public @NotNull java.lang.String getAlias()
Returns the alias which triggered command execution.- Returns:
- alias
-
getCommandData
@NotNull public @NotNull CommandData getCommandData()
Returns the data of the command execution triggered.- Returns:
- command data
-
getCommandManagerCreator
@NotNull public @NotNull CommandManager getCommandManagerCreator()
Returns theCommandManager, whom have initialized this command execution context.- Returns:
- command manager initializer
-
isFromDispatcher
public boolean isFromDispatcher()
Returns whenever this context was made from a dispatcher- Returns:
trueif the command wasn't dispatched the normal way,falseotherwise
-
-