Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c67bf65d3 | ||
|
|
984a081ccf | ||
|
|
270b945408 | ||
|
|
fb0d5de6e3 |
+2
-2
@@ -12,6 +12,7 @@
|
|||||||
<classpathentry kind="lib" path="lib/httpclient-4.5.5.jar"/>
|
<classpathentry kind="lib" path="lib/httpclient-4.5.5.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/httpcore-4.4.9.jar"/>
|
<classpathentry kind="lib" path="lib/httpcore-4.4.9.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/WolframAlpha-1.1.jar"/>
|
<classpathentry kind="lib" path="lib/WolframAlpha-1.1.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/JDA-3.7.1_385-withDependencies.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/sqlite-jdbc-3.23.1.jar"/>
|
<classpathentry kind="lib" path="lib/sqlite-jdbc-3.23.1.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/slf4j-jdk14-1.7.25.jar"/>
|
<classpathentry kind="lib" path="lib/slf4j-jdk14-1.7.25.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/twitter4j-core-4.0.7-javadoc.jar"/>
|
<classpathentry kind="lib" path="lib/twitter4j-core-4.0.7-javadoc.jar"/>
|
||||||
@@ -26,7 +27,6 @@
|
|||||||
<classpathentry kind="lib" path="lib/google-http-client-1.32.0.jar"/>
|
<classpathentry kind="lib" path="lib/google-http-client-1.32.0.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/google-api-services-youtube-v3-rev212-1.25.0.jar"/>
|
<classpathentry kind="lib" path="lib/google-api-services-youtube-v3-rev212-1.25.0.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/nanohttpd-2.3.1.jar"/>
|
<classpathentry kind="lib" path="lib/nanohttpd-2.3.1.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/LavaPlayerJar-1.3.50-jar-with-dependencies.jar"/>
|
<classpathentry kind="lib" path="G:/Shared/Coding/Java/workspace/ProKitty/lib/LavaPlayerJar-1.3.50-jar-with-dependencies.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/JDA-4.2.0_168-withDependencies.jar"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -68,5 +68,3 @@ rP\.txt
|
|||||||
*.log
|
*.log
|
||||||
|
|
||||||
cloc\.exe
|
cloc\.exe
|
||||||
|
|
||||||
beanImage.png
|
|
||||||
|
|||||||
+1
-5
@@ -1,6 +1,5 @@
|
|||||||
"Type","Key","Value"
|
"Type","Key","Value"
|
||||||
"Globals","mode (dev or release)","dev"
|
"Globals","mode (dev or release)","dev"
|
||||||
"Globals","activity","with a laser pointer"
|
|
||||||
"Localized Commands","beans",""
|
"Localized Commands","beans",""
|
||||||
"Localized Commands","benchmark, bench",""
|
"Localized Commands","benchmark, bench",""
|
||||||
"Localized Commands","bet",""
|
"Localized Commands","bet",""
|
||||||
@@ -58,8 +57,6 @@
|
|||||||
"Localized Commands","work",""
|
"Localized Commands","work",""
|
||||||
"Localized Commands","yeet",""
|
"Localized Commands","yeet",""
|
||||||
"Localized Strings","AddGuildRoleFailure","Failed to add %s to %s"
|
"Localized Strings","AddGuildRoleFailure","Failed to add %s to %s"
|
||||||
"Localized Strings","BeansImageBottomText","BEANS"
|
|
||||||
"Localized Strings","BeansImageTopText","YOU HAVE"
|
|
||||||
"Localized Strings","BeansShowDisplay","You have %s beans!"
|
"Localized Strings","BeansShowDisplay","You have %s beans!"
|
||||||
"Localized Strings","BeansShowInfo","Displays how many beans you have"
|
"Localized Strings","BeansShowInfo","Displays how many beans you have"
|
||||||
"Localized Strings","BeansShowMentioned","I took a look and %sbeans!"
|
"Localized Strings","BeansShowMentioned","I took a look and %sbeans!"
|
||||||
@@ -73,8 +70,7 @@
|
|||||||
"Localized Strings","BetBeansNotValid","That's not a valid bet!"
|
"Localized Strings","BetBeansNotValid","That's not a valid bet!"
|
||||||
"Localized Strings","BetBeansWin","You won %s beans!"
|
"Localized Strings","BetBeansWin","You won %s beans!"
|
||||||
"Localized Strings","BetHistoryInfo","Gives how many beans I've ~~stolen~~ won from your bets!"
|
"Localized Strings","BetHistoryInfo","Gives how many beans I've ~~stolen~~ won from your bets!"
|
||||||
"Localized Strings","BetHistoryOptionalPNGPath",""
|
"Localized Strings","BetHistoryOutput","I have %s treats from betting!"
|
||||||
"Localized Strings","BetHistoryOutput","I have %s beans from betting!"
|
|
||||||
"Localized Strings","BlurryInfo","Blurs your icon or the icon of a friend you mentioned"
|
"Localized Strings","BlurryInfo","Blurs your icon or the icon of a friend you mentioned"
|
||||||
"Localized Strings","BoopInfo","Kitty will react with a counter"
|
"Localized Strings","BoopInfo","Kitty will react with a counter"
|
||||||
"Localized Strings","BoopMultiple","%s booped several others - %s!"
|
"Localized Strings","BoopMultiple","%s booped several others - %s!"
|
||||||
|
|||||||
|
Binary file not shown.
|
After Width: | Height: | Size: 50 KiB |
Binary file not shown.
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
package commands.beans;
|
package commands.general;
|
||||||
|
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.FontMetrics;
|
import java.awt.FontMetrics;
|
||||||
@@ -118,9 +118,9 @@ public class CommandBeansShow extends Command
|
|||||||
Font beanFont = new Font("font", Font.BOLD, 45);
|
Font beanFont = new Font("font", Font.BOLD, 45);
|
||||||
beanGraphics.setFont(beanFont);
|
beanGraphics.setFont(beanFont);
|
||||||
|
|
||||||
drawCenteredString(beanGraphics, LocStrings.stub("BeansImageTopText"), rect, beanFont, .25);
|
drawCenteredString(beanGraphics, "YOU HAVE", rect, beanFont, .25);
|
||||||
drawCenteredString(beanGraphics, "" + beans, rect, beanFont, .5);
|
drawCenteredString(beanGraphics, "" + beans, rect, beanFont, .5);
|
||||||
drawCenteredString(beanGraphics, LocStrings.stub("BeansImageBottomText"), rect, beanFont, .75);
|
drawCenteredString(beanGraphics, "BEANS!", rect, beanFont, .75);
|
||||||
|
|
||||||
ImageIO.write(beanImage, "PNG", new File("beanImage.png"));
|
ImageIO.write(beanImage, "PNG", new File("beanImage.png"));
|
||||||
return new File("beanImage.png");
|
return new File("beanImage.png");
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package commands.beans;
|
package commands.general;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
+1
-21
@@ -1,6 +1,4 @@
|
|||||||
package commands.beans;
|
package commands.general;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.LocStrings;
|
import core.LocStrings;
|
||||||
@@ -11,8 +9,6 @@ import dataStructures.KittyRole;
|
|||||||
import dataStructures.KittyUser;
|
import dataStructures.KittyUser;
|
||||||
import dataStructures.Response;
|
import dataStructures.Response;
|
||||||
import dataStructures.UserInput;
|
import dataStructures.UserInput;
|
||||||
import utils.GlobalLog;
|
|
||||||
import utils.LogFilter;
|
|
||||||
|
|
||||||
public class CommandBetHistory extends Command
|
public class CommandBetHistory extends Command
|
||||||
{
|
{
|
||||||
@@ -24,22 +20,6 @@ public class CommandBetHistory extends Command
|
|||||||
@Override
|
@Override
|
||||||
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
{
|
{
|
||||||
// Send primary response
|
|
||||||
res.send(String.format(LocStrings.stub("BetHistoryOutput"), guild.beans.get()));
|
res.send(String.format(LocStrings.stub("BetHistoryOutput"), guild.beans.get()));
|
||||||
|
|
||||||
// Look up extra information to see if we ahve a flair image
|
|
||||||
String optional = LocStrings.stub("BetHistoryOptionalPNGPath");
|
|
||||||
if(optional != null && optional.length() > 0)
|
|
||||||
{
|
|
||||||
File responseImage = new File(optional);
|
|
||||||
if(responseImage.exists())
|
|
||||||
{
|
|
||||||
res.sendFile(responseImage, ".png");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GlobalLog.warn(LogFilter.Command, "Optional PNG image for bet history was specified, but the file could not be found.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package commands.images;
|
package commands.general;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package commands.images;
|
package commands.general;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package commands.network;
|
package commands.general;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.LocStrings;
|
import core.LocStrings;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package commands.dev;
|
package commands.general;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.Constants;
|
import core.Constants;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package commands.dev;
|
package commands.general;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package commands.images;
|
package commands.general;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package commands.network;
|
package commands.general;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.LocStrings;
|
import core.LocStrings;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package commands.dev;
|
package commands.general;
|
||||||
|
|
||||||
import core.*;
|
import core.*;
|
||||||
import dataStructures.KittyChannel;
|
import dataStructures.KittyChannel;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package commands.network;
|
package commands.general;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.LocStrings;
|
import core.LocStrings;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package commands.network;
|
package commands.general;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.LocStrings;
|
import core.LocStrings;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package commands.beans;
|
package commands.general;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.LocStrings;
|
import core.LocStrings;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package commands.dev;
|
package commands.general;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package commands.dev;
|
package commands.general;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.LocStrings;
|
import core.LocStrings;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package commands.network;
|
package commands.general;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.LocStrings;
|
import core.LocStrings;
|
||||||
@@ -7,7 +7,7 @@ import core.Command;
|
|||||||
import core.Constants;
|
import core.Constants;
|
||||||
import core.DatabaseManager;
|
import core.DatabaseManager;
|
||||||
import core.LocStrings;
|
import core.LocStrings;
|
||||||
import core.ObjectBuilder;
|
import core.ObjectBuilderFactory;
|
||||||
import dataStructures.KittyChannel;
|
import dataStructures.KittyChannel;
|
||||||
import dataStructures.KittyEmbed;
|
import dataStructures.KittyEmbed;
|
||||||
import dataStructures.KittyGuild;
|
import dataStructures.KittyGuild;
|
||||||
@@ -98,7 +98,7 @@ public class CommandLeaderboard extends Command
|
|||||||
{
|
{
|
||||||
// Only now that we've sorted do we do the full construction and caching of users
|
// Only now that we've sorted do we do the full construction and caching of users
|
||||||
Pair<Long, String> userPair = users.get(i);
|
Pair<Long, String> userPair = users.get(i);
|
||||||
KittyUser cachedUser = ObjectBuilder.getKittyUser(guildID, userPair.Second);
|
KittyUser cachedUser = ObjectBuilderFactory.getKittyUser(guildID, userPair.Second);
|
||||||
|
|
||||||
if(cachedUser == null)
|
if(cachedUser == null)
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package commands.images;
|
package commands.general;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package commands.dev;
|
package commands.general;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.DatabaseManager;
|
import core.DatabaseManager;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package commands.images;
|
package commands.general;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package commands.dev;
|
package commands.general;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.LocStrings;
|
import core.LocStrings;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package commands.images;
|
package commands.general;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package commands.beans;
|
package commands.general;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.LocStrings;
|
import core.LocStrings;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package commands.dev;
|
package commands.general;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.LocStrings;
|
import core.LocStrings;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package commands.network;
|
package commands.general;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package commands.images;
|
package commands.general;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -4,37 +4,11 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import commands.beans.CommandBeansShow;
|
|
||||||
import commands.beans.CommandBetBeans;
|
|
||||||
import commands.beans.CommandBetHistory;
|
|
||||||
import commands.beans.CommandGiveBeans;
|
|
||||||
import commands.beans.CommandTradeBeans;
|
|
||||||
import commands.characters.CommandCharacterMain;
|
import commands.characters.CommandCharacterMain;
|
||||||
import commands.dev.CommandDBFlush;
|
|
||||||
import commands.dev.CommandDBStats;
|
|
||||||
import commands.dev.CommandDoWork;
|
|
||||||
import commands.dev.CommandHelpBuilder;
|
|
||||||
import commands.dev.CommandInvite;
|
|
||||||
import commands.dev.CommandShutdown;
|
|
||||||
import commands.dev.CommandStats;
|
|
||||||
import commands.dev.CommandTweet;
|
|
||||||
import commands.general.*;
|
import commands.general.*;
|
||||||
import commands.guildrole.CommandGuildRoleMain;
|
import commands.guildrole.CommandGuildRoleMain;
|
||||||
import commands.images.CommandBlurry;
|
|
||||||
import commands.images.CommandCatch;
|
|
||||||
import commands.images.CommandDefaultDance;
|
|
||||||
import commands.images.CommandPerish;
|
|
||||||
import commands.images.CommandStark;
|
|
||||||
import commands.images.CommandTeey;
|
|
||||||
import commands.images.CommandYeet;
|
|
||||||
import commands.mod.CommandModMain;
|
import commands.mod.CommandModMain;
|
||||||
import commands.music.CommandMusicMain;
|
import commands.music.CommandMusicMain;
|
||||||
import commands.network.CommandColiru;
|
|
||||||
import commands.network.CommandDerpi;
|
|
||||||
import commands.network.CommandE6;
|
|
||||||
import commands.network.CommandGetSauce;
|
|
||||||
import commands.network.CommandJDoodle;
|
|
||||||
import commands.network.CommandWolfram;
|
|
||||||
import commands.poll.CommandPollMain;
|
import commands.poll.CommandPollMain;
|
||||||
import commands.raffle.CommandRaffleMain;
|
import commands.raffle.CommandRaffleMain;
|
||||||
import dataStructures.*;
|
import dataStructures.*;
|
||||||
|
|||||||
@@ -18,20 +18,13 @@ public class ConfigGlobals implements IConfigSection
|
|||||||
private static final String startupStyleKey = "mode (dev or release)";
|
private static final String startupStyleKey = "mode (dev or release)";
|
||||||
private KittyStartupMode startupStyleValue = KittyStartupMode.Dev;
|
private KittyStartupMode startupStyleValue = KittyStartupMode.Dev;
|
||||||
|
|
||||||
private static final String activityKey = "activity";
|
// Constructor
|
||||||
private String activityValue = "with a laser pointer"; // Appears as "Playing with a laser pointer"
|
|
||||||
|
|
||||||
// Singleton Constructor - explode if there's a problem.
|
|
||||||
public ConfigGlobals()
|
public ConfigGlobals()
|
||||||
{
|
{
|
||||||
if(instance == null)
|
if(instance == null)
|
||||||
{
|
|
||||||
instance = this;
|
instance = this;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
GlobalLog.error("Attempted to initialize a second config globals! Probably don't do this!");
|
GlobalLog.error("Attempted to initialize a second config globals! Probably don't do this!");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -45,11 +38,6 @@ public class ConfigGlobals implements IConfigSection
|
|||||||
return instance.startupStyleValue;
|
return instance.startupStyleValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getActivity()
|
|
||||||
{
|
|
||||||
return instance.activityValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void consume(List<ConfigItem> pairs)
|
public void consume(List<ConfigItem> pairs)
|
||||||
{
|
{
|
||||||
@@ -64,29 +52,8 @@ public class ConfigGlobals implements IConfigSection
|
|||||||
startupStyleValue = KittyStartupMode.Dev;
|
startupStyleValue = KittyStartupMode.Dev;
|
||||||
|
|
||||||
if(value.equalsIgnoreCase(KittyStartupMode.Release.name()))
|
if(value.equalsIgnoreCase(KittyStartupMode.Release.name()))
|
||||||
{
|
|
||||||
startupStyleValue = KittyStartupMode.Release;
|
startupStyleValue = KittyStartupMode.Release;
|
||||||
}
|
|
||||||
|
|
||||||
if(value.equalsIgnoreCase(KittyStartupMode.PoguRelease.name()))
|
|
||||||
{
|
|
||||||
startupStyleValue = KittyStartupMode.PoguRelease;
|
|
||||||
}
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse text for 'playing'
|
|
||||||
if(key.equalsIgnoreCase(activityKey))
|
|
||||||
{
|
|
||||||
activityValue = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we change any globals, update anything we need to.
|
|
||||||
if(ObjectBuilder.getHasInitialized())
|
|
||||||
{
|
|
||||||
ObjectBuilder.updateActivity();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +62,6 @@ public class ConfigGlobals implements IConfigSection
|
|||||||
{
|
{
|
||||||
List<ConfigItem> items = new ArrayList<ConfigItem>();
|
List<ConfigItem> items = new ArrayList<ConfigItem>();
|
||||||
items.add(new ConfigItem(getSectionTitle(), startupStyleKey, startupStyleValue.name().toLowerCase()));
|
items.add(new ConfigItem(getSectionTitle(), startupStyleKey, startupStyleValue.name().toLowerCase()));
|
||||||
items.add(new ConfigItem(getSectionTitle(), activityKey, activityValue));
|
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,15 +23,15 @@ import dataStructures.KittyRole;
|
|||||||
import dataStructures.KittyStartupMode;
|
import dataStructures.KittyStartupMode;
|
||||||
import dataStructures.KittyUser;
|
import dataStructures.KittyUser;
|
||||||
import main.Main;
|
import main.Main;
|
||||||
import net.dv8tion.jda.api.AccountType;
|
import net.dv8tion.jda.core.AccountType;
|
||||||
import net.dv8tion.jda.api.JDA;
|
import net.dv8tion.jda.core.JDA;
|
||||||
import net.dv8tion.jda.api.JDABuilder;
|
import net.dv8tion.jda.core.JDABuilder;
|
||||||
import net.dv8tion.jda.api.entities.Activity;
|
import net.dv8tion.jda.core.entities.Emote;
|
||||||
import net.dv8tion.jda.api.entities.Emote;
|
import net.dv8tion.jda.core.entities.Game;
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
import net.dv8tion.jda.core.entities.Guild;
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.core.entities.Member;
|
||||||
import net.dv8tion.jda.api.entities.User;
|
import net.dv8tion.jda.core.entities.User;
|
||||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent;
|
||||||
import offline.Ref;
|
import offline.Ref;
|
||||||
import utils.AdminControl;
|
import utils.AdminControl;
|
||||||
//import utils.AudioUtils;
|
//import utils.AudioUtils;
|
||||||
@@ -39,11 +39,11 @@ import utils.GlobalLog;
|
|||||||
import utils.LogFilter;
|
import utils.LogFilter;
|
||||||
import utils.audio.AudioUtils;
|
import utils.audio.AudioUtils;
|
||||||
|
|
||||||
// NOTE: Isolated factory to assist with storage and caching if needed.
|
// NOTE(wisp): Isolated factory to assist with storage and caching if needed.
|
||||||
// This also minimizes the number of places JDA interacts with our codebase.
|
// This also minimizes the number of places JDA interacts with our codebase.
|
||||||
// As it stands, if the object name begins with Kitty, it's constructed here.
|
// As it stands, if the object name begins with Kitty, it's constructed here.
|
||||||
// TODO: Make all methods ID based instead of event based
|
// TODO: Make all methods ID based instead of event based
|
||||||
public class ObjectBuilder
|
public class ObjectBuilderFactory
|
||||||
{
|
{
|
||||||
// Key: guild string id, Value: guild information
|
// Key: guild string id, Value: guild information
|
||||||
private static HashMap<String, KittyGuild> guildCache;
|
private static HashMap<String, KittyGuild> guildCache;
|
||||||
@@ -82,20 +82,15 @@ public class ObjectBuilder
|
|||||||
|
|
||||||
// Lazy initialization multithreaded mutex stuff to prevent explosions.
|
// Lazy initialization multithreaded mutex stuff to prevent explosions.
|
||||||
// TODO: Investigate using 'synchronized' instead potentially
|
// TODO: Investigate using 'synchronized' instead potentially
|
||||||
private static Boolean hasInitialized = false;
|
private static boolean hasInitialized;
|
||||||
private static Semaphore initMutex = new Semaphore(1);
|
private static Semaphore initMutex = new Semaphore(1);
|
||||||
private static JDA kitty;
|
private static JDA kitty;
|
||||||
|
|
||||||
// This is it, this is how the lazy init starts!
|
// This is it, this is how the lazy init starts!
|
||||||
private static void lazyInit()
|
private static void lazyInit()
|
||||||
{
|
{
|
||||||
synchronized(hasInitialized)
|
if(hasInitialized)
|
||||||
{
|
return;
|
||||||
if(hasInitialized)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -114,17 +109,14 @@ public class ObjectBuilder
|
|||||||
AudioSourceManagers.registerLocalSource(playerManager);
|
AudioSourceManagers.registerLocalSource(playerManager);
|
||||||
|
|
||||||
// Start by reading from things that are external. Because
|
// Start by reading from things that are external. Because
|
||||||
// we require these things to be resolved before the rest of
|
// we require these things to be resolved before the rest of the application,
|
||||||
// the application, we place them here.
|
// we place them here.
|
||||||
config = new Config();
|
config = new Config();
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
initMutex.release();
|
initMutex.release();
|
||||||
synchronized(hasInitialized)
|
hasInitialized = true;
|
||||||
{
|
|
||||||
hasInitialized = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(InterruptedException ie)
|
catch(InterruptedException ie)
|
||||||
@@ -134,14 +126,6 @@ public class ObjectBuilder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean getHasInitialized()
|
|
||||||
{
|
|
||||||
synchronized(hasInitialized)
|
|
||||||
{
|
|
||||||
return hasInitialized;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////
|
////////////////////////
|
||||||
// Extraction Methods //
|
// Extraction Methods //
|
||||||
////////////////////////
|
////////////////////////
|
||||||
@@ -205,7 +189,7 @@ public class ObjectBuilder
|
|||||||
// allowed to use the bot at a general level.
|
// allowed to use the bot at a general level.
|
||||||
KittyRole role = KittyRole.General;
|
KittyRole role = KittyRole.General;
|
||||||
|
|
||||||
if(event.getAuthor().getId() == event.getGuild().getOwnerId())
|
if(event.getAuthor().getId() == event.getGuild().getOwner().getUser().getId())
|
||||||
{
|
{
|
||||||
role = KittyRole.Admin;
|
role = KittyRole.Admin;
|
||||||
}
|
}
|
||||||
@@ -405,32 +389,21 @@ public class ObjectBuilder
|
|||||||
|
|
||||||
// Determine token based on config. Default to test token.
|
// Determine token based on config. Default to test token.
|
||||||
String tokenToUse = Ref.TestToken;
|
String tokenToUse = Ref.TestToken;
|
||||||
switch(ConfigGlobals.getStartupMode())
|
if(ConfigGlobals.getStartupMode() == KittyStartupMode.Release)
|
||||||
{
|
tokenToUse = Ref.Token;
|
||||||
case Release: tokenToUse = Ref.Token; break;
|
if(ConfigGlobals.getStartupMode() == KittyStartupMode.PoguRelease)
|
||||||
case PoguRelease: tokenToUse = Ref.PoguToken; break;
|
tokenToUse = Ref.PoguToken;
|
||||||
default: tokenToUse = Ref.TestToken; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Construct bot based on token using the JDA Builder
|
|
||||||
JDABuilder builder = JDABuilder.createDefault(tokenToUse);
|
|
||||||
kitty = builder.build();
|
|
||||||
|
|
||||||
// Set activity, and add primariy event listener.
|
// Construct bot based on token
|
||||||
updateActivity();
|
kitty = new JDABuilder(AccountType.BOT)
|
||||||
|
.setToken(tokenToUse).buildBlocking();
|
||||||
|
kitty.getPresence().setGame(Game.playing("with a laser pointer"));
|
||||||
kitty.addEventListener(new Main());
|
kitty.addEventListener(new Main());
|
||||||
|
|
||||||
return new KittyCore(kitty);
|
return new KittyCore(kitty);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Updates the bots current activity based on the globals value.
|
|
||||||
public static void updateActivity()
|
|
||||||
{
|
|
||||||
String activity = ConfigGlobals.getActivity();
|
|
||||||
GlobalLog.log(LogFilter.Core, "Updating activity to " + activity);
|
|
||||||
kitty.getPresence().setActivity(Activity.playing(activity));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Default construction of the command manager. In order to remotely resolve command enabling
|
// Default construction of the command manager. In order to remotely resolve command enabling
|
||||||
// and disabling, what we do is construct the commands with a localized pair that is checked against
|
// and disabling, what we do is construct the commands with a localized pair that is checked against
|
||||||
// the CommandEnabler object passed in. In theory, we could have multiple CommandManagers, tho we can
|
// the CommandEnabler object passed in. In theory, we could have multiple CommandManagers, tho we can
|
||||||
+2
-2
@@ -107,12 +107,12 @@ public class Stats
|
|||||||
|
|
||||||
public int getGuildCount()
|
public int getGuildCount()
|
||||||
{
|
{
|
||||||
return ObjectBuilder.getGuildCount();
|
return ObjectBuilderFactory.getGuildCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUserCount()
|
public int getUserCount()
|
||||||
{
|
{
|
||||||
return ObjectBuilder.getUserCount();
|
return ObjectBuilderFactory.getUserCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Command> getAllCommands()
|
public ArrayList<Command> getAllCommands()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package dataStructures;
|
package dataStructures;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.JDA;
|
import net.dv8tion.jda.core.JDA;
|
||||||
|
|
||||||
public class KittyCore
|
public class KittyCore
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,12 +3,11 @@ package dataStructures;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.EmbedBuilder;
|
import net.dv8tion.jda.core.JDA;
|
||||||
import net.dv8tion.jda.api.JDA;
|
import net.dv8tion.jda.core.MessageBuilder;
|
||||||
import net.dv8tion.jda.api.MessageBuilder;
|
import net.dv8tion.jda.core.entities.TextChannel;
|
||||||
import net.dv8tion.jda.api.entities.TextChannel;
|
import net.dv8tion.jda.core.events.message.guild.*;
|
||||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
import net.dv8tion.jda.core.EmbedBuilder;
|
||||||
import net.dv8tion.jda.api.utils.AttachmentOption;
|
|
||||||
import utils.GlobalLog;
|
import utils.GlobalLog;
|
||||||
import utils.LogFilter;
|
import utils.LogFilter;
|
||||||
|
|
||||||
@@ -73,14 +72,10 @@ public class Response
|
|||||||
embed.setThumbnail(thumbPath);
|
embed.setThumbnail(thumbPath);
|
||||||
message.setEmbed(embed.build());
|
message.setEmbed(embed.build());
|
||||||
|
|
||||||
GlobalLog.log("We're trying to send a response that has a locally defined thumbnail file...");
|
|
||||||
|
|
||||||
File thumbImage = new File(thumbName);
|
File thumbImage = new File(thumbName);
|
||||||
if(thumbImage.exists())
|
if(thumbImage.exists())
|
||||||
{
|
{
|
||||||
// Used to eb as follows:
|
event.getChannel().sendFile(thumbImage, thumbName, message.build()).queue();
|
||||||
//event.getChannel().sendFile(thumbImage, thumbName, message.build()).queue();
|
|
||||||
event.getChannel().sendMessage(message.build()).queue();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package dataStructures;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import core.ObjectBuilder;
|
import core.ObjectBuilderFactory;
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.core.entities.Member;
|
||||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class UserInput
|
public class UserInput
|
||||||
{
|
{
|
||||||
@@ -93,7 +93,7 @@ public class UserInput
|
|||||||
KittyUser [] KittyMentions = new KittyUser[JDAMentions.size()];
|
KittyUser [] KittyMentions = new KittyUser[JDAMentions.size()];
|
||||||
for(int i = 0; i < KittyMentions.length; i ++)
|
for(int i = 0; i < KittyMentions.length; i ++)
|
||||||
{
|
{
|
||||||
KittyMentions [i] = ObjectBuilder.getKittyUser(event.getGuild().getId(), JDAMentions.get(i).getUser().getId());
|
KittyMentions [i] = ObjectBuilderFactory.getKittyUser(event.getGuild().getId(), JDAMentions.get(i).getUser().getId());
|
||||||
}
|
}
|
||||||
return KittyMentions;
|
return KittyMentions;
|
||||||
}
|
}
|
||||||
|
|||||||
+33
-12
@@ -1,14 +1,26 @@
|
|||||||
package main;
|
package main;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.security.auth.login.LoginException;
|
import javax.security.auth.login.LoginException;
|
||||||
|
|
||||||
|
import com.sedmelluq.discord.lavaplayer.player.AudioLoadResultHandler;
|
||||||
|
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
|
||||||
|
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager;
|
||||||
|
import com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager;
|
||||||
|
import com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers;
|
||||||
|
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException;
|
||||||
|
import com.sedmelluq.discord.lavaplayer.track.AudioPlaylist;
|
||||||
|
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||||
|
import com.sedmelluq.discord.lavaplayer.track.playback.AudioFrame;
|
||||||
|
|
||||||
import core.CharacterManager;
|
import core.CharacterManager;
|
||||||
import core.CommandEnabler;
|
import core.CommandEnabler;
|
||||||
import core.CommandManager;
|
import core.CommandManager;
|
||||||
import core.DatabaseManager;
|
import core.DatabaseManager;
|
||||||
import core.ObjectBuilder;
|
import core.ObjectBuilderFactory;
|
||||||
import core.RPManager;
|
import core.RPManager;
|
||||||
import core.Stats;
|
import core.Stats;
|
||||||
import core.lua.PluginManager;
|
import core.lua.PluginManager;
|
||||||
@@ -18,8 +30,17 @@ import dataStructures.KittyGuild;
|
|||||||
import dataStructures.KittyUser;
|
import dataStructures.KittyUser;
|
||||||
import dataStructures.Response;
|
import dataStructures.Response;
|
||||||
import dataStructures.UserInput;
|
import dataStructures.UserInput;
|
||||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
import net.dv8tion.jda.core.AccountType;
|
||||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
import net.dv8tion.jda.core.JDA;
|
||||||
|
import net.dv8tion.jda.core.JDABuilder;
|
||||||
|
import net.dv8tion.jda.core.audio.AudioSendHandler;
|
||||||
|
import net.dv8tion.jda.core.entities.Guild;
|
||||||
|
import net.dv8tion.jda.core.entities.TextChannel;
|
||||||
|
import net.dv8tion.jda.core.entities.VoiceChannel;
|
||||||
|
import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
import net.dv8tion.jda.core.hooks.ListenerAdapter;
|
||||||
|
import net.dv8tion.jda.core.managers.AudioManager;
|
||||||
|
import offline.Ref;
|
||||||
import utils.GlobalLog;
|
import utils.GlobalLog;
|
||||||
|
|
||||||
// http://www.slf4j.org/ - this JDA logging tool has been disabled by specifying NOP implementation.
|
// http://www.slf4j.org/ - this JDA logging tool has been disabled by specifying NOP implementation.
|
||||||
@@ -43,15 +64,15 @@ public class Main extends ListenerAdapter
|
|||||||
{
|
{
|
||||||
// Factory startup. The ordering is intentional.
|
// Factory startup. The ordering is intentional.
|
||||||
GlobalLog.initialize();
|
GlobalLog.initialize();
|
||||||
databaseManager = ObjectBuilder.constructDatabaseManager();
|
databaseManager = ObjectBuilderFactory.constructDatabaseManager();
|
||||||
commandManager = ObjectBuilder.constructCommandManager(CommandEnabler.instance); // TODO: Untangle this singleton
|
commandManager = ObjectBuilderFactory.constructCommandManager(CommandEnabler.instance); // TODO: Untangle this singleton
|
||||||
stats = ObjectBuilder.constructStats(commandManager);
|
stats = ObjectBuilderFactory.constructStats(commandManager);
|
||||||
charManager = new CharacterManager();
|
charManager = new CharacterManager();
|
||||||
rpManager = ObjectBuilder.constructRPManager();
|
rpManager = ObjectBuilderFactory.constructRPManager();
|
||||||
pluginManager = ObjectBuilder.constructPluginManager();
|
pluginManager = ObjectBuilderFactory.constructPluginManager();
|
||||||
|
|
||||||
// Bot startup
|
// Bot startup
|
||||||
kittyCore = ObjectBuilder.constructKittyCore();
|
kittyCore = ObjectBuilderFactory.constructKittyCore();
|
||||||
}
|
}
|
||||||
|
|
||||||
// When a message is sent in a server that kitty is in, this is what's called.
|
// When a message is sent in a server that kitty is in, this is what's called.
|
||||||
@@ -63,9 +84,9 @@ public class Main extends ListenerAdapter
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Factory objects
|
// Factory objects
|
||||||
KittyUser user = ObjectBuilder.extractUser(event);
|
KittyUser user = ObjectBuilderFactory.extractUser(event);
|
||||||
KittyGuild guild = ObjectBuilder.extractGuild(event);
|
KittyGuild guild = ObjectBuilderFactory.extractGuild(event);
|
||||||
KittyChannel channel = ObjectBuilder.extractChannel(event);
|
KittyChannel channel = ObjectBuilderFactory.extractChannel(event);
|
||||||
|
|
||||||
// Specialized uncached objects
|
// Specialized uncached objects
|
||||||
Response response = new Response(event, kittyCore);
|
Response response = new Response(event, kittyCore);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import dataStructures.KittyRole;
|
|||||||
import dataStructures.KittyUser;
|
import dataStructures.KittyUser;
|
||||||
import dataStructures.Response;
|
import dataStructures.Response;
|
||||||
import dataStructures.UserInput;
|
import dataStructures.UserInput;
|
||||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent;
|
||||||
import offline.Ref;
|
import offline.Ref;
|
||||||
|
|
||||||
// Manages the fiddly bits and upkeep of the bot - while not
|
// Manages the fiddly bits and upkeep of the bot - while not
|
||||||
|
|||||||
@@ -1,30 +1,24 @@
|
|||||||
package utils;
|
package utils;
|
||||||
|
|
||||||
import java.util.*;
|
import net.dv8tion.jda.core.entities.Guild;
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
import net.dv8tion.jda.core.managers.GuildController;
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
|
||||||
import net.dv8tion.jda.api.entities.Role;
|
|
||||||
import net.dv8tion.jda.internal.handle.GuildSetupController;
|
|
||||||
|
|
||||||
public class AdminControl
|
public class AdminControl
|
||||||
{
|
{
|
||||||
|
private GuildController guildCon;
|
||||||
private Guild guild;
|
private Guild guild;
|
||||||
|
|
||||||
public AdminControl(Guild guild)
|
public AdminControl(Guild guild)
|
||||||
{
|
{
|
||||||
this.guild = guild;
|
this.guild = guild;
|
||||||
|
guildCon = guild.getController();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean addRole(String memberID, String roleName)
|
public boolean addRole(String memberID, String roleName)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Member member = guild.getMemberById(memberID);
|
guildCon.addRolesToMember(guild.getMemberById(memberID), guild.getRolesByName(roleName, true)).complete();
|
||||||
List<Role> roles = guild.getRolesByName(roleName, true);
|
|
||||||
for(Role role : roles)
|
|
||||||
{
|
|
||||||
guild.addRoleToMember(member, role).complete();// submit instead? We need to queue.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
@@ -37,12 +31,7 @@ public class AdminControl
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Member member = guild.getMemberById(memberID);
|
guildCon.removeRolesFromMember(guild.getMemberById(memberID), guild.getRolesByName(roleName, true)).complete();
|
||||||
List<Role> roles = guild.getRolesByName(roleName, true);
|
|
||||||
for(Role role : roles)
|
|
||||||
{
|
|
||||||
guild.removeRoleFromMember(member, role).complete();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
@@ -55,7 +44,7 @@ public class AdminControl
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
guild.kick(guild.getMemberById(memberID)).complete();
|
guildCon.kick(guild.getMemberById(memberID)).complete();
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
@@ -68,7 +57,7 @@ public class AdminControl
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
guild.mute(guild.getMemberById(memberID), true);
|
guildCon.setMute(guild.getMemberById(memberID), true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
@@ -81,7 +70,7 @@ public class AdminControl
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
guild.ban(guild.getMemberById(memberID), 0).complete();
|
guildCon.ban(guild.getMemberById(memberID), 0).complete();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
|
|||||||
@@ -36,13 +36,11 @@ public class GlobalLog
|
|||||||
System.out.println(logLine);
|
System.out.println(logLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void log(LogFilter filter, Object obj) { write(log, filter, obj.toString()); }
|
|
||||||
public static void log(LogFilter filter, String msg) { write(log, filter, msg); }
|
public static void log(LogFilter filter, String msg) { write(log, filter, msg); }
|
||||||
public static void warn(LogFilter filter, String msg) { write(warn, filter, msg); }
|
public static void warn(LogFilter filter, String msg) { write(warn, filter, msg); }
|
||||||
public static void error(LogFilter filter, String msg) { write(error, filter, msg); System.err.println(msg); System.err.flush(); }
|
public static void error(LogFilter filter, String msg) { write(error, filter, msg); System.err.println(msg); System.err.flush(); }
|
||||||
public static void fatal(LogFilter filter, String msg) throws Exception { write(fatal, filter, msg); throw new Exception(msg); }
|
public static void fatal(LogFilter filter, String msg) throws Exception { write(fatal, filter, msg); throw new Exception(msg); }
|
||||||
|
|
||||||
public static void log(Object obj) { log(LogFilter.Debug, obj); }
|
|
||||||
public static void log(String msg) { log(LogFilter.Debug, msg); }
|
public static void log(String msg) { log(LogFilter.Debug, msg); }
|
||||||
public static void warn(String msg) { warn(LogFilter.Debug, msg); }
|
public static void warn(String msg) { warn(LogFilter.Debug, msg); }
|
||||||
public static void error(String msg) { error(LogFilter.Debug, msg); }
|
public static void error(String msg) { error(LogFilter.Debug, msg); }
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
package utils.audio;
|
package utils.audio;
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import com.sedmelluq.discord.lavaplayer.player.AudioLoadResultHandler;
|
import com.sedmelluq.discord.lavaplayer.player.AudioLoadResultHandler;
|
||||||
@@ -10,11 +9,10 @@ import com.sedmelluq.discord.lavaplayer.track.AudioPlaylist;
|
|||||||
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||||
import com.sedmelluq.discord.lavaplayer.track.playback.AudioFrame;
|
import com.sedmelluq.discord.lavaplayer.track.playback.AudioFrame;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.audio.AudioSendHandler;
|
import net.dv8tion.jda.core.audio.AudioSendHandler;
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
import net.dv8tion.jda.core.entities.Guild;
|
||||||
import net.dv8tion.jda.api.entities.VoiceChannel;
|
import net.dv8tion.jda.core.entities.VoiceChannel;
|
||||||
import net.dv8tion.jda.api.managers.AudioManager;
|
import net.dv8tion.jda.core.managers.AudioManager;
|
||||||
|
|
||||||
|
|
||||||
public class AudioUtils
|
public class AudioUtils
|
||||||
{
|
{
|
||||||
@@ -74,11 +72,9 @@ public class AudioUtils
|
|||||||
return lastFrame != null;
|
return lastFrame != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public byte[] provide20MsAudio()
|
||||||
public ByteBuffer provide20MsAudio()
|
|
||||||
{
|
{
|
||||||
ByteBuffer outputBuffer = ByteBuffer.wrap(lastFrame.getData());
|
return lastFrame.getData();
|
||||||
return outputBuffer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean isOpus()
|
@Override public boolean isOpus()
|
||||||
|
|||||||
Reference in New Issue
Block a user