Skip to content

Commit

Permalink
feat(logs): add reset button
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperchupuDev committed Sep 26, 2021
1 parent 7312b85 commit 339a94f
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 2 deletions.
20 changes: 19 additions & 1 deletion commands/bot/logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@ module.exports = {
title: 'Loqs',
description: logs ? `The current loqs channel is ${logs}` : 'You don\'t have a loqs channel set up!',
color: client.config.color
}]
}],
components: logs ? [{
type: 'ACTION_ROW',
components: [{
type: 'BUTTON',
style: 'SECONDARY',
label: 'Reset',
customId: `loqs::${message.author.id}`
}]
}] : null
});
}

Expand All @@ -28,6 +37,15 @@ module.exports = {
title: 'Loqs',
description: `The loqs channel is now ${channel}`,
color: client.config.color
}],
components: [{
type: 'ACTION_ROW',
components: [{
type: 'BUTTON',
style: 'SECONDARY',
label: 'Reset',
customId: `loqs::${message.author.id}`
}]
}]
});
}
Expand Down
20 changes: 19 additions & 1 deletion interactions/commands/logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@ module.exports = {
title: 'Loqs',
description: logs ? `The current loqs channel is ${logs}` : 'You don\'t have a loqs channel set up!',
color: client.config.color
}]
}],
components: logs ? [{
type: 'ACTION_ROW',
components: [{
type: 'BUTTON',
style: 'SECONDARY',
label: 'Reset',
customId: `loqs::${interaction.user.id}`
}]
}] : null
});
}

Expand All @@ -24,6 +33,15 @@ module.exports = {
title: 'Loqs',
description: `The loqs channel is now ${channel}`,
color: client.config.color
}],
components: [{
type: 'ACTION_ROW',
components: [{
type: 'BUTTON',
style: 'SECONDARY',
label: 'Reset',
customId: `loqs::${interaction.user.id}`
}]
}]
});
}
Expand Down
24 changes: 24 additions & 0 deletions interactions/components/logs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
name: 'loqs',
permissions: ['MANAGE_CHANNELS'],
async execute(client, interaction) {
client.db.prepare('UPDATE guilds SET logs = @logs WHERE id = @id').run({ id: interaction.guildId, logs: null });
interaction.update({
embeds: [{
title: 'Loqs',
description: 'The loqs channel was reset',
color: client.config.color
}],
components: [{
type: 'ACTION_ROW',
components: [{
type: 'BUTTON',
style: 'SECONDARY',
label: 'Reset',
customId: `loqs::${interaction.user.id}`,
disabled: true
}]
}]
});
}
};

0 comments on commit 339a94f

Please sign in to comment.