Compare commits
No commits in common. "097d186f583f20ba47de565e796242856abaec01" and "6926e6c7e51e9aa80da9b30a6a71b83bbcdbaa00" have entirely different histories.
097d186f58
...
6926e6c7e5
@ -2,4 +2,5 @@ FROM node:latest
|
||||
ADD . /app
|
||||
WORKDIR /app
|
||||
RUN npm ci
|
||||
VOLUME /app/data
|
||||
CMD ["node", "main.js"]
|
@ -13,4 +13,6 @@ module.exports = {
|
||||
porn_channel: "835734868427669574",
|
||||
data_dir: process.cwd() + "/data/",
|
||||
web_hostname: "ldb.owo69.me",
|
||||
avatar_cache_dir: "/srv/www/ldb/avatars/",
|
||||
avatar_cache_url: `https://${this.web_hostname}/avatars/`,
|
||||
}
|
@ -3,4 +3,4 @@ cd `dirname "$0"`
|
||||
docker stop ldb
|
||||
docker rm ldb
|
||||
docker build --no-cache -t ledlamp/lampdiscordbot .
|
||||
docker run -d --name ldb --restart=unless-stopped -p 127.0.0.1:9251:9251 --env-file=secrets.env -v /srv/ldb/data:/app/data -v /srv/www/ldb/:/srv/www/ldb/ ledlamp/lampdiscordbot
|
||||
docker run -d --name ldb --restart=unless-stopped -p 127.0.0.1:9251:9251 --env-file=secrets.env -v /srv/www/ldb/:/srv/www/ldb/ ledlamp/lampdiscordbot
|
2
main.js
2
main.js
@ -29,6 +29,6 @@ client.on("guildMemberRemove", member => {
|
||||
|
||||
require('./commands.js');
|
||||
require('./colors.js');
|
||||
global.app = require('./www.js');
|
||||
require('./pinboard.js');
|
||||
global.app = require('./www.js');
|
||||
require('./pixiv-embedder.js');
|
||||
|
@ -1,6 +1,5 @@
|
||||
var fs = require("fs");
|
||||
var fetch = require("node-fetch");
|
||||
|
||||
client.on("messageReactionAdd", async (reaction, user) => {
|
||||
if (reaction.emoji.name == '📍' || reaction.emoji.name == '📌') {
|
||||
if (!reaction.message.guild) return;
|
||||
@ -30,7 +29,7 @@ client.on("messageReactionAdd", async (reaction, user) => {
|
||||
var avatarURL = reaction.message.author.avatarURL({dynamic: true});
|
||||
if (avatarURL) {
|
||||
let afn = avatarURL.split('/').pop();
|
||||
let lapath = config.data_dir + "avatars/" + afn;
|
||||
let lapath = config.avatar_cache_dir + afn;
|
||||
if (!fs.existsSync(lapath)) {
|
||||
try {
|
||||
(await fetch(avatarURL)).body.pipe(fs.createWriteStream(lapath));
|
||||
@ -38,7 +37,7 @@ client.on("messageReactionAdd", async (reaction, user) => {
|
||||
console.error("avatar download", error.message);
|
||||
}
|
||||
}
|
||||
avatarURL = `https://${config.web_hostname}/avatars/${afn}`
|
||||
avatarURL = config.avatar_cache_url + afn;
|
||||
} else avatarURL = reaction.message.author.defaultAvatarURL;
|
||||
|
||||
let imageCandidate = reaction.message.attachments.find(a => [".png",".jpg",".jpeg",".webp",".gif"].some(e => a.url.toLowerCase().endsWith(e)));
|
||||
@ -56,5 +55,3 @@ client.on("messageReactionAdd", async (reaction, user) => {
|
||||
(await client.channels.fetch(config.archive_channel))?.send({content: `https://discord.com/channels/${reaction.message.guild.id}/${reaction.message.channel.id}/${reaction.message.id}`, embeds:[embed]});
|
||||
}
|
||||
});
|
||||
|
||||
app.use("/avatars/", require("express").static(config.data_dir + "avatars/"));
|
||||
|
Loading…
Reference in New Issue
Block a user