link.js 1008 B

123456789101112131415161718192021222324252627282930313233
  1. const check_wiki = {
  2. fandom: require('./wiki/fandom/general.js'),
  3. general: require('./wiki/general.js'),
  4. test: require('./test.js').run
  5. };
  6. const help_setup = require('../functions/helpsetup.js');
  7. /**
  8. * Processes the wiki linking command.
  9. * @param {import('../util/i18n.js')} lang - The user language.
  10. * @param {import('discord.js').Message} msg - The Discord message.
  11. * @param {String} title - The page title.
  12. * @param {import('../util/wiki.js')} wiki - The wiki for the page.
  13. * @param {String} [cmd] - The command at this point.
  14. */
  15. function cmd_link(lang, msg, title, wiki, cmd = '') {
  16. if ( msg.isAdmin() && msg.defaultSettings ) help_setup(lang, msg);
  17. if ( /^\|\|(?:(?!\|\|).)+\|\|$/.test(title) ) {
  18. title = title.substring( 2, title.length - 2);
  19. var spoiler = '||';
  20. }
  21. msg.reactEmoji('⏳').then( reaction => {
  22. check_wiki.general(lang, msg, title, wiki, cmd, reaction, spoiler);
  23. } );
  24. }
  25. module.exports = {
  26. name: 'LINK',
  27. everyone: true,
  28. pause: false,
  29. owner: true,
  30. run: cmd_link
  31. };