').text(`${row.configid} - ${( guild.channels.find( channel => {
return channel.id === row.channel;
} )?.name || row.channel )}`)
).attr('href', `/guild/${guild.id}/rcscript/${row.configid}`);
} ),
( process.env.READONLY || rows.length >= rcgcdwLimit[( guild.patreon ? 'patreon' : 'default' )] ? '' :
$('
').append(
$('
').attr('src', '/src/channel.svg'),
$('').text('New webhook')
).attr('href', `/guild/${guild.id}/rcscript/new`) )
);
if ( args[4] === 'new' ) {
$('.channel#channel-new').addClass('selected');
createForm($, 'New Recent Changes Webhook', {
wiki: defaultSettings.wiki, lang: defaultSettings.lang,
display: 1, patreon: guild.patreon
}, guild.channels).attr('action', `/guild/${guild.id}/rcscript/new`).appendTo('#text');
}
else if ( rows.some( row => row.configid == args[4] ) ) {
let row = rows.find( row => row.configid == args[4] );
$(`.channel#channel-${row.configid}`).addClass('selected');
createForm($, `Recent Changes Webhook #${row.configid}`, Object.assign({
patreon: guild.patreon
}, row), guild.channels).attr('action', `/guild/${guild.id}/rcscript/${row.configid}`).appendTo('#text');
}
else {
$('.channel#rcscript').addClass('selected');
$('#text .description').text(`*Insert explanation about recent changes webhooks here*`);
}
let body = $.html();
res.writeHead(200, {'Content-Length': body.length});
res.write( body );
return res.end();
} );
} );
}
/**
* Change recent changes scripts
* @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.display
* @param {String} [settings.feeds]
* @param {String} [settings.feeds_only]
* @param {String} [settings.save_settings]
* @param {String} [settings.delete_settings]
*/
function update_rcscript(res, user, guild, settings) {
}
module.exports = {
get: dashboard_rcscript,
post: update_rcscript
};