Add captcha, auto generate config, and Spigot support
This commit is contained in:
@@ -21,7 +21,7 @@ public class CommandListener extends ListenerAdapter implements Runnable {
|
||||
@Override
|
||||
public void onMessageReceived(MessageReceivedEvent event){
|
||||
if(!event.getAuthor().isBot() && event.getMessage().getContentDisplay().startsWith(PropertiesRetrieval.getCommandSignifier()) && event.getMessage().getAuthor().getId() != event.getJDA().getSelfUser().getId()){
|
||||
log.info("True");
|
||||
//log.info("True");
|
||||
API.getBiscuit().getCommandManager().parse(event.getMessage().getContentRaw().toLowerCase(), event);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,5 @@ public abstract class ConsoleCommand extends BaseCommand{
|
||||
public CommandType getType() {
|
||||
return CommandType.CONSOLE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
|
||||
import com.fpghoti.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.api.API;
|
||||
import com.fpghoti.biscuit.commands.ClientCommand;
|
||||
import com.fpghoti.biscuit.config.PropertiesRetrieval;
|
||||
import com.fpghoti.biscuit.util.Util;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
public class AddCommand extends ClientCommand{
|
||||
|
||||
public AddCommand() {
|
||||
name = "Add";
|
||||
description = "Finds sum of two numbers.";
|
||||
usage = PropertiesRetrieval.getCommandSignifier() + "add <Num1> <Num2>";
|
||||
minArgs = 2;
|
||||
maxArgs = 2;
|
||||
identifiers.add("add");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
Biscuit b = API.getBiscuit();
|
||||
b.log(event.getAuthor().getName() + " issued a command: -add");
|
||||
if(args[0] != null && Util.isDeciDigit(args[0]) && args[1] != null && Util.isDeciDigit(args[1])) {
|
||||
double num = Double.parseDouble(args[0]);
|
||||
double num2 = Double.parseDouble(args[1]);
|
||||
String sum = Double.toString(num + num2);
|
||||
String end = sum.substring(Math.max(sum.length() - 2, 0));
|
||||
if(end.equals(".0")) {
|
||||
sum = sum.replace(".0","");
|
||||
}
|
||||
event.getTextChannel().sendMessage(args[0] + " + " + args[1] + " is **" + sum + "**.").queue();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
|
||||
import com.fpghoti.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.api.API;
|
||||
import com.fpghoti.biscuit.commands.ClientCommand;
|
||||
import com.fpghoti.biscuit.config.PropertiesRetrieval;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
@@ -11,7 +12,7 @@ public class ChanIDCommand extends ClientCommand{
|
||||
public ChanIDCommand() {
|
||||
name = "Channel ID";
|
||||
description = "Retrieves the channel ID.";
|
||||
usage = "-chanid";
|
||||
usage = PropertiesRetrieval.getCommandSignifier() + "chanid";
|
||||
minArgs = 0;
|
||||
maxArgs = 0;
|
||||
identifiers.add("chanid");
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
|
||||
import com.fpghoti.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.api.API;
|
||||
import com.fpghoti.biscuit.commands.ClientCommand;
|
||||
import com.fpghoti.biscuit.config.PropertiesRetrieval;
|
||||
import com.fpghoti.biscuit.util.PermUtil;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
@@ -12,7 +13,7 @@ public class ChnameCommand extends ClientCommand{
|
||||
public ChnameCommand() {
|
||||
name = "Channel Name";
|
||||
description = "Retrieves the channel name.";
|
||||
usage = "-chname";
|
||||
usage = PropertiesRetrieval.getCommandSignifier() + "chname";
|
||||
minArgs = 0;
|
||||
maxArgs = 0;
|
||||
identifiers.add("chname");
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
|
||||
import com.fpghoti.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.api.API;
|
||||
import com.fpghoti.biscuit.commands.ClientCommand;
|
||||
import com.fpghoti.biscuit.config.PropertiesRetrieval;
|
||||
import com.fpghoti.biscuit.util.Util;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
public class DivideCommand extends ClientCommand{
|
||||
|
||||
public DivideCommand() {
|
||||
name = "Divide";
|
||||
description = "Divides two numbers.";
|
||||
usage = PropertiesRetrieval.getCommandSignifier() + "divide <Num 1> <Num 2>";
|
||||
minArgs = 2;
|
||||
maxArgs = 2;
|
||||
identifiers.add("divide");
|
||||
identifiers.add("div");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
Biscuit b = API.getBiscuit();
|
||||
b.log(event.getAuthor().getName() + " issued a command: -divide");
|
||||
if(args[0] != null && Util.isDeciDigit(args[0]) && args[1] != null && Util.isDeciDigit(args[1])) {
|
||||
double num = Double.parseDouble(args[0]);
|
||||
double num2 = Double.parseDouble(args[1]);
|
||||
String divide = Double.toString(num / num2);
|
||||
String end = divide.substring(Math.max(divide.length() - 2, 0));
|
||||
if(end.equals(".0")) {
|
||||
divide = divide.replace(".0","");
|
||||
}
|
||||
event.getTextChannel().sendMessage(args[0] + " / " + args[1] + " is **" + divide + "**.").queue();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
|
||||
import com.fpghoti.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.api.API;
|
||||
import com.fpghoti.biscuit.commands.ClientCommand;
|
||||
import com.fpghoti.biscuit.config.PropertiesRetrieval;
|
||||
|
||||
import net.dv8tion.jda.api.entities.Emote;
|
||||
import net.dv8tion.jda.api.entities.Role;
|
||||
@@ -13,7 +14,7 @@ public class DontNotifyCommand extends ClientCommand{
|
||||
public DontNotifyCommand() {
|
||||
name = "Don't Notify";
|
||||
description = "Puts user in Don't Notify status.";
|
||||
usage = "-dontnotify";
|
||||
usage = PropertiesRetrieval.getCommandSignifier() + "dontnotify";
|
||||
minArgs = 0;
|
||||
maxArgs = 0;
|
||||
identifiers.add("dontnotify");
|
||||
@@ -26,7 +27,7 @@ public class DontNotifyCommand extends ClientCommand{
|
||||
b.log(event.getAuthor().getName() + " issued a command: -dontnotify");
|
||||
Role role = null;
|
||||
for(Role r : event.getGuild().getRoles()) {
|
||||
if(r.getName().toLowerCase().contains("don't notify")) {
|
||||
if(r.getName().toLowerCase().contains(PropertiesRetrieval.getDontNotify())) {
|
||||
role = r;
|
||||
}
|
||||
}
|
||||
@@ -37,7 +38,7 @@ public class DontNotifyCommand extends ClientCommand{
|
||||
|
||||
Emote done = null;
|
||||
for(Emote e : event.getGuild().getEmotes()) {
|
||||
if(e.getName().contains("ActionComplete")) {
|
||||
if(e.getName().contains(PropertiesRetrieval.getDoneEmote())) {
|
||||
done = e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.fpghoti.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.commands.BaseCommand;
|
||||
import com.fpghoti.biscuit.commands.ClientCommand;
|
||||
import com.fpghoti.biscuit.config.PropertiesRetrieval;
|
||||
import com.fpghoti.biscuit.util.Util;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
public class HelpCommand extends ClientCommand {
|
||||
|
||||
public HelpCommand() {
|
||||
name = "Help";
|
||||
description = "Pulls up help menu";
|
||||
usage = PropertiesRetrieval.getCommandSignifier() + "help [Page #]";
|
||||
minArgs = 0;
|
||||
maxArgs = 1;
|
||||
identifiers.add("help");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
|
||||
Biscuit biscuit = Main.getBiscuit();
|
||||
|
||||
int pg = 1;
|
||||
if (args.length > 0) {
|
||||
if(Util.isDigit(args[0])) {
|
||||
pg = Integer.parseInt(args[0]);
|
||||
}else {
|
||||
event.getTextChannel().sendMessage("Usage: ``" + usage + "``").queue();
|
||||
}
|
||||
}
|
||||
|
||||
List<BaseCommand> commands = biscuit.getCommandManager().getCommands();
|
||||
|
||||
int pageCount = (int) Math.ceil((double) commands.size() / 8);
|
||||
if (pg > pageCount) {
|
||||
pg = pageCount;
|
||||
}
|
||||
|
||||
event.getTextChannel().sendMessage("[" + Integer.toString(pg) + "/" + Integer.toString(pageCount) + "] **Bot Commands:**").queue();
|
||||
String msg = "";
|
||||
for (int i = 0; i < 8; i++) {
|
||||
int index = (pg - 1) * 8 + i;
|
||||
String line = "";
|
||||
if (index < commands.size()) {
|
||||
line = "**-** ``" + commands.get(index).getUsage() + "``";
|
||||
}
|
||||
if(!(index + 1 >= commands.size() || index == 7)) {
|
||||
line = line + "\n";
|
||||
}
|
||||
if (index < commands.size()) {
|
||||
msg = msg + line;
|
||||
}
|
||||
}
|
||||
event.getTextChannel().sendMessage(msg).queue();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
|
||||
import com.fpghoti.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.api.API;
|
||||
import com.fpghoti.biscuit.commands.ClientCommand;
|
||||
import com.fpghoti.biscuit.config.PropertiesRetrieval;
|
||||
import com.fpghoti.biscuit.util.Util;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
public class MultiplyCommand extends ClientCommand{
|
||||
|
||||
public MultiplyCommand() {
|
||||
name = "Multiply";
|
||||
description = "Multiplies two numbers.";
|
||||
usage = PropertiesRetrieval.getCommandSignifier() + "multiply <Num1> <Num2>";
|
||||
minArgs = 2;
|
||||
maxArgs = 2;
|
||||
identifiers.add("multiply");
|
||||
identifiers.add("mul");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
Biscuit b = API.getBiscuit();
|
||||
b.log(event.getAuthor().getName() + " issued a command: -multiply");
|
||||
if(args[0] != null && Util.isDeciDigit(args[0]) && args[1] != null && Util.isDeciDigit(args[1])) {
|
||||
double num = Double.parseDouble(args[0]);
|
||||
double num2 = Double.parseDouble(args[1]);
|
||||
String prod = Double.toString(num * num2);
|
||||
String end = prod.substring(Math.max(prod.length() - 2, 0));
|
||||
if(end.equals(".0")) {
|
||||
prod = prod.replace(".0","");
|
||||
}
|
||||
event.getTextChannel().sendMessage(args[0] + " x " + args[1] + " is **" + prod + "**.").queue();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
|
||||
import com.fpghoti.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.api.API;
|
||||
import com.fpghoti.biscuit.commands.ClientCommand;
|
||||
import com.fpghoti.biscuit.config.PropertiesRetrieval;
|
||||
import com.fpghoti.biscuit.global.SpamRecords;
|
||||
import com.fpghoti.biscuit.util.PermUtil;
|
||||
|
||||
@@ -15,7 +16,7 @@ public class NotSpammerCommand extends ClientCommand{
|
||||
public NotSpammerCommand() {
|
||||
name = "Not Spammer";
|
||||
description = "Delists user as spammer.";
|
||||
usage = "-notspammer @<mention-user>";
|
||||
usage = PropertiesRetrieval.getCommandSignifier() + "notspammer @<mention-user>";
|
||||
minArgs = 1;
|
||||
maxArgs = 1;
|
||||
identifiers.add("notspammer");
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
|
||||
import com.fpghoti.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.api.API;
|
||||
import com.fpghoti.biscuit.commands.ClientCommand;
|
||||
import com.fpghoti.biscuit.config.PropertiesRetrieval;
|
||||
|
||||
import net.dv8tion.jda.api.entities.Emote;
|
||||
import net.dv8tion.jda.api.entities.Role;
|
||||
@@ -13,7 +14,7 @@ public class NotifyCommand extends ClientCommand{
|
||||
public NotifyCommand() {
|
||||
name = "Notify";
|
||||
description = "Puts user in Notify status.";
|
||||
usage = "-notify";
|
||||
usage = PropertiesRetrieval.getCommandSignifier() + "notify";
|
||||
minArgs = 0;
|
||||
maxArgs = 0;
|
||||
identifiers.add("notify");
|
||||
@@ -26,7 +27,7 @@ public class NotifyCommand extends ClientCommand{
|
||||
b.log(event.getAuthor().getName() + " issued a command: -notify");
|
||||
Role role = null;
|
||||
for(Role r : event.getGuild().getRoles()) {
|
||||
if(r.getName().toLowerCase().contains("don't notify")) {
|
||||
if(r.getName().toLowerCase().contains(PropertiesRetrieval.getDontNotify())) {
|
||||
role = r;
|
||||
}
|
||||
}
|
||||
@@ -37,7 +38,7 @@ public class NotifyCommand extends ClientCommand{
|
||||
|
||||
Emote done = null;
|
||||
for(Emote e : event.getGuild().getEmotes()) {
|
||||
if(e.getName().contains("ActionComplete")) {
|
||||
if(e.getName().contains(PropertiesRetrieval.getDoneEmote())) {
|
||||
done = e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
|
||||
import com.fpghoti.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.api.API;
|
||||
import com.fpghoti.biscuit.commands.ClientCommand;
|
||||
import com.fpghoti.biscuit.config.PropertiesRetrieval;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
@@ -11,7 +12,7 @@ public class PingCommand extends ClientCommand{
|
||||
public PingCommand() {
|
||||
name = "Ping";
|
||||
description = "Pings the bot.";
|
||||
usage = "-ping";
|
||||
usage = PropertiesRetrieval.getCommandSignifier() + "ping";
|
||||
minArgs = 0;
|
||||
maxArgs = 0;
|
||||
identifiers.add("ping");
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
|
||||
import com.fpghoti.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.api.API;
|
||||
import com.fpghoti.biscuit.commands.ClientCommand;
|
||||
import com.fpghoti.biscuit.config.PropertiesRetrieval;
|
||||
import com.fpghoti.biscuit.util.Util;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
public class PowerCommand extends ClientCommand{
|
||||
|
||||
public PowerCommand() {
|
||||
name = "Power";
|
||||
description = "Finds Num1 ^ Num2";
|
||||
usage = PropertiesRetrieval.getCommandSignifier() + "power <Num1> <Num2>";
|
||||
minArgs = 2;
|
||||
maxArgs = 2;
|
||||
identifiers.add("power");
|
||||
identifiers.add("pow");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
Biscuit b = API.getBiscuit();
|
||||
b.log(event.getAuthor().getName() + " issued a command: -power");
|
||||
if(args[0] != null && Util.isDeciDigit(args[0]) && args[1] != null && Util.isDeciDigit(args[1])) {
|
||||
double num = Double.parseDouble(args[0]);
|
||||
double num2 = Double.parseDouble(args[1]);
|
||||
String pow = Double.toString( Math.pow(num,num2));
|
||||
String end = pow.substring(Math.max(pow.length() - 2, 0));
|
||||
if(end.equals(".0")) {
|
||||
pow = pow.replace(".0","");
|
||||
}
|
||||
event.getTextChannel().sendMessage(args[0] + "^" + args[1] + " is **" + pow + "**.").queue();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
|
||||
import com.fpghoti.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.api.API;
|
||||
import com.fpghoti.biscuit.commands.ClientCommand;
|
||||
import com.fpghoti.biscuit.config.PropertiesRetrieval;
|
||||
import com.fpghoti.biscuit.global.SpamRecords;
|
||||
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
@@ -13,7 +14,7 @@ public class RecentSpammersCommand extends ClientCommand{
|
||||
public RecentSpammersCommand() {
|
||||
name = "Recent Spammers";
|
||||
description = "Retrieves a list of recent spammers.";
|
||||
usage = "-recentspammers";
|
||||
usage = PropertiesRetrieval.getCommandSignifier() + "recentspammers";
|
||||
minArgs = 0;
|
||||
maxArgs = 0;
|
||||
identifiers.add("recentspammers");
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
|
||||
import com.fpghoti.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.api.API;
|
||||
import com.fpghoti.biscuit.commands.ClientCommand;
|
||||
import com.fpghoti.biscuit.util.PermUtil;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
public class ShutDownCommand extends ClientCommand{
|
||||
|
||||
public ShutDownCommand() {
|
||||
name = "Shut Down";
|
||||
description = "Shuts down the bot.";
|
||||
usage = "-shutdown";
|
||||
minArgs = 0;
|
||||
maxArgs = 0;
|
||||
identifiers.add("shutdown");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
Biscuit b = API.getBiscuit();
|
||||
b.log(event.getAuthor().getName() + " issued a command: -shutdown");
|
||||
if(PermUtil.isAdmin(event.getMember())) {
|
||||
|
||||
event.getTextChannel().sendMessage("Shutting down Mr. Bouncer...").queue();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
|
||||
import com.fpghoti.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.api.API;
|
||||
import com.fpghoti.biscuit.commands.ClientCommand;
|
||||
import com.fpghoti.biscuit.config.PropertiesRetrieval;
|
||||
import com.fpghoti.biscuit.global.SpamRecords;
|
||||
import com.fpghoti.biscuit.util.PermUtil;
|
||||
|
||||
@@ -15,7 +16,7 @@ public class SoftMuteCommand extends ClientCommand{
|
||||
public SoftMuteCommand() {
|
||||
name = "Soft Mute";
|
||||
description = "Soft mutes a user. In this state, they will only be able to send a message every two minutes.";
|
||||
usage = "-softmute @<mention-user>";
|
||||
usage = PropertiesRetrieval.getCommandSignifier() + "softmute @<mention-user>";
|
||||
minArgs = 1;
|
||||
maxArgs = 1;
|
||||
identifiers.add("softmute");
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
|
||||
import com.fpghoti.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.api.API;
|
||||
import com.fpghoti.biscuit.commands.ClientCommand;
|
||||
import com.fpghoti.biscuit.config.PropertiesRetrieval;
|
||||
import com.fpghoti.biscuit.util.Util;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
public class SquareRootCommand extends ClientCommand{
|
||||
|
||||
public SquareRootCommand() {
|
||||
name = "Square Root";
|
||||
description = "Finds square root.";
|
||||
usage = PropertiesRetrieval.getCommandSignifier() + "squareroot <Num>";
|
||||
minArgs = 1;
|
||||
maxArgs = 1;
|
||||
identifiers.add("squareroot");
|
||||
identifiers.add("sqrt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
Biscuit b = API.getBiscuit();
|
||||
b.log(event.getAuthor().getName() + " issued a command: -squareroot");
|
||||
if(args[0] != null && Util.isDeciDigit(args[0])) {
|
||||
double num = Double.parseDouble(args[0]);
|
||||
String root = Double.toString(Math.sqrt(num));
|
||||
String end = root.substring(Math.max(root.length() - 2, 0));
|
||||
if(end.equals(".0")) {
|
||||
root = root.replace(".0","");
|
||||
}
|
||||
event.getTextChannel().sendMessage("The sqaure root of " + args[0] + " is **" + root + "**.").queue();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.fpghoti.biscuit.commands.client;
|
||||
|
||||
import com.fpghoti.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.api.API;
|
||||
import com.fpghoti.biscuit.commands.ClientCommand;
|
||||
import com.fpghoti.biscuit.config.PropertiesRetrieval;
|
||||
import com.fpghoti.biscuit.util.Util;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
public class SubtractCommand extends ClientCommand{
|
||||
|
||||
public SubtractCommand() {
|
||||
name = "Subtract";
|
||||
description = "Subtracts two numbers.";
|
||||
usage = PropertiesRetrieval.getCommandSignifier() + "subtract <Num1> <Num2>";
|
||||
minArgs = 2;
|
||||
maxArgs = 2;
|
||||
identifiers.add("subtract");
|
||||
identifiers.add("sub");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
Biscuit b = API.getBiscuit();
|
||||
b.log(event.getAuthor().getName() + " issued a command: -subtract");
|
||||
if(args[0] != null && Util.isDeciDigit(args[0]) && args[1] != null && Util.isDeciDigit(args[1])) {
|
||||
double num = Double.parseDouble(args[0]);
|
||||
double num2 = Double.parseDouble(args[1]);
|
||||
String sub = Double.toString(num - num2);
|
||||
String end = sub.substring(Math.max(sub.length() - 2, 0));
|
||||
if(end.equals(".0")) {
|
||||
sub = sub.replace(".0","");
|
||||
}
|
||||
event.getTextChannel().sendMessage(args[0] + " - " + args[1] + " is **" + sub + "**.").queue();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
|
||||
import com.fpghoti.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.api.API;
|
||||
import com.fpghoti.biscuit.commands.ClientCommand;
|
||||
import com.fpghoti.biscuit.config.PropertiesRetrieval;
|
||||
import com.fpghoti.biscuit.util.PermUtil;
|
||||
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
@@ -14,7 +15,7 @@ public class UIDCommand extends ClientCommand{
|
||||
public UIDCommand() {
|
||||
name = "User ID";
|
||||
description = "Retrieves a user's ID.";
|
||||
usage = "-uid @<mention-user>";
|
||||
usage = PropertiesRetrieval.getCommandSignifier() + "uid @<mention-user>";
|
||||
minArgs = 1;
|
||||
maxArgs = 1;
|
||||
identifiers.add("uid");
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
|
||||
import com.fpghoti.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.api.API;
|
||||
import com.fpghoti.biscuit.commands.ClientCommand;
|
||||
import com.fpghoti.biscuit.config.PropertiesRetrieval;
|
||||
import com.fpghoti.biscuit.global.SpamRecords;
|
||||
import com.fpghoti.biscuit.util.PermUtil;
|
||||
|
||||
@@ -15,7 +16,7 @@ public class UnSoftMuteCommand extends ClientCommand{
|
||||
public UnSoftMuteCommand() {
|
||||
name = "Un Soft Mute";
|
||||
description = "Removes a soft mute from a user.";
|
||||
usage = "-unsoftmute @<mention-user>";
|
||||
usage = PropertiesRetrieval.getCommandSignifier() + "unsoftmute @<mention-user>";
|
||||
minArgs = 1;
|
||||
maxArgs = 1;
|
||||
identifiers.add("unsoftmute");
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.fpghoti.biscuit.commands.console;
|
||||
|
||||
import com.fpghoti.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.api.API;
|
||||
import com.fpghoti.biscuit.commands.ConsoleCommand;
|
||||
|
||||
@@ -9,14 +10,17 @@ import net.dv8tion.jda.api.entities.TextChannel;
|
||||
|
||||
public class SayCommand extends ConsoleCommand{
|
||||
|
||||
public SayCommand() {
|
||||
name = "Say";
|
||||
description = "Makes bot send message on specified channel.";
|
||||
usage = "say <channel-name> <message>";
|
||||
minArgs = 2;
|
||||
maxArgs = 2000;
|
||||
identifiers.add("say");
|
||||
}
|
||||
public SayCommand() {
|
||||
name = "Say (Console)";
|
||||
description = "Makes bot send message on specified channel.";
|
||||
usage = "[CONSOLE] say <channel-name> <message>";
|
||||
minArgs = 2;
|
||||
maxArgs = 2000;
|
||||
if(!Main.isPlugin) {
|
||||
identifiers.add("say");
|
||||
}
|
||||
identifiers.add("bsay");
|
||||
}
|
||||
|
||||
public void execute(String[] args) {
|
||||
Biscuit b = API.getBiscuit();
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.fpghoti.biscuit.commands.console;
|
||||
|
||||
import com.fpghoti.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.api.API;
|
||||
import com.fpghoti.biscuit.commands.ConsoleCommand;
|
||||
|
||||
public class ShutdownConsoleCommand extends ConsoleCommand{
|
||||
|
||||
public ShutdownConsoleCommand() {
|
||||
name = "Shutdown (Console)";
|
||||
description = "Shuts down the bot.";
|
||||
usage = "[CONSOLE] shutdown";
|
||||
minArgs = 0;
|
||||
maxArgs = 0;
|
||||
identifiers.add("shutdown");
|
||||
}
|
||||
|
||||
public void execute(String[] args) {
|
||||
Biscuit b = API.getBiscuit();
|
||||
if(args.length == 0) {
|
||||
Main.shutdown();
|
||||
}else{
|
||||
b.log("INCORRECT USAGE! TRY: say <channel-name> <message>");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user