rcscript.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. const {db, settingsData, sendMsg, createNotice, hasPerm} = require('./util.js');
  2. /**
  3. * Let a user change recent changes scripts
  4. * @param {import('http').ServerResponse} res - The server response
  5. * @param {CheerioStatic} $ - The response body
  6. * @param {import('./util.js').Guild} guild - The current guild
  7. * @param {String[]} args - The url parts
  8. */
  9. function dashboard_rcscript(res, $, guild, args) {
  10. $('.channel#rcgcdb').addClass('selected');
  11. db.all( 'SELECT configid, wiki, lang, display, wikiid, rcid FROM rcgcdw WHERE guild = ? ORDER BY configid ASC', [guild.id], function(dberror, rows) {
  12. if ( dberror ) {
  13. console.log( '- Dashboard: Error while getting the RcGcDw: ' + dberror );
  14. $('#text .description').text('Failed to load the recent changes webhooks!');
  15. let body = $.html();
  16. res.writeHead(200, {'Content-Length': body.length});
  17. res.write( body );
  18. return res.end();
  19. }
  20. $('<pre>').text(JSON.stringify(rows, null, '\t')).appendTo('#text .description');
  21. let body = $.html();
  22. res.writeHead(200, {'Content-Length': body.length});
  23. res.write( body );
  24. return res.end();
  25. } );
  26. }
  27. function update_rcscript() {
  28. }
  29. module.exports = {
  30. get: dashboard_rcscript,
  31. post: update_rcscript
  32. };