Server side implementation of Allow invites

master
Cristiano Pires 1 year ago
parent f5f84953c9
commit aa7251594b

@ -56,6 +56,7 @@ exports.guildData = (io,bot)=>
id:guild.id,
music:aux.guild?aux.guild.guild[0].music:false,
strikes:aux.guild?aux.guild.guild[0].strikes:false,
allowInvites:aux?.guild?.guild[0]?.allowInvites,
name:guild.name,
icon:guild.icon?`https://cdn.discordapp.com/icons/${guild.id}/${guild.icon}.webp`:'https://cdn3.iconfinder.com/data/icons/popular-services-brands-vol-2/512/discord-512.png',
features:guild.features,
@ -136,13 +137,11 @@ exports.updateGuild = (io)=>
{
return (req, res)=>
{
GuildM.findOne({gID:req.body.guildID})
.then(
(guild, err)=>
{
if(err || guild.length) return res.json({Error:'No guild'});
guild[`${req.body.property}`] =! guild[`${req.body.property}`];
GuildM.updateOne({gID:req.body.guildID}, guild).then(()=>
{

@ -61,12 +61,16 @@ function handleSettigns(event)
popup.classList.remove('hidden');
popup.children[1].textContent = guild.name;
popup.children[1].id = guild.id;
let music = document.getElementById('music')
let music = document.getElementById('music');
music.textContent = guild.music? 'check_box' :'check_box_outline_blank';
let strikes = document.getElementById('strikes')
let strikes = document.getElementById('strikes');
strikes.textContent = guild.strikes? 'check_box' :'check_box_outline_blank';
let allowInvites = document.getElementById('allowInvites');
allowInvites.textContent = guild.allowInvites? 'check_box' : 'check_box_outline_blank';
music.onclick = requestChange;
strikes.onclick = requestChange;
allowInvites.onclick = requestChange;
}
function handleClose(element)
@ -82,7 +86,7 @@ function handleClose(element)
}
async function requestChange()
{
console.log('here')
return await fetch(`${window.location.origin}/api/change`,
{
method: "POST",
@ -101,6 +105,8 @@ async function requestChange()
music.textContent = res.music? 'check_box' :'check_box_outline_blank';
let strikes = document.getElementById('strikes')
strikes.textContent = res.strikes? 'check_box' :'check_box_outline_blank';
let allowInvites = document.getElementById('allowInvites');
allowInvites.textContent = res.allowInvites? 'check_box' : 'check_box_outline_blank';
}
})
.catch(console.error);

@ -44,7 +44,7 @@
info
<span class="tooltip"> Allow invites to other servers on your server.</span>
</span>
<span class="material-symbols-outlined checkBox" id="invites">check_box_outline_blank </span>
<span class="material-symbols-outlined checkBox" id="allowInvites">check_box_outline_blank </span>
</p>
<p id="RoleRules" onclick="handleToggleRules(this)">Role rules</p>
<p id="Feeds" onclick="handleToggleFeeds(this)">Feeds</p>

Loading…
Cancel
Save