Fixed typo
This commit is contained in:
1 parent
293cc20546
commit
4340280545
8 files changed
+91
-24
No files matched your search
@@ -1,5 +1,5 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
maintenance: true,
|
maintenance: false,
|
||||||
mongodb: "mongodb+srv://root:RzIhDff90LKkOOjw@cluster0.jo9hd.mongodb.net/?retryWrites=true&w=majority",
|
mongodb: "mongodb+srv://root:RzIhDff90LKkOOjw@cluster0.jo9hd.mongodb.net/?retryWrites=true&w=majority",
|
||||||
bot: {
|
bot: {
|
||||||
id: "934087523649609768",
|
id: "934087523649609768",
|
||||||
@@ -50,6 +50,6 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
users: {
|
users: {
|
||||||
owner: ["755297485328482356"],
|
owner: ["755297485328482356"],
|
||||||
verificator: ["755297485328482356", "759037138929975297"],
|
verificator: ["755297485328482356"],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -43,6 +43,9 @@ client.on('ready', () => {
|
|||||||
// Login
|
// Login
|
||||||
client.login(client.config.bot.token);
|
client.login(client.config.bot.token);
|
||||||
bsl.login(bsl.config.bot.bsl.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
|
// Node Error Handler
|
||||||
process.on('uncaughtException', function (err) {
|
process.on('uncaughtException', function (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
|||||||
Generated
+18
@@ -17,6 +17,7 @@
|
|||||||
"discord.js": "^14.1.1",
|
"discord.js": "^14.1.1",
|
||||||
"ejs": "^3.1.8",
|
"ejs": "^3.1.8",
|
||||||
"express": "^4.18.1",
|
"express": "^4.18.1",
|
||||||
|
"express-rate-limit": "^6.5.1",
|
||||||
"express-session": "^1.17.3",
|
"express-session": "^1.17.3",
|
||||||
"memorystore": "^1.6.7",
|
"memorystore": "^1.6.7",
|
||||||
"mongoose": "^6.5.0",
|
"mongoose": "^6.5.0",
|
||||||
@@ -1091,6 +1092,17 @@
|
|||||||
"node": ">= 0.10.0"
|
"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": {
|
"node_modules/express-session": {
|
||||||
"version": "1.17.3",
|
"version": "1.17.3",
|
||||||
"resolved": "https://registry.npmjs.org/express-session/-/express-session-1.17.3.tgz",
|
"resolved": "https://registry.npmjs.org/express-session/-/express-session-1.17.3.tgz",
|
||||||
@@ -4187,6 +4199,12 @@
|
|||||||
"vary": "~1.1.2"
|
"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": {
|
"express-session": {
|
||||||
"version": "1.17.3",
|
"version": "1.17.3",
|
||||||
"resolved": "https://registry.npmjs.org/express-session/-/express-session-1.17.3.tgz",
|
"resolved": "https://registry.npmjs.org/express-session/-/express-session-1.17.3.tgz",
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
"discord.js": "^14.1.1",
|
"discord.js": "^14.1.1",
|
||||||
"ejs": "^3.1.8",
|
"ejs": "^3.1.8",
|
||||||
"express": "^4.18.1",
|
"express": "^4.18.1",
|
||||||
|
"express-rate-limit": "^6.5.1",
|
||||||
"express-session": "^1.17.3",
|
"express-session": "^1.17.3",
|
||||||
"memorystore": "^1.6.7",
|
"memorystore": "^1.6.7",
|
||||||
"mongoose": "^6.5.0",
|
"mongoose": "^6.5.0",
|
||||||
|
|||||||
+16
-13
@@ -19,6 +19,17 @@ var api = require('./routers/api');
|
|||||||
var client = require('../index');
|
var client = require('../index');
|
||||||
app.set('view engine', 'ejs');
|
app.set('view engine', 'ejs');
|
||||||
app.set('views', path.join(__dirname, '/views'));
|
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) {
|
if(global.config.maintenance) {
|
||||||
console.log(colors.red("[MAINTENANCE]") + " Bot is in maintenance mode.");
|
console.log(colors.red("[MAINTENANCE]") + " Bot is in maintenance mode.");
|
||||||
app.get('/', (req, res) => {
|
app.get('/', (req, res) => {
|
||||||
@@ -141,10 +152,10 @@ app.get('/servers', async (req, res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
app.get('/tag/:id', 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 });
|
var bot = await bots.find({ tags: id });
|
||||||
res.render('tags/index', {
|
res.render('tags/index', {
|
||||||
bot: bot,
|
bots: bot,
|
||||||
user: req.user,
|
user: req.user,
|
||||||
tag: id,
|
tag: id,
|
||||||
});
|
});
|
||||||
@@ -170,17 +181,9 @@ app.get("/sitemap.xml", async function (req, res) {
|
|||||||
app.get('/invite', function (req, res) {
|
app.get('/invite', function (req, res) {
|
||||||
res.redirect(client.config.bot.bsl.invite);
|
res.redirect(client.config.bot.bsl.invite);
|
||||||
});
|
});
|
||||||
app.use((req, res, next) => {
|
app.use((err, req, res, next) => {
|
||||||
if (res.statusCode === 404) {
|
console.error(err.stack)
|
||||||
req.session.error = "Page not found";
|
res.status(500).send('Something broke!')
|
||||||
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.listen(client.config.server.port, () => {
|
app.listen(client.config.server.port, () => {
|
||||||
console.log(colors.green("Website: "), 'Your app is listening on port ' + port);
|
console.log(colors.green("Website: "), 'Your app is listening on port ' + port);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ router.get('/search/:id', function (req, res) {
|
|||||||
serverArray.push({ "name": server.name, "id": server.id, "description": server.description, type: "bot" });
|
serverArray.push({ "name": server.name, "id": server.id, "description": server.description, type: "bot" });
|
||||||
});
|
});
|
||||||
res.json({
|
res.json({
|
||||||
serverArray
|
array: serverArray
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ const applyText = (canvas, text) => {
|
|||||||
const { createCanvas, loadImage, Image } = require('canvas')
|
const { createCanvas, loadImage, Image } = require('canvas')
|
||||||
const { readFile } = require('fs/promises');
|
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
|
// Get one server and draw it on the canvas
|
||||||
servers.findOne({ id: req.params.id }, async function (err, server) {
|
servers.findOne({ id: req.params.id }, async function (err, server) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
@@ -81,7 +81,7 @@ router.get('/server/:id', function (req, res) {
|
|||||||
context.font = '30px sans-serif';
|
context.font = '30px sans-serif';
|
||||||
|
|
||||||
context.fillStyle = '#ffffff';
|
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.font = '18px sans-serif';
|
||||||
|
|
||||||
context.fillText(`🙍♂️ ${serverMembers}`, canvas.width / 2.7, canvas.height / 1.1);
|
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) {
|
votes.findOne({ user: req.params.id }, function (err, vote) {
|
||||||
if (err) {
|
if (err) {
|
||||||
res.status(503).json({
|
res.status(503).json({
|
||||||
|
|||||||
@@ -34,15 +34,15 @@
|
|||||||
type: 'GET',
|
type: 'GET',
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
var html = '';
|
var html = '';
|
||||||
if(!data.serverArray.length) html = '<div class="text-center">No results found</div>';
|
if(!data.array.length) html = '<div class="text-center">No results found</div>';
|
||||||
for (var i = 0; i < data.serverArray.length; i++) {
|
for (var i = 0; i < data.array.length; i++) {
|
||||||
if (i == 5) {
|
if (i == 5) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (data.serverArray[i].type == 'server') {
|
if (data.array[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>';
|
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 {
|
} 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');
|
var searchr = document.getElementById('search-results');
|
||||||
|
|||||||
@@ -1 +1,43 @@
|
|||||||
<%- include("../includes/header.ejs", { title: "Tag: " + tag}) %>
|
<%- 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>
|
||||||
Reference in new issue
Block a user