From 037d333f32a94fea20ef50694ddb8f1eaac8d1f2 Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Mon, 24 Jun 2024 14:20:27 -0600 Subject: [PATCH] Add option to disable logging creation --- index.js | 10 +++++++++- migrations/2.sql | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 migrations/2.sql diff --git a/index.js b/index.js index 9f55b06..a5ccadc 100644 --- a/index.js +++ b/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({ diff --git a/migrations/2.sql b/migrations/2.sql new file mode 100644 index 0000000..660cb65 --- /dev/null +++ b/migrations/2.sql @@ -0,0 +1 @@ +ALTER TABLE guilds ADD COLUMN log_create BOOLEAN DEFAULT 1; \ No newline at end of file