SHARE
TWEET

Untitled

a guest Apr 20th, 2019 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. app.get("/panel/edit/roleh/:id/:user", (req, res) => {
  2.  
  3.       const laid = req.params.id;
  4.       const Auser = req.params.user;
  5.       const Auname = client.users.get(req.params.user).username;
  6.       if (!laid) return res.redirect('/');
  7.  
  8.       if(!req.user) return res.redirect('/');
  9.       let guild = req.user.guilds.find(g => g.id === laid);
  10.       if (!guild) return res.redirect('/');
  11.       var idioma;
  12.       if (req.user.locale === "es-ES") idioma = "ES";
  13.       else idioma = "ENG";
  14.       if (req.user.locale === 0) idioma = "ENG";
  15.  
  16.       mongoose.connect(process.env.mongodb, {
  17.           useNewUrlParser: true
  18.       }, function(error) {
  19.           if (error) {
  20.               console.log(error)
  21.           } else {
  22.               console.log("Connected to DB")
  23.           }
  24.       });
  25.       mongoose.Promise = global.Promise;
  26.       let db = mongoose.connection;
  27.       servers.findOne({
  28.           _id: laid
  29.       }, (err, fd1) => {
  30.           if (!fd1 || err) {
  31.               return res.redirect("https://discordapp.com/oauth2/authorize?client_id=529718901123186708&scope=bot&permissions=8")
  32.           }
  33.           if (idioma === "ES") {
  34.               const welcomec = client.channels.get(fd1.welcomec) ? client.channels.get(fd1.welcomec).name : "Ninguno";
  35.               const goodbyec = client.channels.get(fd1.goodbyec) ? client.channels.get(fd1.goodbyec).name : "Ninguno";
  36.               const logs = client.channels.get(fd1.logs) ? client.channels.get(fd1.logs).name : "Ninguno";
  37.               let roleh = client.guilds.get(laid).roles.get(fd1.roleH) ? client.guilds.get(laid).roles.get(fd1.roleH).name : "Sin rol seleccionado";
  38.               //let roleb = client.guilds.get(laid).roles.get(fd1.roleB) ? client.guilds.get(laid).roles.get(fd1.roleB).name : "Sin rol seleccionado";
  39.               res.render(__dirname + "/views/edit/esp/roleh.ejs", {
  40.                   sv: fd1,
  41.                   id: laid,
  42.                   client: client,
  43.                   logs: logs ,
  44.                   welcomec: welcomec,
  45.                   welcomem: fd1.welcomem || "Por Defecto",
  46.                   goodbyec: goodbyec,
  47.                   goodbyem: fd1.goodbyem || "Por Defecto",
  48.                   prefix: fd1.prefix,
  49.                   user: Auser,
  50.                   uname: Auname,
  51.                   roleh: roleh,
  52.                   //roleb: roleb
  53.               })
  54.           } else if (idioma === "ENG") {
  55.               const welcomec = client.channels.get(fd1.welcomec) ? client.channels.get(fd1.welcomec).name : "deleted-channel";
  56.               const goodbyec = client.channels.get(fd1.goodbyec) ? client.channels.get(fd1.goodbyec).name : "deleted-channel";
  57.               const logs = client.channels.get(fd1.logs) ? client.channels.get(fd1.logs).name : "#deleted-channel";
  58.               let roleh = client.guilds.get(laid).roles.get(fd1.roleH) ? client.guilds.get(laid).roles.get(fd1.roleH).name : "No Role Set";
  59.               //let roleb = client.guilds.get(laid).roles.get(fd1.roleB) ? client.guilds.get(laid).roles.get(fd1.roleB).name : "No Role Set";
  60.               res.render(__dirname + "/views/edit/eng/roleh.ejs", {
  61.                   sv: fd1,
  62.                   id: laid,
  63.                   client: client,
  64.                   logs: logs,
  65.                   welcomec: welcomec,
  66.                   welcomem: fd1.welcomem,
  67.                   goodbyec: goodbyec,
  68.                   goodbyem: fd1.goodbyem,
  69.                   prefix: fd1.prefix,
  70.                   user: Auser,
  71.                   uname: Auname,
  72.                   roleh: roleh,
  73.                   //roleb: roleb
  74.               })
  75.           } else return res.send("FATAL ERROR, PLEASE CONTACT SUPPORT")
  76.       })
  77.   });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top