Update
This commit is contained in:
1 parent
2590b5f4c1
commit
c058ab2e55
24 files changed
+270
-114
No files matched your search
+18
-1
@@ -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 => {
|
||||
@@ -31,4 +32,20 @@ client.on('interactionCreate', async interaction => {
|
||||
await interaction.reply(`${user.username}#${user.discriminator} has ${user.bot ? 'a bot' : 'no bot'} and is connected to ${user.guilds.size} servers!`);
|
||||
|
||||
}
|
||||
});
|
||||
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
@@ -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;
|
||||
@@ -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 |
@@ -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"}
|
||||
@@ -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;
|
||||
@@ -33,21 +33,4 @@
|
||||
class="text-blue-400 hover:text-white">Corwin</a>.
|
||||
</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>
|
||||
</footer>
|
||||
@@ -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">
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
|
||||
Reference in new issue
Block a user