Fixed typo

This commit is contained in:
CorwinDev committed 2022-08-15 13:33:14 +02:00
1 parent 293cc20546
commit 4340280545
8 files changed
+91 -24

No files matched your search

+2 -2
View File
@@ -1,5 +1,5 @@
module.exports = {
maintenance: true,
maintenance: false,
mongodb: "mongodb+srv://root:RzIhDff90LKkOOjw@cluster0.jo9hd.mongodb.net/?retryWrites=true&w=majority",
bot: {
id: "934087523649609768",
@@ -50,6 +50,6 @@ module.exports = {
},
users: {
owner: ["755297485328482356"],
verificator: ["755297485328482356", "759037138929975297"],
verificator: ["755297485328482356"],
}
}
+3
View File
@@ -43,6 +43,9 @@ client.on('ready', () => {
// Login
client.login(client.config.bot.token);
bsl.login(bsl.config.bot.bsl.token);
bsl.on('rateLimit', (info) => {
console.log(`Rate limit hit ${info.timeDifference ? info.timeDifference : info.timeout ? info.timeout : 'Unknown timeout '}`)
})
// Node Error Handler
process.on('uncaughtException', function (err) {
console.log(err);
+18
View File
@@ -17,6 +17,7 @@
"discord.js": "^14.1.1",
"ejs": "^3.1.8",
"express": "^4.18.1",
"express-rate-limit": "^6.5.1",
"express-session": "^1.17.3",
"memorystore": "^1.6.7",
"mongoose": "^6.5.0",
@@ -1091,6 +1092,17 @@
"node": ">= 0.10.0"
}
},
"node_modules/express-rate-limit": {
"version": "6.5.1",
"resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-6.5.1.tgz",
"integrity": "sha512-pxO6ioBLd3i8IHL+RmJtL4noYzte5fugoMdaDabtU4hcg53+x0QkTwfPtM7vWD0YUaXQgNj9NRdzmps+CHEHlA==",
"engines": {
"node": ">= 12.9.0"
},
"peerDependencies": {
"express": "^4 || ^5"
}
},
"node_modules/express-session": {
"version": "1.17.3",
"resolved": "https://registry.npmjs.org/express-session/-/express-session-1.17.3.tgz",
@@ -4187,6 +4199,12 @@
"vary": "~1.1.2"
}
},
"express-rate-limit": {
"version": "6.5.1",
"resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-6.5.1.tgz",
"integrity": "sha512-pxO6ioBLd3i8IHL+RmJtL4noYzte5fugoMdaDabtU4hcg53+x0QkTwfPtM7vWD0YUaXQgNj9NRdzmps+CHEHlA==",
"requires": {}
},
"express-session": {
"version": "1.17.3",
"resolved": "https://registry.npmjs.org/express-session/-/express-session-1.17.3.tgz",
+1
View File
@@ -34,6 +34,7 @@
"discord.js": "^14.1.1",
"ejs": "^3.1.8",
"express": "^4.18.1",
"express-rate-limit": "^6.5.1",
"express-session": "^1.17.3",
"memorystore": "^1.6.7",
"mongoose": "^6.5.0",
+16 -13
View File
@@ -19,6 +19,17 @@ var api = require('./routers/api');
var client = require('../index');
app.set('view engine', 'ejs');
app.set('views', path.join(__dirname, '/views'));
const rateLimit = require('express-rate-limit')
const limiter = rateLimit({
windowMs: 1 * 60 * 1000,
max: 100,
standardHeaders: true,
legacyHeaders: false,
message:
'Too many requests from this IP, please try again after a few minutes.',
})
app.use("/api", limiter)
app.use('/api', api);
if(global.config.maintenance) {
console.log(colors.red("[MAINTENANCE]") + " Bot is in maintenance mode.");
app.get('/', (req, res) => {
@@ -141,10 +152,10 @@ app.get('/servers', async (req, res) => {
});
app.get('/tag/:id', async (req, res) => {
var id = req.params.id;
var id = req.params.id.toLowerCase();
var bot = await bots.find({ tags: id });
res.render('tags/index', {
bot: bot,
bots: bot,
user: req.user,
tag: id,
});
@@ -170,17 +181,9 @@ app.get("/sitemap.xml", async function (req, res) {
app.get('/invite', function (req, res) {
res.redirect(client.config.bot.bsl.invite);
});
app.use((req, res, next) => {
if (res.statusCode === 404) {
req.session.error = "Page not found";
res.redirect('/');
} else if (res.statusCode === 500) {
req.session.error = "Internal server error";
res.redirect('/');
} else {
req.session.error = "Page not found";
res.redirect('/');
}
app.use((err, req, res, next) => {
console.error(err.stack)
res.status(500).send('Something broke!')
})
app.listen(client.config.server.port, () => {
console.log(colors.green("Website: "), 'Your app is listening on port ' + port);
+4 -4
View File
@@ -30,7 +30,7 @@ router.get('/search/:id', function (req, res) {
serverArray.push({ "name": server.name, "id": server.id, "description": server.description, type: "bot" });
});
res.json({
serverArray
array: serverArray
})
}
@@ -49,7 +49,7 @@ const applyText = (canvas, text) => {
const { createCanvas, loadImage, Image } = require('canvas')
const { readFile } = require('fs/promises');
router.get('/server/:id', function (req, res) {
router.get('/server/banner/:id', function (req, res) {
// Get one server and draw it on the canvas
servers.findOne({ id: req.params.id }, async function (err, server) {
if (err) throw err;
@@ -81,7 +81,7 @@ router.get('/server/:id', function (req, res) {
context.font = '30px sans-serif';
context.fillStyle = '#ffffff';
context.fillText(`BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB`, canvas.width / 2.7, canvas.height / 1.8);
context.fillText(serverName, canvas.width / 2.7, canvas.height / 1.8);
context.font = '18px sans-serif';
context.fillText(`🙍‍♂️ ${serverMembers}`, canvas.width / 2.7, canvas.height / 1.1);
@@ -189,7 +189,7 @@ router.get('/bots/search/:id', function (req, res) {
}
});
});
router.get('/bots/check/:id', function (req, res) {
router.get('/bots/checkvote/:id', function (req, res) {
votes.findOne({ user: req.params.id }, function (err, vote) {
if (err) {
res.status(503).json({
+5 -5
View File
@@ -34,15 +34,15 @@
type: 'GET',
success: function(data) {
var html = '';
if(!data.serverArray.length) html = '<div class="text-center">No results found</div>';
for (var i = 0; i < data.serverArray.length; i++) {
if(!data.array.length) html = '<div class="text-center">No results found</div>';
for (var i = 0; i < data.array.length; i++) {
if (i == 5) {
break;
}
if (data.serverArray[i].type == 'server') {
html += '<a href="/server/' + data.serverArray[i].id + '" class="flex items-center p-2 border-b border-gray-300 hover:bg-primary-color hover:text-white"><img title="botscord.site" class="mr-2" width="48" onError="this.src = ' + "'/img/logo.webp'" + '" style="border-radius: 8px;" src="' + data.serverArray[i].avatar + '" />' + data.serverArray[i].name + ' | Server</a>';
if (data.array[i].type == 'server') {
html += '<a href="/server/' + data.array[i].id + '" class="flex items-center p-2 border-b border-gray-300 hover:bg-primary-color hover:text-white"><img title="botscord.site" class="mr-2" width="48" onError="this.src = ' + "'/img/logo.webp'" + '" style="border-radius: 8px;" src="' + data.array[i].avatar + '" />' + data.array[i].name + ' | Server</a>';
} else {
html += '<a href="/bot/' + data.serverArray[i].id + '" class="flex items-center p-2 border-b border-gray-300 hover:bg-primary-color hover:text-white"><img title="botscord.site" class="mr-2" width="48" onError="this.src = ' + " '/img/logo.webp'" + '" style="border-radius: 8px;" src="' + data.serverArray[i].avatar + '" />' + data.serverArray[i].name + ' | Bot </a>';
html += '<a href="/bot/' + data.array[i].id + '" class="flex items-center p-2 border-b border-gray-300 hover:bg-primary-color hover:text-white"><img title="botscord.site" class="mr-2" width="48" onError="this.src = ' + " '/img/logo.webp'" + '" style="border-radius: 8px;" src="' + data.array[i].avatar + '" />' + data.array[i].name + ' | Bot </a>';
}
}
var searchr = document.getElementById('search-results');
+42
View File
@@ -1 +1,43 @@
<%- include("../includes/header.ejs", { title: "Tag: " + tag}) %>
<% var nbots= bots
nbots.forEach((val, key) => {
randomIndex = Math.ceil(Math.random()*(key + 1));
nbots[key] = nbots[randomIndex];
nbots[randomIndex] = val;
});
if(nbots.length > 0) { %>
<div class="mx-auto text-center">
<br>
<h2 class="text-xl text-white text-center"><i class="fa fa-tag" aria-hidden="true"></i> Bots tagged with <%= tag %></h2>
</h2>
<p class="content text-white text-center" style="opacity:.6">These bots are tagged with <%= tag %> </p>
</div>
<div class="grid columns items-center content-center justify-center grid-cols-1 gap-4 col-auto sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 m-8">
<% } %>
<% for(let i=0; i < nbots.length; i++) { if (i===3) break; var bot=nbots[i]; if(bot) { %>
<div class="transition-shadow ease-in-out duration-300 hover:shadow-blue-900 shadow-2xl rounded-lg max-w-sm bg-blue-color " onclick="location.href='/bot/<%=bot.id%> ';" style="cursor: pointer;">
<img class="w-full rounded-full" src="<%= bot.icon %>" onerror="this.src='/img/logo.webp'" alt="<%= bot.name %>">
<div class="px-6 text-white text-base">
<p><i class="fa-solid fa-check-to-slot"></i>: <%= bot.votes || 0 %> <%if(bot.servers) { %><i class="fa fa-server"></i>: <%= bot.servers %><% } %>
</p>
</div>
<div class="px-6 py-4">
<div class="font-bold text-xl mb-2 text-white">
<%= bot.name %>
</div>
<p class="text-white text-base">
<%= bot.description %>
</p>
</div>
<% if(bot.tags) {%>
<div class="px-6 pt-4 pb-2">
<% bot.tags.slice(-3).forEach(tag=>{ %>
<a href="/tag/<%= tag %>" class="inline-block bg-button-primary rounded-full px-3 py-1 text-sm font-semibold text-white mr-2 mb-2">#<%= tag %>
</a>
<% }) %>
</div>
<% } %>
</div>
<% } %>
<% } %>
</div>