Add more logging
This commit is contained in:
parent
b8f29984a6
commit
7a2d31233a
|
@ -67,6 +67,11 @@
|
|||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>dv8tion</id>
|
||||
<name>m2-dv8tion</name>
|
||||
<url>https://m2.dv8tion.net/releases</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
|
@ -84,13 +89,6 @@
|
|||
<name>jcenter-bintray</name>
|
||||
<url>https://jcenter.bintray.com</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
<id>soluvas-public-thirdparty</id>
|
||||
<url>http://nexus.bippo.co.id/nexus/content/repositories/soluvas-public-thirdparty/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
|
|
16
pom.xml
16
pom.xml
|
@ -75,6 +75,11 @@
|
|||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>dv8tion</id>
|
||||
<name>m2-dv8tion</name>
|
||||
<url>https://m2.dv8tion.net/releases</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
|
@ -92,13 +97,6 @@
|
|||
<name>jcenter-bintray</name>
|
||||
<url>https://jcenter.bintray.com</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>soluvas-public-thirdparty</id>
|
||||
<url>http://nexus.bippo.co.id/nexus/content/repositories/soluvas-public-thirdparty/</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
|
@ -159,7 +157,7 @@
|
|||
<dependency>
|
||||
<groupId>net.dv8tion</groupId>
|
||||
<artifactId>JDA</artifactId>
|
||||
<version>4.2.0_225</version>
|
||||
<version>4.3.0_281</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.cage</groupId>
|
||||
|
@ -179,7 +177,7 @@
|
|||
<dependency>
|
||||
<groupId>com.sedmelluq</groupId>
|
||||
<artifactId>lavaplayer</artifactId>
|
||||
<version>1.3.66</version>
|
||||
<version>1.3.77</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.pf4j</groupId>
|
||||
|
|
|
@ -60,6 +60,8 @@ import com.fpghoti.biscuit.listener.LeaveListener;
|
|||
import com.fpghoti.biscuit.listener.MessageDeleteListener;
|
||||
import com.fpghoti.biscuit.listener.MessageEditListener;
|
||||
import com.fpghoti.biscuit.listener.MessageReceiveListener;
|
||||
import com.fpghoti.biscuit.listener.NameListener;
|
||||
import com.fpghoti.biscuit.listener.NicknameListener;
|
||||
import com.fpghoti.biscuit.listener.ReactionListener;
|
||||
import com.fpghoti.biscuit.listener.RoleListener;
|
||||
import com.fpghoti.biscuit.logging.BColor;
|
||||
|
@ -139,6 +141,8 @@ public class Main {
|
|||
jda.addEventListener(new DMListener());
|
||||
jda.addEventListener(new ReactionListener());
|
||||
jda.addEventListener(new RoleListener());
|
||||
jda.addEventListener(new NicknameListener());
|
||||
jda.addEventListener(new NameListener());
|
||||
biscuits = new ArrayList<Biscuit>();
|
||||
for(Guild g : jda.getGuilds()) {
|
||||
Biscuit.loadGuild(g);
|
||||
|
|
|
@ -227,15 +227,15 @@ public class Biscuit {
|
|||
public ArrayList<TextChannel> getCaptchaLogChannels() {
|
||||
ArrayList<TextChannel> ch = new ArrayList<TextChannel>();
|
||||
for(TextChannel t : guild.getTextChannels()) {
|
||||
if(t.getName().equalsIgnoreCase(properties.getCaptchaLogChannel())) {
|
||||
if(t.getName().equalsIgnoreCase(properties.getEventLogChannel())) {
|
||||
ch.add(t);
|
||||
}
|
||||
}
|
||||
return ch;
|
||||
}
|
||||
|
||||
public void captchaLog(String msg) {
|
||||
if(properties.logCaptcha()) {
|
||||
public void eventLog(String msg) {
|
||||
if(properties.logEvents()) {
|
||||
for(TextChannel t : getCaptchaLogChannels()) {
|
||||
MessageText.send(t, msg);
|
||||
}
|
||||
|
|
|
@ -197,7 +197,7 @@ public class Captcha {
|
|||
token = null;
|
||||
|
||||
log(BColor.YELLOW_BOLD + author.getName() + " successfully completed a captcha challenge. Granting role.");
|
||||
biscuit.captchaLog(" ``" + author.getName() +"`` " + author.getAsMention() + " successfully completed a captcha challenge. Granting role.");
|
||||
biscuit.eventLog(" ``" + author.getName() +"`` " + author.getAsMention() + " successfully completed a captcha challenge. Granting role.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.fpghoti.biscuit.commands.base;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.commands.BaseCommand;
|
||||
import com.fpghoti.biscuit.commands.CommandType;
|
||||
|
@ -33,9 +34,12 @@ public class CustomCommand extends BaseCommand {
|
|||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
String desc = biscuit.getConfig().getFromConfig("cc-" + name + "-description", biscuit);
|
||||
String desc = biscuit.getConfig().getFromConfig("cc-" + name + "-description");
|
||||
if(desc == null) {
|
||||
return "null";
|
||||
desc = Main.getMainBiscuit().getConfig().getFromConfig("cc-" + name + "-description");
|
||||
if(desc == null) {
|
||||
return "null";
|
||||
}
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
|
@ -46,9 +50,12 @@ public class CustomCommand extends BaseCommand {
|
|||
}
|
||||
|
||||
public String getMessage() {
|
||||
String msg = biscuit.getConfig().getFromConfig("cc-" + name + "-message", biscuit);
|
||||
String msg = biscuit.getConfig().getFromConfig("cc-" + name + "-message");
|
||||
if(msg == null) {
|
||||
return "null";
|
||||
msg = Main.getMainBiscuit().getConfig().getFromConfig("cc-" + name + "-message");
|
||||
if(msg == null) {
|
||||
return "null";
|
||||
}
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
|
|
@ -61,30 +61,30 @@ public class BiscuitConfig {
|
|||
}
|
||||
|
||||
@Async
|
||||
public void replaceConfig(Attachment a, TextChannel c) {
|
||||
Guild guild = biscuit.getGuild();
|
||||
String code = getFromConfig("Guild-Code", biscuit);
|
||||
if(guild == null) {
|
||||
biscuit.error("Main config replacement is currently not allowed.");
|
||||
return;
|
||||
}
|
||||
String name = guild.getId() + ".properties";
|
||||
if(a.getSize() > 51200) {
|
||||
MessageText.send(c, "**The file is too big!**");
|
||||
return;
|
||||
}
|
||||
File config = new File(biscuit.getConfigDir(), name);
|
||||
a.downloadToFile(config).thenAccept(file -> {
|
||||
updateConfig(file, true, code);
|
||||
MessageText.send(c, "**The config was successfully updated.**");
|
||||
}).exceptionally(t -> {
|
||||
biscuit.error("Could not accept config file.");
|
||||
MessageText.send(c, "**An Exception occurred while trying to read the file.**");
|
||||
return null;
|
||||
});
|
||||
public void replaceConfig(Attachment a, TextChannel c) {
|
||||
Guild guild = biscuit.getGuild();
|
||||
String code = getFromConfig("Guild-Code");
|
||||
if(guild == null) {
|
||||
biscuit.error("Main config replacement is currently not allowed.");
|
||||
return;
|
||||
}
|
||||
String name = guild.getId() + ".properties";
|
||||
if(a.getSize() > 51200) {
|
||||
MessageText.send(c, "**The file is too big!**");
|
||||
return;
|
||||
}
|
||||
File config = new File(biscuit.getConfigDir(), name);
|
||||
a.downloadToFile(config).thenAccept(file -> {
|
||||
updateConfig(file, true, code);
|
||||
MessageText.send(c, "**The config was successfully updated.**");
|
||||
}).exceptionally(t -> {
|
||||
biscuit.error("Could not accept config file.");
|
||||
MessageText.send(c, "**An Exception occurred while trying to read the file.**");
|
||||
return null;
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public void updateConfig(File config) {
|
||||
updateConfig(config, false);
|
||||
|
@ -172,8 +172,8 @@ public class BiscuitConfig {
|
|||
added = addProperty("Toggle-Role-React-Channels", "toggleroles1,toggleroles2,toggleroles3", prop, added, silent);
|
||||
added = addProperty("Boost-Exclusive-Roles", "role2,role3", prop, added, silent);
|
||||
added = addProperty("Treat-Like-Booster", "Nitro Booster,silver,gold", prop, added, silent);
|
||||
added = addProperty("LogCaptcha", "false", prop, added, silent);
|
||||
added = addProperty("Captcha-Log-Channel", "verify-log", prop, added, silent);
|
||||
added = addProperty("LogEvents", "false", prop, added, silent);
|
||||
added = addProperty("Event-Log-Channel", "verify-log", prop, added, silent);
|
||||
added = addProperty("Check-Join-Invite", "false", prop, added, silent);
|
||||
added = addProperty("Custom-Command-Names", "", prop, added, silent);
|
||||
added = addProperty("DM-Before-Kick", "true", prop, added, silent);
|
||||
|
@ -206,44 +206,44 @@ public class BiscuitConfig {
|
|||
return added;
|
||||
}
|
||||
|
||||
public String getFromConfig(String property, Biscuit biscuit){
|
||||
boolean isMain = biscuit.getGuild() == null;
|
||||
public String getFromConfig(String property){
|
||||
boolean isMain = biscuit.getGuild() == null;
|
||||
|
||||
String setting = "";
|
||||
String setting = "";
|
||||
|
||||
Properties prop = new Properties();
|
||||
InputStream input = null;
|
||||
Properties prop = new Properties();
|
||||
InputStream input = null;
|
||||
|
||||
String name = "config.properties";
|
||||
String name = "config.properties";
|
||||
|
||||
if(!isMain) {
|
||||
name = biscuit.getGuild().getId() + ".properties";
|
||||
}
|
||||
File config = new File(biscuit.getConfigDir(), name);
|
||||
if(!isMain) {
|
||||
name = biscuit.getGuild().getId() + ".properties";
|
||||
}
|
||||
File config = new File(biscuit.getConfigDir(), name);
|
||||
|
||||
if(!config.exists()) {
|
||||
return "";
|
||||
}
|
||||
if(!config.exists()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
try {
|
||||
input = new FileInputStream(config);
|
||||
prop.load(input);
|
||||
setting = prop.getProperty(property);
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
} finally {
|
||||
if (input != null) {
|
||||
try {
|
||||
input.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
input = new FileInputStream(config);
|
||||
prop.load(input);
|
||||
setting = prop.getProperty(property);
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
} finally {
|
||||
if (input != null) {
|
||||
try {
|
||||
input.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return setting;
|
||||
return setting;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public File getFile() {
|
||||
if(biscuit.getGuild() == null) {
|
||||
|
|
|
@ -6,378 +6,378 @@ import com.fpghoti.biscuit.util.Util;
|
|||
|
||||
public class BiscuitProperties {
|
||||
|
||||
Biscuit biscuit;
|
||||
Biscuit biscuit;
|
||||
|
||||
public BiscuitProperties(Biscuit b) {
|
||||
this.biscuit = b;
|
||||
}
|
||||
public BiscuitProperties(Biscuit b) {
|
||||
this.biscuit = b;
|
||||
}
|
||||
|
||||
public String getToken(){
|
||||
String key = "Bot-Token";
|
||||
return Main.getMainBiscuit().getConfig().getFromConfig(key, Main.getMainBiscuit());
|
||||
}
|
||||
public String getToken(){
|
||||
String key = "Bot-Token";
|
||||
return Main.getMainBiscuit().getConfig().getFromConfig(key);
|
||||
}
|
||||
|
||||
public String getCommandSignifier(){
|
||||
String key = "Command-Signifier";
|
||||
return Main.getMainBiscuit().getConfig().getFromConfig(key, Main.getMainBiscuit());
|
||||
}
|
||||
public String getCommandSignifier(){
|
||||
String key = "Command-Signifier";
|
||||
return Main.getMainBiscuit().getConfig().getFromConfig(key);
|
||||
}
|
||||
|
||||
public boolean musicBotEnabled(){
|
||||
String key = "Enable-Music-Bot";
|
||||
return Main.getMainBiscuit().getConfig().getFromConfig(key, Main.getMainBiscuit()).equalsIgnoreCase("true");
|
||||
}
|
||||
public boolean musicBotEnabled(){
|
||||
String key = "Enable-Music-Bot";
|
||||
return Main.getMainBiscuit().getConfig().getFromConfig(key).equalsIgnoreCase("true");
|
||||
}
|
||||
|
||||
public boolean logMusicPlayer(){
|
||||
String key = "Log-Music-Player";
|
||||
return Main.getMainBiscuit().getConfig().getFromConfig(key, Main.getMainBiscuit()).equalsIgnoreCase("true");
|
||||
}
|
||||
public boolean logMusicPlayer(){
|
||||
String key = "Log-Music-Player";
|
||||
return Main.getMainBiscuit().getConfig().getFromConfig(key).equalsIgnoreCase("true");
|
||||
}
|
||||
|
||||
public boolean allowMusicBot(){
|
||||
if(!musicBotEnabled()) {
|
||||
return false;
|
||||
}
|
||||
String key = "Allow-Music-Bot";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().allowMusicBot();
|
||||
}
|
||||
String value = biscuit.getConfig().getFromConfig(key, biscuit);
|
||||
return value.equalsIgnoreCase("true");
|
||||
}
|
||||
public boolean allowMusicBot(){
|
||||
if(!musicBotEnabled()) {
|
||||
return false;
|
||||
}
|
||||
String key = "Allow-Music-Bot";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().allowMusicBot();
|
||||
}
|
||||
String value = biscuit.getConfig().getFromConfig(key);
|
||||
return value.equalsIgnoreCase("true");
|
||||
}
|
||||
|
||||
public String getGuildCode(){
|
||||
String key = "Guild-Code";
|
||||
if(biscuit.getGuild() == null) {
|
||||
return "MAIN";
|
||||
}
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return biscuit.getConfig().makeCode(biscuit.getGuild().getName());
|
||||
}
|
||||
return biscuit.getConfig().getFromConfig(key, biscuit);
|
||||
}
|
||||
public String getGuildCode(){
|
||||
String key = "Guild-Code";
|
||||
if(biscuit.getGuild() == null) {
|
||||
return "MAIN";
|
||||
}
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return biscuit.getConfig().makeCode(biscuit.getGuild().getName());
|
||||
}
|
||||
return biscuit.getConfig().getFromConfig(key);
|
||||
}
|
||||
|
||||
public String getDoneEmote(){
|
||||
String key = "Done-Emote";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getDoneEmote();
|
||||
}
|
||||
return biscuit.getConfig().getFromConfig(key, biscuit);
|
||||
}
|
||||
public String getDoneEmote(){
|
||||
String key = "Done-Emote";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getDoneEmote();
|
||||
}
|
||||
return biscuit.getConfig().getFromConfig(key);
|
||||
}
|
||||
|
||||
public String getMusicControllerRole(){
|
||||
String key = "Music-Controller-Role";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getMusicControllerRole();
|
||||
}
|
||||
return biscuit.getConfig().getFromConfig(key, biscuit);
|
||||
}
|
||||
public String getMusicControllerRole(){
|
||||
String key = "Music-Controller-Role";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getMusicControllerRole();
|
||||
}
|
||||
return biscuit.getConfig().getFromConfig(key);
|
||||
}
|
||||
|
||||
public String getKickDMInvite(){
|
||||
String key = "Kick-DM-Invite";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getKickDMInvite();
|
||||
}
|
||||
return biscuit.getConfig().getFromConfig(key, biscuit);
|
||||
}
|
||||
public String getKickDMInvite(){
|
||||
String key = "Kick-DM-Invite";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getKickDMInvite();
|
||||
}
|
||||
return biscuit.getConfig().getFromConfig(key);
|
||||
}
|
||||
|
||||
public boolean captchaEnabled(){
|
||||
String key = "Captcha";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().captchaEnabled();
|
||||
}
|
||||
String value = biscuit.getConfig().getFromConfig(key, biscuit);
|
||||
return value.equalsIgnoreCase("true");
|
||||
}
|
||||
public boolean captchaEnabled(){
|
||||
String key = "Captcha";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().captchaEnabled();
|
||||
}
|
||||
String value = biscuit.getConfig().getFromConfig(key);
|
||||
return value.equalsIgnoreCase("true");
|
||||
}
|
||||
|
||||
public boolean customDefaultRole(){
|
||||
String key = "UseCustomDefaultRole";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().customDefaultRole();
|
||||
}
|
||||
String value = biscuit.getConfig().getFromConfig(key, biscuit);
|
||||
return value.equalsIgnoreCase("true");
|
||||
}
|
||||
public boolean customDefaultRole(){
|
||||
String key = "UseCustomDefaultRole";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().customDefaultRole();
|
||||
}
|
||||
String value = biscuit.getConfig().getFromConfig(key);
|
||||
return value.equalsIgnoreCase("true");
|
||||
}
|
||||
|
||||
public boolean dmBeforeKick(){
|
||||
String key = "DM-Before-Kick";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().dmBeforeKick();
|
||||
}
|
||||
String value = biscuit.getConfig().getFromConfig(key, biscuit);
|
||||
return value.equalsIgnoreCase("true");
|
||||
}
|
||||
public boolean dmBeforeKick(){
|
||||
String key = "DM-Before-Kick";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().dmBeforeKick();
|
||||
}
|
||||
String value = biscuit.getConfig().getFromConfig(key);
|
||||
return value.equalsIgnoreCase("true");
|
||||
}
|
||||
|
||||
public String getCaptchaReward(){
|
||||
String key = "Captcha-Reward-Role";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getCaptchaReward();
|
||||
}
|
||||
return biscuit.getConfig().getFromConfig(key, biscuit);
|
||||
}
|
||||
public String getCaptchaReward(){
|
||||
String key = "Captcha-Reward-Role";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getCaptchaReward();
|
||||
}
|
||||
return biscuit.getConfig().getFromConfig(key);
|
||||
}
|
||||
|
||||
public String getDefaultRole(){
|
||||
String key = "DefaultRoleName";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getDefaultRole();
|
||||
}
|
||||
return biscuit.getConfig().getFromConfig(key, biscuit);
|
||||
}
|
||||
public String getDefaultRole(){
|
||||
String key = "DefaultRoleName";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getDefaultRole();
|
||||
}
|
||||
return biscuit.getConfig().getFromConfig(key);
|
||||
}
|
||||
|
||||
public String getModRole(){
|
||||
String key = "ModRole";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getModRole();
|
||||
}
|
||||
return biscuit.getConfig().getFromConfig(key, biscuit);
|
||||
}
|
||||
public String getModRole(){
|
||||
String key = "ModRole";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getModRole();
|
||||
}
|
||||
return biscuit.getConfig().getFromConfig(key);
|
||||
}
|
||||
|
||||
public String getAdminRole(){
|
||||
String key = "AdminRole";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getAdminRole();
|
||||
}
|
||||
return biscuit.getConfig().getFromConfig(key, biscuit);
|
||||
}
|
||||
public String getAdminRole(){
|
||||
String key = "AdminRole";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getAdminRole();
|
||||
}
|
||||
return biscuit.getConfig().getFromConfig(key);
|
||||
}
|
||||
|
||||
public String getCaptchaLogChannel(){
|
||||
String key = "Captcha-Log-Channel";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getCaptchaLogChannel();
|
||||
}
|
||||
return biscuit.getConfig().getFromConfig(key, biscuit);
|
||||
}
|
||||
public String getEventLogChannel(){
|
||||
String key = "Event-Log-Channel";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getEventLogChannel();
|
||||
}
|
||||
return biscuit.getConfig().getFromConfig(key);
|
||||
}
|
||||
|
||||
public boolean logCaptcha(){
|
||||
String key = "LogCaptcha";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().logCaptcha();
|
||||
}
|
||||
String value = biscuit.getConfig().getFromConfig(key, biscuit);
|
||||
return value.equalsIgnoreCase("true");
|
||||
}
|
||||
public boolean logEvents(){
|
||||
String key = "LogEvents";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().logEvents();
|
||||
}
|
||||
String value = biscuit.getConfig().getFromConfig(key);
|
||||
return value.equalsIgnoreCase("true");
|
||||
}
|
||||
|
||||
public boolean spamPunishAllow(){
|
||||
String key = "AllowSpamPunish";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().spamPunishAllow();
|
||||
}
|
||||
String value = biscuit.getConfig().getFromConfig(key, biscuit);
|
||||
return value.equalsIgnoreCase("true");
|
||||
}
|
||||
public boolean spamPunishAllow(){
|
||||
String key = "AllowSpamPunish";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().spamPunishAllow();
|
||||
}
|
||||
String value = biscuit.getConfig().getFromConfig(key);
|
||||
return value.equalsIgnoreCase("true");
|
||||
}
|
||||
|
||||
public boolean checkJoinInvite(){
|
||||
String key = "Check-Join-Invite";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().checkJoinInvite();
|
||||
}
|
||||
String value = biscuit.getConfig().getFromConfig(key, biscuit);
|
||||
return value.equalsIgnoreCase("true");
|
||||
}
|
||||
public boolean checkJoinInvite(){
|
||||
String key = "Check-Join-Invite";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().checkJoinInvite();
|
||||
}
|
||||
String value = biscuit.getConfig().getFromConfig(key);
|
||||
return value.equalsIgnoreCase("true");
|
||||
}
|
||||
|
||||
public boolean noCaptchaKick(){
|
||||
String key = "No-Captcha-Kick";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().noCaptchaKick();
|
||||
}
|
||||
String value = biscuit.getConfig().getFromConfig(key, biscuit);
|
||||
return value.equalsIgnoreCase("true");
|
||||
}
|
||||
public boolean noCaptchaKick(){
|
||||
String key = "No-Captcha-Kick";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().noCaptchaKick();
|
||||
}
|
||||
String value = biscuit.getConfig().getFromConfig(key);
|
||||
return value.equalsIgnoreCase("true");
|
||||
}
|
||||
|
||||
public Integer noCaptchaKickTime(){
|
||||
String key = "No-Captcha-Kick-Time";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().noCaptchaKickTime();
|
||||
}
|
||||
String value = biscuit.getConfig().getFromConfig(key, biscuit);
|
||||
if(!Util.isDigit(value)) {
|
||||
return 0;
|
||||
}
|
||||
return Integer.parseInt(value);
|
||||
}
|
||||
public Integer noCaptchaKickTime(){
|
||||
String key = "No-Captcha-Kick-Time";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().noCaptchaKickTime();
|
||||
}
|
||||
String value = biscuit.getConfig().getFromConfig(key);
|
||||
if(!Util.isDigit(value)) {
|
||||
return 0;
|
||||
}
|
||||
return Integer.parseInt(value);
|
||||
}
|
||||
|
||||
public boolean logChat(){
|
||||
String key = "ChatLog";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().logChat();
|
||||
}
|
||||
String value = biscuit.getConfig().getFromConfig(key, biscuit);
|
||||
return value.equalsIgnoreCase("true");
|
||||
}
|
||||
public boolean logChat(){
|
||||
String key = "ChatLog";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().logChat();
|
||||
}
|
||||
String value = biscuit.getConfig().getFromConfig(key);
|
||||
return value.equalsIgnoreCase("true");
|
||||
}
|
||||
|
||||
public String[] getNaughtyWords(){
|
||||
String key = "NaughtyList";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getNaughtyWords();
|
||||
}
|
||||
String [] list = biscuit.getConfig().getFromConfig(key, biscuit).replace(" ", "").split(",");
|
||||
if(list.length == 1 && list[0].equals("")) {
|
||||
String[] blank = {};
|
||||
return blank;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
public String[] getNaughtyWords(){
|
||||
String key = "NaughtyList";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getNaughtyWords();
|
||||
}
|
||||
String [] list = biscuit.getConfig().getFromConfig(key).replace(" ", "").split(",");
|
||||
if(list.length == 1 && list[0].equals("")) {
|
||||
String[] blank = {};
|
||||
return blank;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public boolean restrictCmdChannels(){
|
||||
String key = "Restrict-Cmd-Channels";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().restrictCmdChannels();
|
||||
}
|
||||
String value = biscuit.getConfig().getFromConfig(key, biscuit);
|
||||
return value.equalsIgnoreCase("true");
|
||||
}
|
||||
public boolean restrictCmdChannels(){
|
||||
String key = "Restrict-Cmd-Channels";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().restrictCmdChannels();
|
||||
}
|
||||
String value = biscuit.getConfig().getFromConfig(key);
|
||||
return value.equalsIgnoreCase("true");
|
||||
}
|
||||
|
||||
public String[] getCmdChannels(){
|
||||
String key = "CmdChannels";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getCmdChannels();
|
||||
}
|
||||
String [] list = biscuit.getConfig().getFromConfig(key, biscuit).replace(" ", "").split(",");
|
||||
if(list.length == 1 && list[0].equals("")) {
|
||||
String[] blank = {};
|
||||
return blank;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
public String[] getCmdChannels(){
|
||||
String key = "CmdChannels";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getCmdChannels();
|
||||
}
|
||||
String [] list = biscuit.getConfig().getFromConfig(key).replace(" ", "").split(",");
|
||||
if(list.length == 1 && list[0].equals("")) {
|
||||
String[] blank = {};
|
||||
return blank;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public String[] getDontLogChannels(){
|
||||
String key = "Channels-To-Not-Chatlog";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getCmdChannels();
|
||||
}
|
||||
String [] list = biscuit.getConfig().getFromConfig(key, biscuit).replace(" ", "").split(",");
|
||||
if(list.length == 1 && list[0].equals("")) {
|
||||
String[] blank = {};
|
||||
return blank;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
public String[] getDontLogChannels(){
|
||||
String key = "Channels-To-Not-Chatlog";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getCmdChannels();
|
||||
}
|
||||
String [] list = biscuit.getConfig().getFromConfig(key).replace(" ", "").split(",");
|
||||
if(list.length == 1 && list[0].equals("")) {
|
||||
String[] blank = {};
|
||||
return blank;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public String[] getToggleRoles(){
|
||||
String key = "ToggleRoles";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getToggleRoles();
|
||||
}
|
||||
String [] list = biscuit.getConfig().getFromConfig(key, biscuit).replace(" , ", ",").replace(", ", ",").split(",");
|
||||
if(list.length == 1 && list[0].equals("")) {
|
||||
String[] blank = {};
|
||||
return blank;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
public String[] getToggleRoles(){
|
||||
String key = "ToggleRoles";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getToggleRoles();
|
||||
}
|
||||
String [] list = biscuit.getConfig().getFromConfig(key).replace(" , ", ",").replace(", ", ",").split(",");
|
||||
if(list.length == 1 && list[0].equals("")) {
|
||||
String[] blank = {};
|
||||
return blank;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public String[] getBoostExclusiveRoles(){
|
||||
String key = "Boost-Exclusive-Roles";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getBoostExclusiveRoles();
|
||||
}
|
||||
String [] list = biscuit.getConfig().getFromConfig(key, biscuit).replace(" , ", ",").replace(", ", ",").split(",");
|
||||
if(list.length == 1 && list[0].equals("")) {
|
||||
String[] blank = {};
|
||||
return blank;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
public String[] getBoostExclusiveRoles(){
|
||||
String key = "Boost-Exclusive-Roles";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getBoostExclusiveRoles();
|
||||
}
|
||||
String [] list = biscuit.getConfig().getFromConfig(key).replace(" , ", ",").replace(", ", ",").split(",");
|
||||
if(list.length == 1 && list[0].equals("")) {
|
||||
String[] blank = {};
|
||||
return blank;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public String[] getBoosterRoles(){
|
||||
String key = "Treat-Like-Booster";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getBoosterRoles();
|
||||
}
|
||||
String [] list = biscuit.getConfig().getFromConfig(key, biscuit).replace(" , ", ",").replace(", ", ",").split(",");
|
||||
if(list.length == 1 && list[0].equals("")) {
|
||||
String[] blank = {};
|
||||
return blank;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
public String[] getBoosterRoles(){
|
||||
String key = "Treat-Like-Booster";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getBoosterRoles();
|
||||
}
|
||||
String [] list = biscuit.getConfig().getFromConfig(key).replace(" , ", ",").replace(", ", ",").split(",");
|
||||
if(list.length == 1 && list[0].equals("")) {
|
||||
String[] blank = {};
|
||||
return blank;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public String[] getMusicChannels(){
|
||||
String key = "Music-Channels";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getMusicChannels();
|
||||
}
|
||||
String [] list = biscuit.getConfig().getFromConfig(key, biscuit).replace(" , ", ",").replace(", ", ",").split(",");
|
||||
if(list.length == 1 && list[0].equals("")) {
|
||||
String[] blank = {};
|
||||
return blank;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
public String[] getMusicChannels(){
|
||||
String key = "Music-Channels";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getMusicChannels();
|
||||
}
|
||||
String [] list = biscuit.getConfig().getFromConfig(key).replace(" , ", ",").replace(", ", ",").split(",");
|
||||
if(list.length == 1 && list[0].equals("")) {
|
||||
String[] blank = {};
|
||||
return blank;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public String[] blockedUnicodeEmotes(){
|
||||
String key = "Block-Unicode-Emotes";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().blockedUnicodeEmotes();
|
||||
}
|
||||
String [] list = biscuit.getConfig().getFromConfig(key, biscuit).replace(" ", "").split(",");
|
||||
if(list.length == 1 && list[0].equals("")) {
|
||||
String[] blank = {};
|
||||
return blank;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
public String[] blockedUnicodeEmotes(){
|
||||
String key = "Block-Unicode-Emotes";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().blockedUnicodeEmotes();
|
||||
}
|
||||
String [] list = biscuit.getConfig().getFromConfig(key).replace(" ", "").split(",");
|
||||
if(list.length == 1 && list[0].equals("")) {
|
||||
String[] blank = {};
|
||||
return blank;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public String[] blockedCustomEmotes(){
|
||||
String key = "Block-Custom-Emotes";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().blockedCustomEmotes();
|
||||
}
|
||||
String [] list = biscuit.getConfig().getFromConfig(key, biscuit).replace(" ", "").split(",");
|
||||
if(list.length == 1 && list[0].equals("")) {
|
||||
String[] blank = {};
|
||||
return blank;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
public String[] blockedCustomEmotes(){
|
||||
String key = "Block-Custom-Emotes";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().blockedCustomEmotes();
|
||||
}
|
||||
String [] list = biscuit.getConfig().getFromConfig(key).replace(" ", "").split(",");
|
||||
if(list.length == 1 && list[0].equals("")) {
|
||||
String[] blank = {};
|
||||
return blank;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public String[] getCustomCmds(){
|
||||
String key = "Custom-Command-Names";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getCustomCmds();
|
||||
}
|
||||
String [] list = biscuit.getConfig().getFromConfig(key, biscuit).replace(" ", "").split(",");
|
||||
if(list.length == 1 && list[0].equals("")) {
|
||||
String[] blank = {};
|
||||
return blank;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
public String[] getCustomCmds(){
|
||||
String key = "Custom-Command-Names";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getCustomCmds();
|
||||
}
|
||||
String [] list = biscuit.getConfig().getFromConfig(key).replace(" ", "").split(",");
|
||||
if(list.length == 1 && list[0].equals("")) {
|
||||
String[] blank = {};
|
||||
return blank;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public String[] disabledCommands(){
|
||||
String key = "DisabledCommands";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().disabledCommands();
|
||||
}
|
||||
String [] list = biscuit.getConfig().getFromConfig(key, biscuit).replace(" ", "").split(",");
|
||||
if(list.length == 1 && list[0].equals("")) {
|
||||
String[] blank = {};
|
||||
return blank;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
public String[] disabledCommands(){
|
||||
String key = "DisabledCommands";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().disabledCommands();
|
||||
}
|
||||
String [] list = biscuit.getConfig().getFromConfig(key).replace(" ", "").split(",");
|
||||
if(list.length == 1 && list[0].equals("")) {
|
||||
String[] blank = {};
|
||||
return blank;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public String[] disabledUserCommands(){
|
||||
String key = "DisabledUserCommands";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().disabledUserCommands();
|
||||
}
|
||||
String [] list = biscuit.getConfig().getFromConfig(key, biscuit).replace(" ", "").split(",");
|
||||
if(list.length == 1 && list[0].equals("")) {
|
||||
String[] blank = {};
|
||||
return blank;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
public String[] disabledUserCommands(){
|
||||
String key = "DisabledUserCommands";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().disabledUserCommands();
|
||||
}
|
||||
String [] list = biscuit.getConfig().getFromConfig(key).replace(" ", "").split(",");
|
||||
if(list.length == 1 && list[0].equals("")) {
|
||||
String[] blank = {};
|
||||
return blank;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public String[] getToggleChannels(){
|
||||
String key = "Toggle-Role-React-Channels";
|
||||
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getToggleChannels();
|
||||
}
|
||||
String [] list = biscuit.getConfig().getFromConfig(key, biscuit).replace(" ", "").split(",");
|
||||
if(list.length == 1 && list[0].equals("")) {
|
||||
String[] blank = {};
|
||||
return blank;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
public String[] getToggleChannels(){
|
||||
String key = "Toggle-Role-React-Channels";
|
||||
if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
|
||||
return Main.getMainBiscuit().getProperties().getToggleChannels();
|
||||
}
|
||||
String [] list = biscuit.getConfig().getFromConfig(key).replace(" ", "").split(",");
|
||||
if(list.length == 1 && list[0].equals("")) {
|
||||
String[] blank = {};
|
||||
return blank;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
|
@ -22,7 +22,7 @@ public class JoinListener extends ListenerAdapter {
|
|||
Biscuit biscuit = Biscuit.getBiscuit(event.getGuild());
|
||||
User user = event.getMember().getUser();
|
||||
biscuit.log(BColor.YELLOW_BOLD + "USER JOINED: " + user.getName() + " " + user.getAsMention());
|
||||
biscuit.captchaLog("**User Joined:** ``" + user.getName() + "`` " + user.getAsMention());
|
||||
biscuit.eventLog("**User Joined:** ``" + user.getName() + "`` " + user.getAsMention());
|
||||
if(biscuit.canManageServer() && biscuit.getProperties().checkJoinInvite()) {
|
||||
logUserInvite(user, biscuit);
|
||||
}else {
|
||||
|
@ -74,7 +74,7 @@ public class JoinListener extends ListenerAdapter {
|
|||
}
|
||||
b.setInviteUses(newinv);
|
||||
b.log(BColor.YELLOW_BOLD + "INVITE INFO: " + BColor.WHITE + user.getName() + " used invite: " + BColor.GREEN_BOLD + usedInv);
|
||||
b.captchaLog("**Invite Info:** ``" + user.getName() + "`` used invite: ``" + usedInv + "``");
|
||||
b.eventLog("**Invite Info:** ``" + user.getName() + "`` used invite: ``" + usedInv + "``");
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ public class LeaveListener extends ListenerAdapter {
|
|||
}
|
||||
if(time > 0) {
|
||||
biscuit.log(BColor.YELLOW + "USER LEFT: " + user.getName() + " " + user.getAsMention());
|
||||
biscuit.captchaLog("**User Left: ** ``" + user.getName() + "`` " + user.getAsMention());
|
||||
biscuit.eventLog("**User Left: ** ``" + user.getName() + "`` " + user.getAsMention());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ public class MessageDeleteListener extends ListenerAdapter {
|
|||
public void onMessageDelete(MessageDeleteEvent event) {
|
||||
Biscuit biscuit = Biscuit.getBiscuit(event.getGuild());
|
||||
if(Util.isLoggable(event.getTextChannel())) {
|
||||
biscuit.log(BColor.MAGENTA_BOLD + "Message " + event.getMessageId() + " was deleted.");
|
||||
biscuit.log("[" + BColor.MAGENTA + "#" + event.getChannel().getName() + BColor.RESET + "] " + BColor.MAGENTA_BOLD + "Message " + event.getMessageId() + " was deleted.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,9 +14,8 @@ public class MessageEditListener extends ListenerAdapter {
|
|||
Biscuit biscuit = Biscuit.getBiscuit(event.getGuild());
|
||||
if(Util.isLoggable(event.getTextChannel()) && (!event.getAuthor().getName().equalsIgnoreCase("jbot") && !event.getAuthor().isBot())) {
|
||||
biscuit.log("[" + BColor.CYAN_BOLD + "MSG EDIT" + BColor.RESET + "] " + BColor.CYAN + "ID: " + BColor.RESET +
|
||||
event.getMessageId() + BColor.CYAN + " User: " + BColor.RESET + event.getAuthor().getAsMention() +
|
||||
BColor.GREEN + " Channel: " + BColor.RESET + event.getChannel().getName());
|
||||
biscuit.log(BColor.CYAN + event.getAuthor().getName() + ": " + BColor.WHITE_BOLD + event.getMessage().getContentDisplay());
|
||||
event.getMessageId() + BColor.CYAN + " User: " + BColor.RESET + event.getAuthor().getAsMention());
|
||||
biscuit.log("[" + BColor.CYAN_BOLD + "#" + event.getChannel().getName() + BColor.RESET + "] " + BColor.CYAN + event.getAuthor().getName() + ": " + BColor.WHITE_BOLD + event.getMessage().getContentDisplay());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,8 +54,7 @@ public class MessageReceiveListener extends ListenerAdapter{
|
|||
if(Util.isLoggable(event.getChannel())) {
|
||||
if(biscuit.getProperties().logChat()) {
|
||||
biscuit.log("[" + BColor.CYAN_BOLD + "MSG" + BColor.RESET + "] " + BColor.GREEN + "ID: " + BColor.RESET +
|
||||
event.getMessageId() + BColor.GREEN + " Sender: " + BColor.RESET + event.getAuthor().getAsMention() +
|
||||
BColor.GREEN + " Channel: " + BColor.RESET + event.getChannel().getName());
|
||||
event.getMessageId() + BColor.GREEN + " Sender: " + BColor.RESET + event.getAuthor().getAsMention());
|
||||
String msg = event.getMessage().getContentDisplay();
|
||||
|
||||
if(event.getMessage().getAttachments().size() >= 1) {
|
||||
|
@ -69,7 +68,7 @@ public class MessageReceiveListener extends ListenerAdapter{
|
|||
msg = msg + tail;
|
||||
}
|
||||
|
||||
biscuit.log(BColor.GREEN_BOLD + event.getAuthor().getName() + ": " + BColor.WHITE_BOLD + msg);
|
||||
biscuit.log("[" + BColor.CYAN_BOLD + "#" + event.getChannel().getName() + BColor.RESET + "] " + BColor.GREEN_BOLD + event.getAuthor().getName() + ": " + BColor.RESET + msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package com.fpghoti.biscuit.listener;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.logging.BColor;
|
||||
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import net.dv8tion.jda.api.events.user.update.UserUpdateNameEvent;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
|
||||
public class NameListener extends ListenerAdapter {
|
||||
|
||||
@Override
|
||||
public void onUserUpdateName(UserUpdateNameEvent event) {
|
||||
User user = event.getUser();
|
||||
Main.getMainBiscuit().log(BColor.CYAN_BOLD + "User " + user.getName() + " " + user.getAsMention() + " changed username from " +
|
||||
event.getOldName() + " to " + event.getNewName() + ".");
|
||||
for(Guild guild : user.getMutualGuilds()) {
|
||||
Biscuit biscuit = Biscuit.getBiscuit(guild);
|
||||
biscuit.eventLog("**Username changed:** ``" + user.getName() + "`` " + user.getAsMention() + " - From ``" +
|
||||
event.getOldName() + "`` to ``" + event.getNewName() + "``");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.fpghoti.biscuit.listener;
|
||||
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.logging.BColor;
|
||||
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import net.dv8tion.jda.api.events.guild.member.update.GuildMemberUpdateNicknameEvent;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
|
||||
public class NicknameListener extends ListenerAdapter {
|
||||
|
||||
@Override
|
||||
public void onGuildMemberUpdateNickname(GuildMemberUpdateNicknameEvent event) {
|
||||
Biscuit biscuit = Biscuit.getBiscuit(event.getGuild());
|
||||
User user = event.getMember().getUser();
|
||||
String oldNick = "None";
|
||||
String newNick = "None";
|
||||
|
||||
if(event.getOldNickname() != null) {
|
||||
oldNick = event.getOldNickname();
|
||||
}
|
||||
|
||||
if(event.getNewNickname() != null) {
|
||||
newNick = event.getNewNickname();
|
||||
}
|
||||
|
||||
biscuit.log(BColor.CYAN + "User " + user.getName() + " " + user.getAsMention() + " changed nickname from " +
|
||||
oldNick + " to " + newNick + ".");
|
||||
|
||||
if(event.getOldNickname() != null) {
|
||||
oldNick = "``" + event.getOldNickname() + "``";
|
||||
}
|
||||
|
||||
if(event.getNewNickname() != null) {
|
||||
newNick = "``" + event.getNewNickname() + "``";
|
||||
}
|
||||
biscuit.eventLog("**Nickname changed:** ``" + user.getName() + "`` " + user.getAsMention() + " - From " +
|
||||
oldNick + " to " + newNick);
|
||||
}
|
||||
|
||||
}
|
|
@ -11,14 +11,14 @@ public class BiscuitLog {
|
|||
private final Logger file = LoggerFactory.getLogger("B-File");
|
||||
|
||||
public void debug(String msg) {
|
||||
console.debug(BColor.MAGENTA_BOLD + msg + BColor.RESET);
|
||||
console.debug("[" + BColor.MAGENTA_BOLD + "DEBUG" + BColor.RESET + "] " + BColor.MAGENTA + msg + BColor.RESET);
|
||||
if(!Main.isPlugin) {
|
||||
file.debug(BColor.clear(msg));
|
||||
}
|
||||
}
|
||||
|
||||
public void error(String msg) {
|
||||
console.error(BColor.RED + msg + BColor.RESET);
|
||||
console.error("[" + BColor.RED_BOLD + "ERROR" + BColor.RESET + "] " + BColor.RED + msg + BColor.RESET);
|
||||
if(!Main.isPlugin) {
|
||||
file.error(BColor.clear(msg));
|
||||
}
|
||||
|
@ -32,14 +32,14 @@ public class BiscuitLog {
|
|||
}
|
||||
|
||||
public void trace(String msg) {
|
||||
console.trace(BColor.WHITE_BOLD + msg + BColor.RESET);
|
||||
console.trace("[" + BColor.CYAN_BOLD + "TRACE" + BColor.RESET + "] " + BColor.CYAN + msg + BColor.RESET);
|
||||
if(!Main.isPlugin) {
|
||||
file.trace(BColor.clear(msg));
|
||||
}
|
||||
}
|
||||
|
||||
public void warn(String msg) {
|
||||
console.warn(BColor.YELLOW + msg + BColor.RESET);
|
||||
console.warn("[" + BColor.YELLOW_BOLD + "WARN" + BColor.RESET + "] " + BColor.YELLOW + msg + BColor.RESET);
|
||||
if(!Main.isPlugin) {
|
||||
file.warn(BColor.clear(msg));
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public class PreUser {
|
|||
}
|
||||
|
||||
biscuit.log(user.getName() + " " + user.getAsMention() + " waited too long to complete the captcha. Kicking...");
|
||||
biscuit.captchaLog("``" + user.getName() +"`` " + user.getAsMention() + " waited too long to complete the captcha! Kicking...");
|
||||
biscuit.eventLog("``" + user.getName() +"`` " + user.getAsMention() + " waited too long to complete the captcha! Kicking...");
|
||||
|
||||
//While being checked for captcha, a user should only have one role. If they have the captcha role and other roles(s),
|
||||
//do not kick. This is to prevent issues from arising where users are given the captcha role after the check.
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<appender name="STDOUT"
|
||||
class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%colorize([%date{MM/dd/yyyy HH:mm:ss}] %level) - %msg%n</pattern>
|
||||
<pattern>%colorize([%date{MM/dd/yyyy HH:mm:ss}]) %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
|||
<encoder
|
||||
class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<Pattern>
|
||||
<pattern>[%date{MM/dd/yyyy HH:mm:ss}] %level - %msg%n</pattern>
|
||||
<pattern>[%date{MM/dd/yyyy HH:mm:ss}] %msg%n</pattern>
|
||||
</Pattern>
|
||||
</encoder>
|
||||
|
||||
|
|
Loading…
Reference in New Issue