forked from Supositware/Haha-Yes
Fixing quotation and autoresponses
This commit is contained in:
parent
ac93981fd6
commit
458e913ad0
2 changed files with 22 additions and 6 deletions
|
@ -9,13 +9,14 @@ export default {
|
||||||
category: 'admin',
|
category: 'admin',
|
||||||
async execute(interaction, args, client) {
|
async execute(interaction, args, client) {
|
||||||
const autoresponseStat = await db.autoresponseStat.findOne({ where: { serverID: interaction.guild.id } });
|
const autoresponseStat = await db.autoresponseStat.findOne({ where: { serverID: interaction.guild.id } });
|
||||||
|
console.log(autoresponseStat);
|
||||||
if (autoresponseStat.stat !== 'enable') {
|
if (!autoresponseStat) {
|
||||||
const body = { serverID: interaction.guild.id, stat: 'enable' };
|
const body = { serverID: interaction.guild.id, stat: 'enable' };
|
||||||
await db.autoresponseStat.create(body);
|
await db.autoresponseStat.create(body);
|
||||||
return await interaction.reply({ content: 'Autoresponse has been enabled.', ephemeral: true });
|
return await interaction.reply({ content: 'Autoresponse has been enabled.', ephemeral: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const row = new ActionRowBuilder()
|
const row = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
|
@ -30,7 +31,14 @@ export default {
|
||||||
.setStyle(ButtonStyle.Danger),
|
.setStyle(ButtonStyle.Danger),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (autoresponseStat.stat === 'enable') {
|
||||||
await interaction.reply({ content: 'Autoresponse is already enabled, do you wish to disable it?', components: [row], ephemeral: true });
|
await interaction.reply({ content: 'Autoresponse is already enabled, do you wish to disable it?', components: [row], ephemeral: true });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const body = { serverID: interaction.guild.id, stat: 'enable' };
|
||||||
|
await db.autoresponseStat.update(body, { where: { serverID: interaction.guild.id } });
|
||||||
|
return interaction.editReply({ content: 'Auto response has been enabled.', ephemeral: true });
|
||||||
|
}
|
||||||
|
|
||||||
client.on('interactionCreate', async (interactionMenu) => {
|
client.on('interactionCreate', async (interactionMenu) => {
|
||||||
if (interaction.user !== interactionMenu.user) return;
|
if (interaction.user !== interactionMenu.user) return;
|
||||||
|
|
|
@ -10,12 +10,13 @@ export default {
|
||||||
async execute(interaction, args, client) {
|
async execute(interaction, args, client) {
|
||||||
const quotationstat = await db.quotationStat.findOne({ where: { serverID: interaction.guild.id } });
|
const quotationstat = await db.quotationStat.findOne({ where: { serverID: interaction.guild.id } });
|
||||||
|
|
||||||
if (quotationstat.stat !== 'enable') {
|
if (!quotationstat) {
|
||||||
const body = { serverID: interaction.guild.id, stat: 'enable' };
|
const body = { serverID: interaction.guild.id, stat: 'enable' };
|
||||||
await db.quotationStat.create(body);
|
await db.quotationStat.create(body);
|
||||||
return await interaction.reply({ content: 'Quotation has been enabled.', ephemeral: true });
|
return await interaction.reply({ content: 'Quotation has been enabled.', ephemeral: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const row = new ActionRowBuilder()
|
const row = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
|
@ -30,7 +31,14 @@ export default {
|
||||||
.setStyle(ButtonStyle.Danger),
|
.setStyle(ButtonStyle.Danger),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (quotationstat.stat === 'enable') {
|
||||||
await interaction.reply({ content: 'Quotation is already enabled, do you wish to disable it?', components: [row], ephemeral: true });
|
await interaction.reply({ content: 'Quotation is already enabled, do you wish to disable it?', components: [row], ephemeral: true });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const body = { serverID: interaction.guild.id, stat: 'enable' };
|
||||||
|
await db.autoresponseStat.update(body, { where: { serverID: interaction.guild.id } });
|
||||||
|
return interaction.editReply({ content: 'Quotation has been enabled.', ephemeral: true });
|
||||||
|
}
|
||||||
|
|
||||||
client.on('interactionCreate', async (interactionMenu) => {
|
client.on('interactionCreate', async (interactionMenu) => {
|
||||||
if (interaction.user !== interactionMenu.user) return;
|
if (interaction.user !== interactionMenu.user) return;
|
||||||
|
|
Loading…
Reference in a new issue