Don't allow opening threads with bots with !newthread, fixes #452

cshd
Dragory 2020-09-23 01:04:40 +03:00
parent 0c9302b41b
commit 9be6b2aa1f
No known key found for this signature in database
GPG Key ID: 5F387BA66DF8AAC1
1 changed files with 5 additions and 0 deletions

View File

@ -9,6 +9,11 @@ module.exports = ({ bot, knex, config, commands }) => {
return; return;
} }
if (user.bot) {
utils.postSystemMessageWithFallback(msg.channel, thread, "Can't create a thread for a bot");
return;
}
const existingThread = await threads.findOpenThreadByUserId(user.id); const existingThread = await threads.findOpenThreadByUserId(user.id);
if (existingThread) { if (existingThread) {
utils.postSystemMessageWithFallback(msg.channel, thread, `Cannot create a new thread; there is another open thread with this user: <#${existingThread.channel_id}>`); utils.postSystemMessageWithFallback(msg.channel, thread, `Cannot create a new thread; there is another open thread with this user: <#${existingThread.channel_id}>`);