const {defaultSettings} = require('../util/default.json'); const {allLangs: {names: allLangs}} = require('../i18n/allLangs.json'); const {db, settingsData, sendMsg, createNotice, hasPerm} = require('./util.js'); const fieldset = { channel: '' + '', wiki: '' + '', //+ '' //+ '
' //+ 'Wiki search' //+ '
', lang: '' + '', prefix: '' + '' + '
' + '' + '', inline: '' + '', voice: '' + '', save: '', delete: '' }; /** * Create a settings form * @param {import('cheerio')} $ - The response body * @param {String} header - The form header * @param {Object} settings - The current settings * @param {Boolean} settings.patreon * @param {String} settings.channel * @param {String} settings.wiki * @param {String} settings.lang * @param {Boolean} settings.inline * @param {String} settings.prefix * @param {Boolean} settings.voice * @param {Object[]} guildChannels - The guild channels * @param {String} guildChannels.id * @param {String} guildChannels.name * @param {Number} guildChannels.permissions */ function createForm($, header, settings, guildChannels) { var readonly = ( process.env.READONLY ? true : false ); var fields = []; if ( settings.channel ) { let channel = $('
').append(fieldset.channel); channel.find('#wb-settings-channel').append( ...guildChannels.map( guildChannel => { return $(`