mirror of
https://github.com/neongamerbot-qk/hackclub-nest
synced 2024-11-21 16:13:38 +00:00
update: bundle route
This commit is contained in:
parent
95d79f8d59
commit
f159a1a89d
1 changed files with 39 additions and 34 deletions
|
@ -26,7 +26,7 @@ function arrayToCsv(data) {
|
||||||
.map(String) // convert every value to String
|
.map(String) // convert every value to String
|
||||||
.map((v) => v.replaceAll('"', '""')) // escape double quotes
|
.map((v) => v.replaceAll('"', '""')) // escape double quotes
|
||||||
.map((v) => `"${v}"`) // quote it
|
.map((v) => `"${v}"`) // quote it
|
||||||
.join(","), // comma-separated
|
.join(",") // comma-separated
|
||||||
)
|
)
|
||||||
.join("\r\n"); // rows starting on new lines
|
.join("\r\n"); // rows starting on new lines
|
||||||
}
|
}
|
||||||
|
@ -41,10 +41,10 @@ const oauth = new InstallProvider({
|
||||||
stateSecret: process.env.STATE_SECRET,
|
stateSecret: process.env.STATE_SECRET,
|
||||||
stateVerification: false,
|
stateVerification: false,
|
||||||
stateStore: new FileInstallationStore(
|
stateStore: new FileInstallationStore(
|
||||||
path.join(__dirname, "../data/states.json"),
|
path.join(__dirname, "../data/states.json")
|
||||||
),
|
),
|
||||||
installationStore: new FileInstallationStore(
|
installationStore: new FileInstallationStore(
|
||||||
path.join(__dirname, "../data/installations.json"),
|
path.join(__dirname, "../data/installations.json")
|
||||||
),
|
),
|
||||||
// installationStore: {
|
// installationStore: {
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ app.use(
|
||||||
}),
|
}),
|
||||||
saveUninitialized: true,
|
saveUninitialized: true,
|
||||||
cookie: { secure: "auto", maxAge: 1000 * 60 * 60 * 24 * 7 },
|
cookie: { secure: "auto", maxAge: 1000 * 60 * 60 * 24 * 7 },
|
||||||
}),
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -120,7 +120,7 @@ app.get("/login", async (req, res) => {
|
||||||
scopes: [],
|
scopes: [],
|
||||||
|
|
||||||
userScopes: userScopes,
|
userScopes: userScopes,
|
||||||
}),
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -138,7 +138,7 @@ app.get("/slack/callback", (req, res) => {
|
||||||
failure: (err) => {
|
failure: (err) => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
res.send(
|
res.send(
|
||||||
"Failed to install!, please contact neon in the slack!, \n" + err.stack,
|
"Failed to install!, please contact neon in the slack!, \n" + err.stack
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -202,11 +202,16 @@ app.post("/spotify/submitsong", async (req, res) => {
|
||||||
added_at: Date.now(),
|
added_at: Date.now(),
|
||||||
});
|
});
|
||||||
addSongToPlaylist(formattedURI);
|
addSongToPlaylist(formattedURI);
|
||||||
fetch("https://slack.mybot.saahild.com/send-private", {
|
fetch("https://slack.mybot.saahild.com/send-spotify", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
channel: "C07RE4N7S4B",
|
// message: {
|
||||||
text: `:new_spotify: New Song: ${songurl} - added by <@${req.session.info.user.id}>`,
|
// channel: "C07RE4N7S4B",
|
||||||
|
// text: `:new_spotify: New Song: ${songurl} - added by <@${req.session.info.user.id}>`,
|
||||||
|
// },
|
||||||
|
songurl,
|
||||||
|
user: req.session.info.user.id,
|
||||||
|
noping: Boolean(process.env.TESTING),
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: process.env.AUTH_FOR_ZEON,
|
Authorization: process.env.AUTH_FOR_ZEON,
|
||||||
|
@ -215,32 +220,32 @@ app.post("/spotify/submitsong", async (req, res) => {
|
||||||
})
|
})
|
||||||
.then((r) => r.json())
|
.then((r) => r.json())
|
||||||
.then((d) => {
|
.then((d) => {
|
||||||
fetch("https://slack.mybot.saahild.com/send-private", {
|
// fetch("https://slack.mybot.saahild.com/send-private", {
|
||||||
method: "POST",
|
// method: "POST",
|
||||||
body: JSON.stringify({
|
// body: JSON.stringify({
|
||||||
channel: "C07RE4N7S4B",
|
// channel: "C07RE4N7S4B",
|
||||||
thread_ts: d.ts,
|
// thread_ts: d.ts,
|
||||||
text: `:thread: Responses about new song here please!`,
|
// text: `:thread: Responses about new song here please!`,
|
||||||
}),
|
// }),
|
||||||
headers: {
|
// headers: {
|
||||||
Authorization: process.env.AUTH_FOR_ZEON,
|
// Authorization: process.env.AUTH_FOR_ZEON,
|
||||||
"Content-Type": "application/json",
|
// "Content-Type": "application/json",
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
});
|
});
|
||||||
if (!process.env.TESTING) {
|
// if (!process.env.TESTING) {
|
||||||
fetch("https://slack.mybot.saahild.com/send-private", {
|
// fetch("https://slack.mybot.saahild.com/send-private", {
|
||||||
method: "POST",
|
// method: "POST",
|
||||||
body: JSON.stringify({
|
// body: JSON.stringify({
|
||||||
channel: "C07RE4N7S4B",
|
// channel: "C07RE4N7S4B",
|
||||||
text: `<!subteam^S07RGTY93J8>`,
|
// text: `<!subteam^S07RGTY93J8>`,
|
||||||
}),
|
// }),
|
||||||
headers: {
|
// headers: {
|
||||||
Authorization: process.env.AUTH_FOR_ZEON,
|
// Authorization: process.env.AUTH_FOR_ZEON,
|
||||||
"Content-Type": "application/json",
|
// "Content-Type": "application/json",
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
res.redirect("/home?s=1");
|
res.redirect("/home?s=1");
|
||||||
});
|
});
|
||||||
app.get("/spotify/link", async (req, res) => {
|
app.get("/spotify/link", async (req, res) => {
|
||||||
|
|
Loading…
Reference in a new issue