Compare commits
2 Commits
0eee329d3a
...
09fd78bd79
Author | SHA1 | Date | |
---|---|---|---|
09fd78bd79 | |||
bb4049ac5e |
@ -29,7 +29,7 @@ client.on("messageCreate", async message => {
|
||||
for (let image of images) {
|
||||
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, name: image.url.split('/').pop()}))});
|
||||
await message.channel.send({files: images.map(image => ({attachment: image.data || "error", name: image.url.split('/').pop()}))});
|
||||
} catch (error) {
|
||||
if (error.message == "Request entity too large") await fallback();
|
||||
else throw error;
|
||||
@ -38,7 +38,9 @@ client.on("messageCreate", async message => {
|
||||
function fallback() {
|
||||
// save the data already downloaded
|
||||
for (let image of images) {
|
||||
try {
|
||||
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'));
|
||||
}
|
||||
|
2
www.js
2
www.js
@ -11,7 +11,7 @@ app.get("/update", (req, res) => {
|
||||
return res.status(400).send("Signature verification failed");
|
||||
let data = JSON.parse(req.query.payload);
|
||||
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) {
|
||||
if (error) return void client.channels.resolve(config.bot_channel)?.send(`git pull: ${error.message}`);
|
||||
child_process.exec("npm install", async function(error) {
|
||||
|
Loading…
Reference in New Issue
Block a user