This commit is contained in:
CorwinDev committed 2022-08-08 10:55:08 +02:00
1 parent 2590b5f4c1
commit c058ab2e55
24 files changed
+269 -113

No files matched your search

-11
View File
@@ -1,11 +0,0 @@
module.exports = {
"mongodb": "mongodb+srv://root:@cluster0.jo9hd.mongodb.net/?retryWrites=true&w=majority",
"bot": {
token: "ODcwMDAxMjM0NTgzNjIxNzEz.GHwzsE.tvU0FJG9c7HFkLaqDMqp6wTaSBZbFdH6wuaLO0",
channels: {
login: "868065455628234780",
vote: "937643610541793300",
error: "1003947531543269507",
}
},
}
-23
View File
@@ -1,23 +0,0 @@
// Create discord.js client
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildMessageTyping,
GatewayIntentBits.DirectMessages,
]
});
client.config = require('./config');
// Set intents
client.on('ready', () => {
console.log('Bot is ready!');
// Log server count
setTimeout(() => {
console.log(`${client.guilds.cache.size} servers`);
}, 1000);
});
// Login
client.login(client.config.bot.token);
-12
View File
@@ -1,12 +0,0 @@
{
"name": "bot",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
+50
View File
@@ -0,0 +1,50 @@
const client = require('../index.js').bsl;
const servers = require('../models/server');
const bots = require('../models/bot');
var config = client.config
const colors = require('colors');
const bsl = colors.blue("BSL: ");
// Set intents
client.on('ready',async () => {
const bot = await bots.find();
client.user.setPresence({ activity: { type: 'WATCHING', name: 'botscord.xyz | '+bot.length+' bots' }, status: "online" });
console.log(bsl, 'Bot is ready!');
// Log server count
setTimeout(() => {
console.log(bsl,
`${client.guilds.cache.size} servers`);
}, 1000);
});
const { SlashCommandBuilder, Routes } = require('discord.js');
const { REST } = require('@discordjs/rest');
const commands = [
new SlashCommandBuilder().setName('ping').setDescription('Replies with pong!'),
new SlashCommandBuilder().setName('topserver').setDescription('Replies with highest server!'),
new SlashCommandBuilder().setName('user').setDescription('Replies with user info and connected bots/servers!'),
]
.map(command => command.toJSON());
const rest = new REST({ version: '10' }).setToken(config.bot.token);
rest.put(Routes.applicationCommands(config.bot.id), { body: commands })
.then(() => console.log(bsl, 'Successfully registered application commands.'))
.catch(console.error);
client.on('interactionCreate', async interaction => {
if (!interaction.isChatInputCommand()) return;
const { commandName } = interaction;
if (commandName === 'ping') {
await interaction.reply(`🏓Latency is ${Date.now() - interaction.createdTimestamp}ms. API Latency is ${Math.round(client.ws.ping)}ms`);
} else if (commandName === 'topserver') {
const topServer = await servers.find({}).sort({ votes: -1 });
console.log(bsl, topServer);
await interaction.reply(`The top server is ${topServer[0].name} with ${topServer[0].votes} votes!`);
} else if (commandName === 'user') {
const { user } = interaction;
await interaction.reply(`${user.username}#${user.discriminator} has ${user.bot ? 'a bot' : 'no bot'} and is connected to ${user.guilds.size} servers!`);
} else {
await interaction.reply('Command not found!');
}
});
+31 -25
View File
@@ -1,34 +1,40 @@
module.exports = {
"mongodb": "mongodb+srv://root:RzIhDff90LKkOOjw@cluster0.jo9hd.mongodb.net/?retryWrites=true&w=majority",
"bot": {
"id": "934087523649609768",
"token": "OTM0MDg3NTIzNjQ5NjA5NzY4.GV-g1-.Eggw57JNtsrLPbakg-_yr8fn8oBAbh0nKfK-lk",
"channels":{
"login": "868065455628234780",
"vote": "937643610541793300",
"error": "1003947531543269507",
"info": "1005178285124239510",
mongodb: "mongodb+srv://root:RzIhDff90LKkOOjw@cluster0.jo9hd.mongodb.net/?retryWrites=true&w=majority",
bot: {
id: "934087523649609768",
token: "OTM0MDg3NTIzNjQ5NjA5NzY4.GV-g1-.Eggw57JNtsrLPbakg-_yr8fn8oBAbh0nKfK-lk",
channels:{
login: "868065455628234780",
vote: "937643610541793300",
error: "1003947531543269507",
info: "1005178285124239510",
},
"bsl" : {
"id": "870001234583621713",
"token": "ODcwMDAxMjM0NTgzNjIxNzEz.GfMe5Y.USVO8IBvKkPIX0PFbYFRgfpctT-wW8sBVmFLQc",
"channels":{
"vote":"937643610541793300",
"error":"1003947531543269507",
bsl : {
id: "870001234583621713",
token: "ODcwMDAxMjM0NTgzNjIxNzEz.GfMe5Y.USVO8IBvKkPIX0PFbYFRgfpctT-wW8sBVmFLQc",
channels:{
vote:"937643610541793300",
error:"1003947531543269507",
},
"invite":"https://discord.com/api/oauth2/authorize?client_id=870001234583621713&permissions=314433&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fauth%2Fcallback&response_type=code&scope=applications.commands%20bot"
invite:"https://discord.com/api/oauth2/authorize?client_id=870001234583621713&permissions=314433&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fauth%2Fcallback&response_type=code&scope=applications.commands%20bot"
}
},
"discord":{
"id": "868065454940385291",
"invite":"",
discord:{
id: "868065454940385291",
invite:"",
roles: {
admin: "868065454940385291",
mod: "868065454940385291",
user: "868065454940385293",
bot: "1006120950045098034"
}
},
"server": {
"port": 3000,
"host": "http://localhost:3000",
server: {
port: 3000,
host: "http://localhost:3000",
},
"users": {
"owner": [""],
"verificator": [""],
users: {
owner: [""],
verificator: [""],
}
}
+5 -3
View File
@@ -1,12 +1,13 @@
// Import config and export
const config = require('./config');
const mongoose = require('mongoose');
const colors = require('colors');
// Connect to mongoDB
try {
mongoose.connect(config.mongodb);
} catch (err) {
console.log(err);
console.log('Error connecting to mongoDB');
console.log(colors.red("MongoDB: "), 'Error connecting to mongoDB');
process.exit(1);
}
// Create discord.js client
@@ -32,12 +33,13 @@ client.config = config;
bsl.config = config
// Set intents
client.on('ready', () => {
console.log('Website bot is ready!');
console.log(colors.green("Website: "), 'Website bot is ready!');
require('./website')
require('./website/bot')
require('./bsl')
});
bsl.on('ready', () => {
console.log('BSL Started!');
console.log(colors.blue("BSL: "), 'BSL ready');
});
// Login
client.login(client.config.bot.token);
+2 -1
View File
@@ -8,7 +8,8 @@ let hm = new mongoose.Schema({
tags: [String],
premium: Boolean,
icon: String,
members: String,
members: Number,
votes: Number,
});
module.exports = mongoose.model("servers", hm);
+14
View File
@@ -11,6 +11,7 @@
"dependencies": {
"autoprefixer": "^10.4.8",
"body-parser": "^1.20.0",
"colors": "^1.4.0",
"cookie-session": "^2.0.0",
"discord.js": "^14.1.1",
"ejs": "^3.1.8",
@@ -612,6 +613,14 @@
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
},
"node_modules/colors": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
"integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==",
"engines": {
"node": ">=0.1.90"
}
},
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
@@ -3236,6 +3245,11 @@
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
},
"colors": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
"integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA=="
},
"combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
+1
View File
@@ -28,6 +28,7 @@
"dependencies": {
"autoprefixer": "^10.4.8",
"body-parser": "^1.20.0",
"colors": "^1.4.0",
"cookie-session": "^2.0.0",
"discord.js": "^14.1.1",
"ejs": "^3.1.8",
+18 -1
View File
@@ -3,6 +3,7 @@ const servers = require('../../models/server');
var config = client.config
const { SlashCommandBuilder, Routes } = require('discord.js');
const { REST } = require('@discordjs/rest');
const colors = require('colors');
const commands = [
new SlashCommandBuilder().setName('ping').setDescription('Replies with pong!'),
new SlashCommandBuilder().setName('topserver').setDescription('Replies with highest server!'),
@@ -13,7 +14,7 @@ const commands = [
const rest = new REST({ version: '10' }).setToken(config.bot.token);
rest.put(Routes.applicationGuildCommands(config.bot.id, config.discord.id), { body: commands })
.then(() => console.log('Successfully registered application commands.'))
.then(() => console.log(colors.green("Website: "),'Successfully registered application commands.'))
.catch(console.error);
client.on('interactionCreate', async interaction => {
@@ -32,3 +33,19 @@ client.on('interactionCreate', async interaction => {
}
});
client.on("guildMemberAdd", async (member) => {
let guild = client.guilds.cache.get(config.discord.id);
if (member.user.bot) {
try {
guild.member(member.id).roles.add(config.server.roles.botlist.bot);
} catch (error) {
}
}else{
try {
guild.member(member.id).roles.add(config.server.roles.botlist.user);
} catch (error) {
}
}
});
+3 -2
View File
@@ -8,6 +8,7 @@ const passport = require('passport');
var DiscordStrategy = require('passport-discord').Strategy;
var MemoryStore = require('memorystore')(session);
const bodyParser = require('body-parser');
const colors = require('colors');
var showdown = require('showdown'),
converter = new showdown.Converter();
var bot = require('./routers/bot');
@@ -25,7 +26,7 @@ passport.deserializeUser(function (obj, done) {
const Banned = require('../models/site-ban');
const bots = require('../models/bot');
const server = require('../models/server');
var scopes = ['identify', 'email', 'guilds', 'guilds.join'];
var scopes = ['identify', 'guilds', 'guilds.join'];
var prompt = 'consent'
passport.use(new DiscordStrategy({
clientID: '934087523649609768',
@@ -138,6 +139,6 @@ app.use((req, res, next) => {
}
})
app.listen(port, () => {
console.log('Your app is listening on port ' + port);
console.log(colors.green("Website: "),'Your app is listening on port ' + port);
});
module.exports.client = client;
+10 -2
View File
@@ -856,8 +856,8 @@ video {
.w-2\/3 {
width: 66.666667%;
}
.w-1\/3 {
width: 33.333333%;
.w-1\/4 {
width: 25%;
}
.max-w-7xl {
max-width: 80rem;
@@ -1966,6 +1966,14 @@ body {
display: inline;
}
.sm\:flex {
display: flex;
}
.sm\:grid {
display: grid;
}
.sm\:min-h-min {
min-height: -webkit-min-content;
min-height: -moz-min-content;
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 749 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

+1
View File
@@ -0,0 +1 @@
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
+82 -8
View File
@@ -12,7 +12,7 @@ router.get('/add', function (req, res) {
if (req.user) {
res.render('server/add', {
user: req.user,
botscord: client
serverscord: client
});
return
} else {
@@ -25,7 +25,7 @@ router.post('/add', async function (req, res) {
if (req.user) {
var checkServer = await client.bsl.guilds.cache.get(req.body.serverid);
if (!checkServer) {
return res.redirect(client.config.bot.bsl.invite + "&guild_id=" + req.body.serverid);
return res.redirect(client.config.server.bsl.invite + "&guild_id=" + req.body.serverid);
} else {
let checkGuild = await servers.findOne({ id: checkServer.id });
if (checkGuild) {
@@ -66,7 +66,7 @@ router.post('/add', async function (req, res) {
.setTimestamp()
.setThumbnail(checkServer.iconURL({ format: 'png', dynamic: true }))
.setFooter({ text: 'New Server', iconURL: "https://cdn.discordapp.com/avatars/" + req.user.id + "/" + req.user.avatar + ".png" });
client.client.channels.cache.get(client.client.config.bot.channels.info).send({ embeds: [embed] });
client.client.channels.cache.get(client.client.config.server.channels.info).send({ embeds: [embed] });
server.save(function (err) {
if (err) {
console.log(err);
@@ -85,20 +85,94 @@ router.post('/add', async function (req, res) {
});
router.get('/:server', function (req, res) {
servers.findOne({ id: req.params.server }, function (err, bot) {
servers.findOne({ id: req.params.server }, function (err, server) {
if (err) {
console.log(err);
return res.redirect('/');
}
if (!bot) {
req.session.error = "No bot found";
if (!server) {
req.session.error = "No server found";
return res.redirect('/');
}
res.render('server/index', {
user: req.user,
server: bot,
serverr: global.client.guilds.cache.get(bot.id)
server: server,
serverr: global.client.guilds.cache.get(server.id)
});
})
})
router.get('/:server/edit', function (req, res) {
if(!req.user){
req.session.backURL = req.originalUrl;
res.redirect('/auth');
}
servers.findOne({ id: req.params.server }, function (err, server) {
if (err) {
console.log(err);
return res.redirect('/');
}
if (!server) {
req.session.error = "No server found";
return res.redirect('/');
}
var serverr = global.client.guilds.cache.get(server.id)
if (serverr.members.cache.get(req.user.id)) {
if (serverr.members.cache.get(req.user.id).permissions.has('ADMINISTRATOR')) {
res.render('server/edit', {
user: req.user,
server: server,
serverr: serverr
});
} else {
req.session.error = "You don't have permission to edit this server";
return res.redirect('/');
}
} else {
req.session.error = "You don't have permission to edit this server";
return res.redirect('/');
}
})
})
router.post('/:server/edit', async function (req, res) {
if(!req.user){
req.session.backURL = req.originalUrl;
res.redirect('/auth');
}
servers.findOne({ id: req.params.server }, function (err, server) {
if (err) {
console.log(err);
return res.redirect('/');
}
if (!server) {
req.session.error = "No server found";
return res.redirect('/');
}
var serverr = global.client.guilds.cache.get(server.id)
if (serverr.members.cache.get(req.user.id)) {
if (serverr.members.cache.get(req.user.id).permissions.has('ADMINISTRATOR')) {
server.description = req.body.server_short;
server.long_description = req.body.server_description;
server.tags = req.body.tags;
server.save(function (err) {
if (err) {
console.log(err);
req.session.error = "Something went wrong";
res.redirect('/');
} else {
req.session.message = "Server edited";
res.redirect('/');
}
});
} else {
req.session.error = "You don't have permission to edit this server";
return res.redirect('/');
}
} else {
req.session.error = "You don't have permission to edit this server";
return res.redirect('/');
}
})
})
module.exports = router;
-17
View File
@@ -34,20 +34,3 @@
</p>
</div>
</footer>
<script src="https://unpkg.com/@popperjs/core@2"></script>
<script src="https://unpkg.com/tippy.js@6"></script>
<script>
$(document).ready(function () {
$('[data-tooltip]').each(function () {
var title = $(this).attr('title');
console.log($(this))
tippy("[data-tooltip]", {
content: title,
appendTo: document.body,
popperOptions: {
strategy: 'fixed',
},
});
});
});
</script>
+3
View File
@@ -14,6 +14,9 @@
<link href="/css/style.css" rel="stylesheet">
<script src="https://kit.fontawesome.com/204113bb1b.js" crossorigin="anonymous"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
</head>
<body class="bg-primary-color">
+44
View File
@@ -0,0 +1,44 @@
<%- include("../includes/header.ejs", {title: "Edit " + server.name}) %>
<!-- create form -->
<div class="container-sm p-10">
<form method="post" action="">
<div class="relative z-0 mb-6 w-full group">
<textarea type="text" name="server_description" id="server_name"
class="block py-2.5 px-0 w-full text-sm text-gray-900 bg-transparent border-0 border-b-2 border-gray-300 appearance-none dark:text-white dark:border-gray-600 dark:focus:border-blue-500 focus:outline-none focus:ring-0 focus:border-blue-600 peer"
placeholder=" " required rows="5"><%= server.long_description %></textarea>
<label for="server_name"
class="peer-focus:font-medium absolute text-sm text-white dark:text-white duration-300 transform -translate-y-6 scale-75 top-3 -z-10 origin-[0] peer-focus:left-0 peer-focus:text-blue-600 peer-focus:dark:text-blue-500 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6">Server
description (MarkDown supported!)</label>
</div>
<div class="relative z-0 mb-6 w-full group">
<input type="text" name="server_short" id="floating_last_name"
class="block py-2.5 px-0 w-full text-sm text-gray-900 bg-transparent border-0 border-b-2 border-gray-300 appearance-none dark:text-white dark:border-gray-600 dark:focus:border-blue-500 focus:outline-none focus:ring-0 focus:border-blue-600 peer"
placeholder=" " required value="<%= server.description %>"/>
<label for="server_name"
class="peer-focus:font-medium absolute text-sm text-white dark:text-white duration-300 transform -translate-y-6 scale-75 top-3 -z-10 origin-[0] peer-focus:left-0 peer-focus:text-blue-600 peer-focus:dark:text-blue-500 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6">Short
Description (Will be show on home page)</label>
</div>
<div class="relative z-0 mb-6 w-full group">
<select multiple name="tags"
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
required>
<option value="development">Development</option>
<option value="fun">Fun</option>
<option value="media">Media</option>
<option value="company">Company</option>
<option value="game">Game</option>
<option value="emoji">Emoji</option>
<option value="botlist">Bot List</option>
<option value="serverlist">Server List</option>
<option value="turkish">Turkish</option>
<option value="support">Support</option>
<option value="sound">Sound</option>
<option value="chatting">Chatting</option>
<option value="nsfw">NSFW</option>
<option value="challange">Challange</option>
</select>
</div>
<button type="submit"
class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">Update</button>
</form>
</div>
+5 -8
View File
@@ -1,22 +1,19 @@
<%- include('../includes/header.ejs', { title: server.name}) %>
<br><br><br><br><br>
<br><br><br><br>
<div class="flex space-x-4 py-2 lg:h-5/6 sm:min-h-min">
<div class="p-10 bg-blue-color w-2/3 text-white h-full m-4 mx-14">
<%= server.description %>
<%= server.long_description %>
</div>
<div class="bg-blue-color w-1/3 p-10 text-white h-full m-4 text-center">
<div class="bg-blue-color w-1/4 p-10 text-white h-full m-4 ">
<h1 class="text-3xl">
<%= server.name %>
</h1>
<!-- owners -->
<a href="/server/<%= server.id %>/join" class="btn btn-BotsCord float-right" data-tooltip title="Join the server" data-placement="auto"><i class="fa fa-link"></i>
<a href="/server/<%= server.id %>/join" class="button float-right"><i class="fa fa-link"></i>
Join</a>
<% if(user) { if(serverr.members.cache.get(user.id)) {
if(serverr.members.cache.get(user.id).permissions.has('ADMINISTRATOR')) { %>
<div class="h6 mt-4">
<i class="fa fa-user-crown"></i> Owner Options
<i class="fa fa-user-crown"></i>Owner Options
</div>
<a href="/server/<%= server.id %>/edit" class="mt-1">
<div class="box-2-p"><i class="mt-1 fa fa-pencil"></i></div>