Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FLR 17 - Start work on Amiguito #182

Merged
merged 2 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .gradle/8.5/checksums/checksums.lock
Binary file not shown.
Binary file modified .gradle/8.5/checksums/sha1-checksums.bin
Binary file not shown.
Binary file modified .gradle/8.5/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/8.5/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
1 change: 0 additions & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 22 additions & 38 deletions .idea/resourceBundles.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified build/classes/java/main/org/json/Cookie.class
Binary file not shown.
Binary file modified build/classes/java/main/org/json/JSONPointer.class
Binary file not shown.
Binary file modified build/classes/java/main/org/json/JSONTokener.class
Binary file not shown.
Binary file modified build/classes/java/main/org/json/JSONWriter.class
Binary file not shown.
Binary file modified build/classes/java/main/org/json/XML$1$1.class
Binary file not shown.
Binary file modified build/classes/java/main/org/json/XML$1.class
Binary file not shown.
Binary file modified build/classes/java/main/org/json/XML.class
Binary file not shown.
Binary file modified build/classes/java/main/org/json/XMLTokener.class
Binary file not shown.
Binary file modified build/tmp/compileJava/previous-compilation-data.bin
Binary file not shown.
13 changes: 9 additions & 4 deletions src/main/java/com/severalcircles/flames/Flames.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

package com.severalcircles.flames;

import com.severalcircles.flames.amiguito.AmiguitoDataManager;
import com.severalcircles.flames.amiguito.frontend.AmiguitoNewCommand;
import com.severalcircles.flames.conversations.Conversation;
import com.severalcircles.flames.data.FlamesDataManager;
import com.severalcircles.flames.data.global.GlobalData;
Expand All @@ -27,6 +29,7 @@
import net.dv8tion.jda.api.interactions.commands.OptionType;
import net.dv8tion.jda.api.interactions.commands.build.CommandData;
import net.dv8tion.jda.api.interactions.commands.build.Commands;
import net.dv8tion.jda.api.interactions.commands.build.SubcommandData;
import net.dv8tion.jda.api.requests.GatewayIntent;

import java.io.File;
Expand Down Expand Up @@ -84,12 +87,10 @@ public static void main(String[] args) throws IOException {
Locale.setDefault(Locale.ENGLISH);
properties.load(is);
version = properties.getProperty("version");
if (args.length > 0) runningDebug = args[0].equals("--debug");
if (runningDebug) Logger.getGlobal().info("Running in debugging mode.");
FlamesDataManager.prepare();
reportHeader = String.format(reportHeader, version);
String logName = "Flames " + version + "@" + InetAddress.getLocalHost().getHostName() + " " + Instant.now().truncatedTo(ChronoUnit.SECONDS).toString().replace(":", " ").replace("T", " T") + ".log";
File logDir = new File(FlamesDataManager.flamesDirectory.getAbsolutePath() + "/logs");
File logDir = new File(FlamesDataManager.FLAMES_DIRECTORY.getAbsolutePath() + "/logs");
//noinspection ResultOfMethodCallIgnored
logDir.mkdir();
File logFile = new File(logDir.getAbsolutePath() + "/" + logName);
Expand Down Expand Up @@ -123,6 +124,7 @@ public static void main(String[] args) throws IOException {
} catch (InterruptedException e) {
e.printStackTrace();
}
AmiguitoDataManager.prepare();
// --- Events ---
new CommandEvent().register(api);
new MessageEvent().register(api);
Expand Down Expand Up @@ -156,6 +158,9 @@ public static void main(String[] args) throws IOException {
commandDataList.add(Commands.slash("about", "Who cooked here?"));
commandMap.put("spark", new SparkCommand());
commandDataList.add(Commands.slash("spark", "Start a Spark conversation").addOption(OptionType.STRING, "question", "The question you want to ask", true).addOption(OptionType.INTEGER, "minutes", "Time limit for the conversation in minutes.", true));
commandMap.put("amiguito", new AmiguitoNewCommand());
commandDataList.add(Commands.slash("amiguito", "Interact with your Amiguito character").addOption(OptionType.STRING, "name", "The name of your Amiguito", true));

// Commands.context(Command.Type.MESSAGE, "SparkVote");
api.updateCommands()
.addCommands(commandDataList).
Expand All @@ -172,7 +177,7 @@ public static void incrementErrorCount() {
fatalErrorCounter++;
if (fatalErrorCounter > 10) {
Logger.getGlobal().log(Level.SEVERE, "Flames has detected a recurring fatal problem. To protect Flames' data, it will now exit. There may be stack traces above with more information.");
File file = new File(FlamesDataManager.flamesDirectory.getAbsolutePath() + "/logs/Flames FatalReport:" + Instant.now().toString() + ".log");
File file = new File(FlamesDataManager.FLAMES_DIRECTORY.getAbsolutePath() + "/logs/Flames FatalReport:" + Instant.now().toString() + ".log");
try {
//noinspection ResultOfMethodCallIgnored
file.createNewFile();
Expand Down
Loading
Loading