Compare commits
No commits in common. "09fd78bd79f4960a56ca6b60a5f3fbdbf9ec57aa" and "0eee329d3a31f83d084231bffb6ce3e8d0693953" have entirely different histories.
09fd78bd79
...
0eee329d3a
@ -29,7 +29,7 @@ client.on("messageCreate", async message => {
|
|||||||
for (let image of images) {
|
for (let image of images) {
|
||||||
image.data = await (await fetch(image.url, {headers: {"Referer": "https://www.pixiv.net/"}})).buffer();
|
image.data = await (await fetch(image.url, {headers: {"Referer": "https://www.pixiv.net/"}})).buffer();
|
||||||
}
|
}
|
||||||
await message.channel.send({files: images.map(image => ({attachment: image.data || "error", name: image.url.split('/').pop()}))});
|
await message.channel.send({files: images.map(image => ({attachment: image.data, name: image.url.split('/').pop()}))});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.message == "Request entity too large") await fallback();
|
if (error.message == "Request entity too large") await fallback();
|
||||||
else throw error;
|
else throw error;
|
||||||
@ -38,9 +38,7 @@ client.on("messageCreate", async message => {
|
|||||||
function fallback() {
|
function fallback() {
|
||||||
// save the data already downloaded
|
// save the data already downloaded
|
||||||
for (let image of images) {
|
for (let image of images) {
|
||||||
try {
|
|
||||||
fs.writeFileSync(config.data_dir + "pixiv-cache/" + image.url.split('?')[0].replace(/\//g, '\\'), image.data);
|
fs.writeFileSync(config.data_dir + "pixiv-cache/" + image.url.split('?')[0].replace(/\//g, '\\'), image.data);
|
||||||
} catch(e) { console.error(image, error) }
|
|
||||||
}
|
}
|
||||||
return message.channel.send(images.map(image => image.url.replace("https://i.pximg.net/", `https://${config.web_hostname}/pixiv-proxy/`)).join('\n'));
|
return message.channel.send(images.map(image => image.url.replace("https://i.pximg.net/", `https://${config.web_hostname}/pixiv-proxy/`)).join('\n'));
|
||||||
}
|
}
|
||||||
|
2
www.js
2
www.js
@ -11,7 +11,7 @@ app.get("/update", (req, res) => {
|
|||||||
return res.status(400).send("Signature verification failed");
|
return res.status(400).send("Signature verification failed");
|
||||||
let data = JSON.parse(req.query.payload);
|
let data = JSON.parse(req.query.payload);
|
||||||
res.sendStatus(200);
|
res.sendStatus(200);
|
||||||
if (data.commits.some(commit => commit.message.includes("%%"))) return;
|
if (!data.commits.some(commit => commit.message.includes("!@"))) return;
|
||||||
child_process.exec("git pull", function(error) {
|
child_process.exec("git pull", function(error) {
|
||||||
if (error) return void client.channels.resolve(config.bot_channel)?.send(`git pull: ${error.message}`);
|
if (error) return void client.channels.resolve(config.bot_channel)?.send(`git pull: ${error.message}`);
|
||||||
child_process.exec("npm install", async function(error) {
|
child_process.exec("npm install", async function(error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user