Add option to disable logging creation
This commit is contained in:
parent
b725d9b662
commit
037d333f32
10
index.js
10
index.js
|
@ -72,6 +72,12 @@ client.on('ready', async () => {
|
|||
description: "The channel to log invites to",
|
||||
type: 7,
|
||||
required: true
|
||||
},
|
||||
{
|
||||
name: "log_create",
|
||||
description: "Log invite creation",
|
||||
type: 5,
|
||||
required: false
|
||||
}
|
||||
],
|
||||
default_member_permissions: 32
|
||||
|
@ -100,6 +106,7 @@ client.on('inviteCreate', (invite) => { //if someone creates an invite while bot
|
|||
return;
|
||||
}
|
||||
if (!row) return;
|
||||
if(!row.log_create) return;
|
||||
client.channels.fetch(row.channel).then(channel => {
|
||||
if (!channel) return; // They probably set perms wrong
|
||||
channel.send({
|
||||
|
@ -243,8 +250,9 @@ client.on('interactionCreate', async interaction => {
|
|||
});
|
||||
return;
|
||||
}
|
||||
const log_create = interaction.options.getBoolean('log_create') || true;
|
||||
const channel = interaction.options.getChannel('channel').id;
|
||||
db.run(`INSERT OR REPLACE INTO guilds (id, channel) VALUES (?, ?)`, [interaction.guild.id.toString(), channel.toString()], (err) => {
|
||||
db.run(`INSERT OR REPLACE INTO guilds (id, channel, log_create) VALUES (?, ?, ?)`, [interaction.guild.id.toString(), channel.toString(), log_create], (err) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
interaction.reply({
|
||||
|
|
1
migrations/2.sql
Normal file
1
migrations/2.sql
Normal file
|
@ -0,0 +1 @@
|
|||
ALTER TABLE guilds ADD COLUMN log_create BOOLEAN DEFAULT 1;
|
Loading…
Reference in a new issue