').text(channel.name)
).attr('href', `/guild/${guild.id}/settings/${channel.id}`).attr('title', channel.id);
} ),
( process.env.READONLY || !guild.channels.filter( channel => {
return ( hasPerm(channel.permissions, 'VIEW_CHANNEL', 'SEND_MESSAGES') && !rows.some( row => row.channel === channel.id ) );
} ).length ? '' :
$('
').append(
$('
').attr('src', '/src/channel.svg'),
$('').text('New channel overwrite')
).attr('href', `/guild/${guild.id}/settings/new`) )
);
if ( args[4] === 'new' ) {
$('.channel#channel-new').addClass('selected');
createForm($, 'New Channel Overwrite', Object.assign({}, rows.find( row => !row.channel ), {
patreon: isPatreon,
channel: 'new'
}), guild.channels.filter( channel => {
return ( hasPerm(channel.permissions, 'VIEW_CHANNEL', 'SEND_MESSAGES') && !rows.some( row => row.channel === channel.id ) );
} )).attr('action', `/guild/${guild.id}/settings/new`).appendTo('#text');
}
else if ( channellist.some( channel => channel.id === args[4] ) ) {
let channel = channellist.find( channel => channel.id === args[4] );
$(`.channel#channel-${channel.id}`).addClass('selected');
createForm($, `#${channel.name} Settings`, Object.assign({}, rows.find( row => {
return row.channel === channel.id;
} ), {
patreon: isPatreon
}), [channel]).attr('action', `/guild/${guild.id}/settings/${channel.id}`).appendTo('#text');
}
else {
$('.channel#settings').addClass('selected');
createForm($, 'Server-wide Settings', rows.find( row => !row.channel )).attr('action', `/guild/${guild.id}/settings/default`).appendTo('#text');
}
let body = $.html();
res.writeHead(200, {'Content-Length': body.length});
res.write( body );
return res.end();
} );
}
/**
* Change settings
* @param {import('http').ServerResponse} res - The server response
* @param {String} user - The id of the user
* @param {String} guild - The id of the guild
* @param {Object} settings - The new settings
* @param {String} [settings.channel]
* @param {String} settings.wiki
* @param {String} [settings.lang]
* @param {String} [settings.inline]
* @param {String} [settings.prefix]
* @param {String} [settings.prefix_space]
* @param {String} [settings.voice]
* @param {String} [settings.save_settings]
* @param {String} [settings.delete_settings]
*/
function update_settings(res, user, guild, settings) {
}
module.exports = {
get: dashboard_settings,
post: update_settings
};