|
|
@ -2,6 +2,7 @@ package net.pingex.dcf.commands;
|
|
|
|
|
|
|
|
|
|
|
|
import sx.blah.discord.api.IDiscordClient;
|
|
|
|
import sx.blah.discord.api.IDiscordClient;
|
|
|
|
import sx.blah.discord.handle.obj.IChannel;
|
|
|
|
import sx.blah.discord.handle.obj.IChannel;
|
|
|
|
|
|
|
|
import sx.blah.discord.handle.obj.IGuild;
|
|
|
|
import sx.blah.discord.handle.obj.IMessage;
|
|
|
|
import sx.blah.discord.handle.obj.IMessage;
|
|
|
|
import sx.blah.discord.handle.obj.IUser;
|
|
|
|
import sx.blah.discord.handle.obj.IUser;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
@ -31,6 +32,11 @@ public class Context
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private IChannel channel;
|
|
|
|
private IChannel channel;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Guild to audit against, null if not relevant.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private IGuild guild;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* The originating reference message
|
|
|
|
* The originating reference message
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -54,26 +60,28 @@ public class Context
|
|
|
|
this.arguments = arguments;
|
|
|
|
this.arguments = arguments;
|
|
|
|
this.user = originatingMessage.getAuthor();
|
|
|
|
this.user = originatingMessage.getAuthor();
|
|
|
|
this.channel = originatingMessage.getChannel();
|
|
|
|
this.channel = originatingMessage.getChannel();
|
|
|
|
|
|
|
|
this.guild = originatingMessage.getChannel().isPrivate() ? null : originatingMessage.getChannel().getGuild();
|
|
|
|
this.originatingMessage = originatingMessage;
|
|
|
|
this.originatingMessage = originatingMessage;
|
|
|
|
this.client = client;
|
|
|
|
this.client = client;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Construct a context using explicit user and channel. The provided message is here for reference.
|
|
|
|
* Construct a context without an explicit IMessage. Used to provide a mock context for auditing purposes.
|
|
|
|
* @param command Command being executed.
|
|
|
|
* @param command Command being executed.
|
|
|
|
* @param arguments Its arguments.
|
|
|
|
* @param arguments Its arguments.
|
|
|
|
* @param user User invoking the command.
|
|
|
|
* @param user User invoking the command.
|
|
|
|
* @param channel Channel used to invoke the command.
|
|
|
|
* @param channel Channel used to invoke the command.
|
|
|
|
* @param originatingMessage The messaged used to invoke the command.
|
|
|
|
* @param guild Originating guild.
|
|
|
|
* @param client Discord client.
|
|
|
|
* @param client Discord client.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public Context(Command command, List<String> arguments, IUser user, IChannel channel, IMessage originatingMessage, IDiscordClient client)
|
|
|
|
public Context(Command command, List<String> arguments, IUser user, IChannel channel, IGuild guild, IDiscordClient client)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.command = command;
|
|
|
|
this.command = command;
|
|
|
|
this.arguments = arguments;
|
|
|
|
this.arguments = arguments;
|
|
|
|
this.user = user;
|
|
|
|
this.user = user;
|
|
|
|
this.channel = channel;
|
|
|
|
this.channel = channel;
|
|
|
|
this.originatingMessage = originatingMessage;
|
|
|
|
this.guild = guild;
|
|
|
|
|
|
|
|
this.originatingMessage = null;
|
|
|
|
this.client = client;
|
|
|
|
this.client = client;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -97,6 +105,11 @@ public class Context
|
|
|
|
return channel;
|
|
|
|
return channel;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public IGuild getGuild()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return guild;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public IMessage getOriginatingMessage()
|
|
|
|
public IMessage getOriginatingMessage()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return originatingMessage;
|
|
|
|
return originatingMessage;
|
|
|
|