From b4a2889e4efb181502e181a4ab10f640fcde88da Mon Sep 17 00:00:00 2001 From: Greazi-Times Date: Mon, 29 Apr 2024 21:40:38 +0200 Subject: [PATCH] Stach fix --- settings.yaml | 100 ++++++++++++++++++ .../command/SimpleCommand.java | 2 +- .../command/SlashCommandHandler.java | 1 + .../{ => mysql}/objects/ChannelQuery.java | 2 +- .../{ => mysql}/objects/Cooldown.java | 2 +- .../{ => mysql}/objects/DefinedQuery.java | 2 +- .../{ => mysql}/objects/Query.java | 2 +- .../{ => mysql}/objects/Requirement.java | 2 +- 8 files changed, 107 insertions(+), 6 deletions(-) create mode 100644 settings.yaml rename src/main/java/com/greazi/discordbotfoundation/{ => mysql}/objects/ChannelQuery.java (93%) rename src/main/java/com/greazi/discordbotfoundation/{ => mysql}/objects/Cooldown.java (90%) rename src/main/java/com/greazi/discordbotfoundation/{ => mysql}/objects/DefinedQuery.java (85%) rename src/main/java/com/greazi/discordbotfoundation/{ => mysql}/objects/Query.java (96%) rename src/main/java/com/greazi/discordbotfoundation/{ => mysql}/objects/Requirement.java (93%) diff --git a/settings.yaml b/settings.yaml new file mode 100644 index 0000000..ae6c674 --- /dev/null +++ b/settings.yaml @@ -0,0 +1,100 @@ +# !-----------------------------------------------------------------------------------------------! +# Welcome to the main configuration of the foundation system +# +# This file contains all the main settings of the discord bot in here +# !-----------------------------------------------------------------------------------------------! +# **NOTE: This file is here to show the default methods that need to be inside the bot at all times!** +# ------------------------------------------------------------------------------------------------- +# The essential setting for the bot. +# **IMPORTANT** these settings need to be configured! +# ------------------------------------------------------------------------------------------------- +Bot: + + # The token for the bot + # A token can be made inside the discors applications portal + # https://discord.com/developers/applications + Token: "0000000000000000000000000000000000000000" + + # The main guild of the bot + MainGuild: "000000000000000000" + + # The name of your bot + Name: "DiscordBot" + +# ------------------------------------------------------------------------------------------------- +# Manage the activity of the bot +# !!This system is still in BETA!! +# ------------------------------------------------------------------------------------------------- +Activity: + + # **IMPORTANT** THIS FEATURE IS NOT WORKING AT THIS MOMENT + # The type of the activity + # Possible options: PLAYING, STREAMING, LISTENING and WATCHING + Type: "WATCHING" + + # The message after the activity type + Message: "Foundation" + +Developer: + + # The name of the developer of the bot + Name: "Greazi" + + # The website of the developer of the bot + Website: "https://greazi.com" + + # The image of the developer of the bot + Image: "https://www.greazi.com/wp-content/uploads/2021/08/cropped-bannerempty.png" + +Embed: + Link: "https://greazi.com" + Footer: "Copyright ©Greazi" + Image: + Author: "https://www.greazi.com/wp-content/uploads/2021/08/cropped-bannerempty.png" + Footer: "https://www.greazi.com/wp-content/uploads/2021/08/cropped-bannerempty.png" + +Commands: + Stop: + Enabled: true + AllowedRoles: + - owner + +# ------------------------------------------------------------------------------------------------- +# Manage the console of the bot +# ------------------------------------------------------------------------------------------------- +Console: + + # Log all the messages in the console + LogConsole: true + + Commands: + # Should console commands be enabled? + Enabled: true + + # Commands that are disabled + Disabled: [ ] + +# ------------------------------------------------------------------------------------------------- +# Configure the database settings here +# ------------------------------------------------------------------------------------------------- +Database: + + # Should we store all the data on the database + Enabled: false + + # Select your type of database [H2, MySQL, MariaDB, SQLite, SQLSERVER, SQLITE] + Type: "MariaDB" + + # The database information + Host: "localhost" + Port: 3306 + Database: "Foundation" + Username: "Foundation_User" + Password: "Foundation_Password" + +# ------------------------------------------------------------------------------------------------- +# List of section names that will print informative messages about their features. +# If you have issues, try enabling either of these sections to self-diagnose: +# [Startup, Database, SlashCommandHandler] +# ------------------------------------------------------------------------------------------------- +Debug: [ ] diff --git a/src/main/java/com/greazi/discordbotfoundation/command/SimpleCommand.java b/src/main/java/com/greazi/discordbotfoundation/command/SimpleCommand.java index a8d4e1c..bd7730f 100644 --- a/src/main/java/com/greazi/discordbotfoundation/command/SimpleCommand.java +++ b/src/main/java/com/greazi/discordbotfoundation/command/SimpleCommand.java @@ -486,7 +486,7 @@ protected final void replyEmbed(final SimpleEmbedBuilder embed, final boolean ep try { getEvent().replyEmbeds(embed.build()).setEphemeral(ephemeral).queue(); - } finally { + } catch (final Exception ex) { getChannel().sendMessageEmbeds(embed.build()).queue(); } } diff --git a/src/main/java/com/greazi/discordbotfoundation/command/SlashCommandHandler.java b/src/main/java/com/greazi/discordbotfoundation/command/SlashCommandHandler.java index 80a2255..11cfaa7 100644 --- a/src/main/java/com/greazi/discordbotfoundation/command/SlashCommandHandler.java +++ b/src/main/java/com/greazi/discordbotfoundation/command/SlashCommandHandler.java @@ -30,6 +30,7 @@ public SlashCommandHandler() { public void onSlashCommandInteraction(@NotNull final SlashCommandInteractionEvent event) { Common.log("Slash command interaction received: " + event.getName()); final String commandName = event.getName(); + final SimpleCommand simpleCommand = commandList.get(commandName); if (simpleCommand == null) { diff --git a/src/main/java/com/greazi/discordbotfoundation/objects/ChannelQuery.java b/src/main/java/com/greazi/discordbotfoundation/mysql/objects/ChannelQuery.java similarity index 93% rename from src/main/java/com/greazi/discordbotfoundation/objects/ChannelQuery.java rename to src/main/java/com/greazi/discordbotfoundation/mysql/objects/ChannelQuery.java index e4a6fdb..a1282e8 100644 --- a/src/main/java/com/greazi/discordbotfoundation/objects/ChannelQuery.java +++ b/src/main/java/com/greazi/discordbotfoundation/mysql/objects/ChannelQuery.java @@ -1,4 +1,4 @@ -package com.greazi.discordbotfoundation.objects; +package com.greazi.discordbotfoundation.mysql.objects; import net.dv8tion.jda.api.entities.channel.concrete.Category; import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; diff --git a/src/main/java/com/greazi/discordbotfoundation/objects/Cooldown.java b/src/main/java/com/greazi/discordbotfoundation/mysql/objects/Cooldown.java similarity index 90% rename from src/main/java/com/greazi/discordbotfoundation/objects/Cooldown.java rename to src/main/java/com/greazi/discordbotfoundation/mysql/objects/Cooldown.java index 60248d0..55d8fdd 100644 --- a/src/main/java/com/greazi/discordbotfoundation/objects/Cooldown.java +++ b/src/main/java/com/greazi/discordbotfoundation/mysql/objects/Cooldown.java @@ -1,4 +1,4 @@ -package com.greazi.discordbotfoundation.objects; +package com.greazi.discordbotfoundation.mysql.objects; import java.time.OffsetDateTime; import java.time.temporal.ChronoUnit; diff --git a/src/main/java/com/greazi/discordbotfoundation/objects/DefinedQuery.java b/src/main/java/com/greazi/discordbotfoundation/mysql/objects/DefinedQuery.java similarity index 85% rename from src/main/java/com/greazi/discordbotfoundation/objects/DefinedQuery.java rename to src/main/java/com/greazi/discordbotfoundation/mysql/objects/DefinedQuery.java index 5853575..4c3aed7 100644 --- a/src/main/java/com/greazi/discordbotfoundation/objects/DefinedQuery.java +++ b/src/main/java/com/greazi/discordbotfoundation/mysql/objects/DefinedQuery.java @@ -1,4 +1,4 @@ -package com.greazi.discordbotfoundation.objects; +package com.greazi.discordbotfoundation.mysql.objects; public abstract class DefinedQuery { diff --git a/src/main/java/com/greazi/discordbotfoundation/objects/Query.java b/src/main/java/com/greazi/discordbotfoundation/mysql/objects/Query.java similarity index 96% rename from src/main/java/com/greazi/discordbotfoundation/objects/Query.java rename to src/main/java/com/greazi/discordbotfoundation/mysql/objects/Query.java index 98ddc40..d263b5f 100644 --- a/src/main/java/com/greazi/discordbotfoundation/objects/Query.java +++ b/src/main/java/com/greazi/discordbotfoundation/mysql/objects/Query.java @@ -1,4 +1,4 @@ -package com.greazi.discordbotfoundation.objects; +package com.greazi.discordbotfoundation.mysql.objects; import java.util.Arrays; import java.util.List; diff --git a/src/main/java/com/greazi/discordbotfoundation/objects/Requirement.java b/src/main/java/com/greazi/discordbotfoundation/mysql/objects/Requirement.java similarity index 93% rename from src/main/java/com/greazi/discordbotfoundation/objects/Requirement.java rename to src/main/java/com/greazi/discordbotfoundation/mysql/objects/Requirement.java index 84ec529..966489c 100644 --- a/src/main/java/com/greazi/discordbotfoundation/objects/Requirement.java +++ b/src/main/java/com/greazi/discordbotfoundation/mysql/objects/Requirement.java @@ -1,4 +1,4 @@ -package com.greazi.discordbotfoundation.objects; +package com.greazi.discordbotfoundation.mysql.objects; import java.util.Objects;