[DB] Merge getGuildSettings & putGuild into GetOrCreateSettings (#9)

This commit is contained in:
2026-08-19 08:44:26 -07:00
committed by GitHub
parent 9c91e18962
commit cb2348f89c
23 changed files with 74 additions and 130 deletions
+2 -4
View File
@@ -15,10 +15,8 @@ export default {
const guild = await client.guilds.fetch(interaction.guildId!);
const guildSettings = await Database.getGuildSettings(guild.id);
if (!guildSettings || !guildSettings.private_help_role_id)
return interaction.reply({ flags: [MessageFlags.Ephemeral], content: 'Failed to claim ticket.' });
const settings = await Database.getOrCreateSettings(guild.id);
if (!settings.private_help_role_id) return interaction.reply({ flags: [MessageFlags.Ephemeral], content: 'Failed to claim ticket.' });
const closeButton = new ButtonBuilder()
.setCustomId('close-ticket')
+3 -2
View File
@@ -7,8 +7,9 @@ export default {
try {
if (!interaction.guild) throw new Error('This action must be run in a guild.');
const settings = await Database.getGuildSettings(interaction.guild.id);
if (!settings || !settings.devwatch_role_id) throw new Error('`devwatch_role_id` was not configured. Please configure a role then try again.');
const settings = await Database.getOrCreateSettings(interaction.guild.id);
if (!settings.devwatch_role_id) throw new Error('`devwatch_role_id` was not configured. Please configure a role then try again.');
const member = await interaction.guild.members.fetch(interaction.user.id);
if (!member) throw new Error('Unable to retreive the member executing this command.');
+2 -4
View File
@@ -17,10 +17,8 @@ export default {
const guild = await client.guilds.fetch(interaction.guildId!);
const guildSettings = await Database.getGuildSettings(guild.id);
if (!guildSettings || !guildSettings.private_help_role_id)
return interaction.reply({ flags: [MessageFlags.Ephemeral], content: 'Failed to unclaim ticket.' });
const settings = await Database.getOrCreateSettings(guild.id);
if (!settings.private_help_role_id) return interaction.reply({ flags: [MessageFlags.Ephemeral], content: 'Failed to unclaim ticket.' });
const closeButton = new ButtonBuilder()
.setCustomId('close-ticket')