Solved bot invite issue

This commit is contained in:
CorwinDev committed 2022-08-18 19:56:02 +02:00
1 parent 17323bdc72
commit 44f2f765f7
4 files changed
+13 -6

No files matched your search

+7 -5
View File
@@ -59,6 +59,7 @@ router.post('/add', async function (req, res) {
description: req.body.bot_short,
tags: req.body.tags,
token: makeid(64),
invite: req.body.bot_invite
});
bot.save(function (err) {
@@ -416,17 +417,18 @@ router.get('/:botID/invite', async function (req, res) {
req.session.error = "No bot found";
return res.redirect('/');
}
if (!bot.invite) {
if (bot.invite) {
return res.render('bot/join', {
bot: bot,
invite: bot.invite,
})
} else {
var invite = "https://discord.com/oauth2/authorize?client_id=" + bot.id + "&scope=bot&permissions=8";
return res.render('bot/join', {
bot: bot,
invite: invite,
})
}
return res.render('bot/join', {
bot: bot,
invite: bot.invite,
})
})
})