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

+1
View File
@@ -21,6 +21,7 @@ let hm = new mongoose.Schema({
analytics_visitors: Number,
analytics_invites: Number,
vanity: String,
invite: String,
});
module.exports = mongoose.model("bots", hm);
+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,
})
})
})
+4
View File
@@ -25,6 +25,10 @@
<input type="text" name="bot_owners" id="floating_last_name" class="block py-2.5 px-0 w-full text-sm bg-transparent border-0 border-b-2 appearance-none text-white border-gray-600 focus:outline-none focus:ring-0 focus:border-blue-600 peer" placeholder=" " required />
<label for="bot_name" class="peer-focus:font-medium absolute text-sm text-white duration-300 transform -translate-y-6 scale-75 top-3 -z-10 origin-[0] peer-focus:left-0 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6">Owners (split with <strong>,</strong> ) (You are automatic included!)</label>
</div>
<div class="relative z-0 mb-6 w-full group">
<input type="text" name="bot_invite" id="floating_last_name" class="block py-2.5 px-0 w-full text-sm bg-transparent border-0 border-b-2 appearance-none text-white border-gray-600 focus:outline-none focus:ring-0 focus:border-blue-600 peer" placeholder=" " required />
<label for="bot_invite" class="peer-focus:font-medium absolute text-sm text-white duration-300 transform -translate-y-6 scale-75 top-3 -z-10 origin-[0] peer-focus:left-0 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6">Bot Invite Url</label>
</div>
<!-- tags -->
<div class="relative z-0 mb-6 w-full group">
<select multiple name="tags" class=" border text-sm rounded-lg block w-full p-2.5 bg-gray-700 border-gray-600 placeholder-gray-400 text-white focus:ring-blue-500 focus:border-blue-500" required>
+1 -1
View File
@@ -13,7 +13,7 @@
<h1 class="text-3xl text-center">
<%= bot.name %>
</h1>
<a href="/bot/<%= bot.id %>/join" class="button float-right inline-block bg-button-primary rounded-full px-3 py-1 text-sm font-semibold text-white mr-2 mb-2"><i class="fa fa-link"></i>
<a href="/bot/<%= bot.id %>/invite" class="button float-right inline-block bg-button-primary rounded-full px-3 py-1 text-sm font-semibold text-white mr-2 mb-2"><i class="fa fa-link"></i>
Invite</a>
<a href="/bot/<%= bot.id %>/vote" class="button float-left inline-block bg-button-primary rounded-full px-3 py-1 text-sm font-semibold text-white mr-2 mb-2"><i class="fa fa-link"></i>
Vote</a>