Compare commits
2 Commits
400e78b319
...
a73f824203
Author | SHA1 | Date | |
---|---|---|---|
a73f824203 | |||
519e37a06b |
@ -7,7 +7,7 @@ client.on("guildMemberAdd", async function (member) {
|
|||||||
}}));
|
}}));
|
||||||
});
|
});
|
||||||
client.on("userUpdate", async function (oldUser, user) {
|
client.on("userUpdate", async function (oldUser, user) {
|
||||||
var colorRole = client.guilds.resolve("672956423545815040")?.members.resolve(user)?.roles.color;
|
var colorRole = client.guilds.resolve(config.guild)?.members.resolve(user)?.roles.color;
|
||||||
if (!colorRole) return;
|
if (!colorRole) return;
|
||||||
if (oldUser.username != user.username) await colorRole.setName(user.username);
|
if (oldUser.username != user.username) await colorRole.setName(user.username);
|
||||||
if (oldUser.avatar != user.avatar) {
|
if (oldUser.avatar != user.avatar) {
|
||||||
|
44
commands.js
Normal file
44
commands.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
client.on("message", async function (message) {
|
||||||
|
|
||||||
|
let match = message.content.match(/^!(.*?)(?: (.*))?$/i);
|
||||||
|
if (!match) return;
|
||||||
|
|
||||||
|
let [content, cmd, query] = match;
|
||||||
|
let say = message.channel.send.bind(message.channel);
|
||||||
|
|
||||||
|
switch (cmd) {
|
||||||
|
case "ping": return void say("pong");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!message.member?.roles.cache.has(config.admin_role)) return;
|
||||||
|
|
||||||
|
if (message.content.startsWith("!>")) {
|
||||||
|
with (message) {
|
||||||
|
try {
|
||||||
|
var x = await eval(message.content.substr(2).trim());
|
||||||
|
} catch(e) {
|
||||||
|
var x = e.message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (typeof x == "undefined") return void await message.react(config.eval_undefined_emoji);
|
||||||
|
let t = typeof x == 'string' ? 'txt' : 'js';
|
||||||
|
if (typeof x != 'string' && typeof x != "function") x = require('util').inspect(x, {depth: 1});
|
||||||
|
message.channel.send(`\`\`\`${t}\n${x}\`\`\``, {split:{maxLength:2000,prepend:`\`\`\`${t}\n`,append:'```'}});
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (message.content.startsWith("!$")) {
|
||||||
|
let cp = require("child_process").spawn("bash", ["-c", message.content.substr(2).trim()]);
|
||||||
|
cp.stdout.on("data", data => {
|
||||||
|
message.channel.send(data.toString(), {split:{char:'\n',length:2000}}).catch(()=>{
|
||||||
|
message.channel.send(data.toString(), {split:{char:'',length:2000}});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
cp.stderr.on("data", data => {
|
||||||
|
message.channel.send(data.toString(), {split:{char:'\n',length:2000}}).catch(()=>{
|
||||||
|
message.channel.send(data.toString(), {split:{char:'',length:2000}});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
@ -1,27 +0,0 @@
|
|||||||
module.exports = class extends Akairo.Command {
|
|
||||||
constructor() {
|
|
||||||
super("eval", {
|
|
||||||
aliases: ["eval", ">"],
|
|
||||||
ownerOnly: true,
|
|
||||||
args: [{id:'code',match:'content'}]
|
|
||||||
})
|
|
||||||
}
|
|
||||||
exec (message, args) {
|
|
||||||
return exec(message, args)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
async function exec (message, args) {
|
|
||||||
with (message) {
|
|
||||||
try {
|
|
||||||
var x = await eval(args.code)
|
|
||||||
} catch(e) {
|
|
||||||
var x = e.message
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof x == "undefined") return void await message.react('707729833601531935');
|
|
||||||
let t = typeof x == 'string' ? 'txt' : 'js';
|
|
||||||
if (typeof x != 'string' && typeof x != "function") x = require('util').inspect(x, {depth: 1})
|
|
||||||
await message.channel.send(`\`\`\`${t}\n${x}\`\`\``, {split:{maxLength:2000,prepend:`\`\`\`${t}\n`,append:'```'}})
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
|||||||
module.exports = class extends Akairo.Command {
|
|
||||||
constructor() {
|
|
||||||
super("exec", {
|
|
||||||
aliases: ["exec", "$"],
|
|
||||||
ownerOnly: true,
|
|
||||||
args: [{id:'command',match:'content'}]
|
|
||||||
})
|
|
||||||
}
|
|
||||||
exec (message, args) {
|
|
||||||
var cp = require("child_process").spawn("bash", ["-c", args.command]);
|
|
||||||
cp.stdout.on("data", data => {
|
|
||||||
message.channel.send(data.toString(), {split:{char:'\n',length:2000}}).catch(()=>{
|
|
||||||
message.channel.send(data.toString(), {split:{char:'',length:2000}})
|
|
||||||
});
|
|
||||||
});
|
|
||||||
cp.stderr.on("data", data => {
|
|
||||||
message.channel.send(data.toString(), {split:{char:'\n',length:2000}}).catch(()=>{
|
|
||||||
message.channel.send(data.toString(), {split:{char:'',length:2000}})
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
const { Command } = require('discord-akairo');
|
|
||||||
|
|
||||||
class PingCommand extends Command {
|
|
||||||
constructor() {
|
|
||||||
super('ping', {
|
|
||||||
aliases: ['ping']
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
exec(message) {
|
|
||||||
return message.reply('Pong!');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = PingCommand;
|
|
13
config.js
Normal file
13
config.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
module.exports = {
|
||||||
|
token: process.env.TOKEN,
|
||||||
|
guild: "672956423545815040",
|
||||||
|
admin_role: "776899554603565116",
|
||||||
|
human_role: "672956630962274306",
|
||||||
|
bot_role: "673671040010027034",
|
||||||
|
eval_undefined_emoji: "707729833601531935",
|
||||||
|
archive_channel: "802280618636869663",
|
||||||
|
porn_channel: "835734868427669574",
|
||||||
|
avatar_cache_dir: "/srv/www/ldb/avatars/",
|
||||||
|
avatar_cache_url: "https://ldb.owo69.me/avatars/",
|
||||||
|
|
||||||
|
}
|
@ -1,11 +0,0 @@
|
|||||||
module.exports = class extends Akairo.Listener {
|
|
||||||
constructor() {
|
|
||||||
super("rolesort", {
|
|
||||||
emitter: "client",
|
|
||||||
event: "guildMemberAdd"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
async exec (member) {
|
|
||||||
await member.roles.add(member.user.bot ? "673671040010027034" : "672956630962274306")
|
|
||||||
}
|
|
||||||
}
|
|
26
main.js
26
main.js
@ -1,25 +1,17 @@
|
|||||||
global.Discord = require("discord.js")
|
global.config = require("./config");
|
||||||
global.Akairo = require("discord-akairo")
|
global.Discord = require("discord.js");
|
||||||
|
|
||||||
global.client = new Akairo.AkairoClient({
|
global.client = new Discord.Client({
|
||||||
ownerID: ["330499035419115522", "707359017252683896"]
|
|
||||||
},{
|
|
||||||
disableMentions: "everyone",
|
disableMentions: "everyone",
|
||||||
partials: ['MESSAGE','REACTION'],
|
partials: ['MESSAGE','REACTION'],
|
||||||
fetchAllMembers: true
|
fetchAllMembers: true
|
||||||
})
|
});
|
||||||
client.login(process.env.TOKEN).then(() => console.log("ready"))
|
client.login(config.token).then(() => console.log("ready"));
|
||||||
|
|
||||||
client.commandHandler = new Akairo.CommandHandler(client, {
|
client.on("guildMemberAdd", member => {
|
||||||
directory: "commands"
|
member.guild.id == config.guild && member.roles.add(member.user.bot ? config.bot_role : config.human_role)
|
||||||
})
|
});
|
||||||
client.commandHandler.loadAll()
|
|
||||||
client.listenerHandler = new Akairo.ListenerHandler(client, {
|
|
||||||
directory: "listeners"
|
|
||||||
})
|
|
||||||
client.commandHandler.useListenerHandler(this.listenerHandler)
|
|
||||||
client.listenerHandler.loadAll()
|
|
||||||
|
|
||||||
// fuck akairo
|
require('./commands.js');
|
||||||
require('./colors.js');
|
require('./colors.js');
|
||||||
require('./pinboard.js');
|
require('./pinboard.js');
|
16
nginx.conf
16
nginx.conf
@ -1,16 +0,0 @@
|
|||||||
server {
|
|
||||||
server_name ldb.owo69.me;
|
|
||||||
listen 443 ssl;
|
|
||||||
listen [::]:443 ssl;
|
|
||||||
|
|
||||||
ssl_certificate /etc/letsencrypt/live/owo69.me/fullchain.pem;
|
|
||||||
ssl_certificate_key /etc/letsencrypt/live/owo69.me/privkey.pem;
|
|
||||||
include /etc/letsencrypt/options-ssl-nginx.conf;
|
|
||||||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
|
||||||
|
|
||||||
root /srv/www/ldb/;
|
|
||||||
location / {
|
|
||||||
autoindex on;
|
|
||||||
try_files $uri $uri/ =404;
|
|
||||||
}
|
|
||||||
}
|
|
24
package-lock.json
generated
24
package-lock.json
generated
@ -5,7 +5,6 @@
|
|||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"discord-akairo": "^8.1.0",
|
|
||||||
"discord.js": "^12.5.3",
|
"discord.js": "^12.5.3",
|
||||||
"fast-average-color-node": "^1.0.3"
|
"fast-average-color-node": "^1.0.3"
|
||||||
}
|
}
|
||||||
@ -222,15 +221,11 @@
|
|||||||
"node": ">=0.10"
|
"node": ">=0.10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/discord-akairo": {
|
|
||||||
"version": "8.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/discord-akairo/-/discord-akairo-8.1.0.tgz",
|
|
||||||
"integrity": "sha512-INWYmHo6NgyYx1ZKGSCmgznVfvkXpWGj4fGCGjO8IPkZ06Bidb9YKr4rXy2lwG0kprCjvqY0qbbhcw6N050abQ=="
|
|
||||||
},
|
|
||||||
"node_modules/discord.js": {
|
"node_modules/discord.js": {
|
||||||
"version": "12.5.3",
|
"version": "12.5.3",
|
||||||
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-12.5.3.tgz",
|
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-12.5.3.tgz",
|
||||||
"integrity": "sha512-D3nkOa/pCkNyn6jLZnAiJApw2N9XrIsXUAdThf01i7yrEuqUmDGc7/CexVWwEcgbQR97XQ+mcnqJpmJ/92B4Aw==",
|
"integrity": "sha512-D3nkOa/pCkNyn6jLZnAiJApw2N9XrIsXUAdThf01i7yrEuqUmDGc7/CexVWwEcgbQR97XQ+mcnqJpmJ/92B4Aw==",
|
||||||
|
"deprecated": "no longer supported",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordjs/collection": "^0.1.6",
|
"@discordjs/collection": "^0.1.6",
|
||||||
"@discordjs/form-data": "^3.0.1",
|
"@discordjs/form-data": "^3.0.1",
|
||||||
@ -707,9 +702,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/tar": {
|
"node_modules/tar": {
|
||||||
"version": "6.1.0",
|
"version": "6.1.8",
|
||||||
"resolved": "https://registry.npmjs.org/tar/-/tar-6.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/tar/-/tar-6.1.8.tgz",
|
||||||
"integrity": "sha512-DUCttfhsnLCjwoDoFcI+B2iJgYa93vBnDUATYEeRx6sntCTdN01VnqsIuTlALXla/LWooNg0yEGeB+Y8WdFxGA==",
|
"integrity": "sha512-sb9b0cp855NbkMJcskdSYA7b11Q8JsX4qe4pyUAfHp+Y6jBjJeek2ZVlwEfWayshEIwlIzXx0Fain3QG9JPm2A==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chownr": "^2.0.0",
|
"chownr": "^2.0.0",
|
||||||
"fs-minipass": "^2.0.0",
|
"fs-minipass": "^2.0.0",
|
||||||
@ -936,11 +931,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz",
|
||||||
"integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups="
|
"integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups="
|
||||||
},
|
},
|
||||||
"discord-akairo": {
|
|
||||||
"version": "8.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/discord-akairo/-/discord-akairo-8.1.0.tgz",
|
|
||||||
"integrity": "sha512-INWYmHo6NgyYx1ZKGSCmgznVfvkXpWGj4fGCGjO8IPkZ06Bidb9YKr4rXy2lwG0kprCjvqY0qbbhcw6N050abQ=="
|
|
||||||
},
|
|
||||||
"discord.js": {
|
"discord.js": {
|
||||||
"version": "12.5.3",
|
"version": "12.5.3",
|
||||||
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-12.5.3.tgz",
|
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-12.5.3.tgz",
|
||||||
@ -1288,9 +1278,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tar": {
|
"tar": {
|
||||||
"version": "6.1.0",
|
"version": "6.1.8",
|
||||||
"resolved": "https://registry.npmjs.org/tar/-/tar-6.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/tar/-/tar-6.1.8.tgz",
|
||||||
"integrity": "sha512-DUCttfhsnLCjwoDoFcI+B2iJgYa93vBnDUATYEeRx6sntCTdN01VnqsIuTlALXla/LWooNg0yEGeB+Y8WdFxGA==",
|
"integrity": "sha512-sb9b0cp855NbkMJcskdSYA7b11Q8JsX4qe4pyUAfHp+Y6jBjJeek2ZVlwEfWayshEIwlIzXx0Fain3QG9JPm2A==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"chownr": "^2.0.0",
|
"chownr": "^2.0.0",
|
||||||
"fs-minipass": "^2.0.0",
|
"fs-minipass": "^2.0.0",
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"discord-akairo": "^8.1.0",
|
|
||||||
"discord.js": "^12.5.3",
|
"discord.js": "^12.5.3",
|
||||||
"fast-average-color-node": "^1.0.3"
|
"fast-average-color-node": "^1.0.3"
|
||||||
}
|
}
|
||||||
|
10
pinboard.js
10
pinboard.js
@ -3,11 +3,11 @@ var fetch = require("node-fetch");
|
|||||||
client.on("messageReactionAdd", async (reaction, user) => {
|
client.on("messageReactionAdd", async (reaction, user) => {
|
||||||
if (reaction.emoji.name == '📍' || reaction.emoji.name == '📌') {
|
if (reaction.emoji.name == '📍' || reaction.emoji.name == '📌') {
|
||||||
if (!reaction.message.guild) return;
|
if (!reaction.message.guild) return;
|
||||||
if (reaction.message.channel.id == '802280618636869663') return;
|
if (reaction.message.channel.id == config.archive_channel) return;
|
||||||
if (reaction.message['has been "pinned"'] || reaction.count > 1) return;
|
if (reaction.message['has been "pinned"'] || reaction.count > 1) return;
|
||||||
reaction.message['has been "pinned"'] = true;
|
reaction.message['has been "pinned"'] = true;
|
||||||
|
|
||||||
if (reaction.message.channel.id == "835734868427669574") {
|
if (reaction.message.channel.id == config.porn_channel) {
|
||||||
try {
|
try {
|
||||||
await reaction.message.pin();
|
await reaction.message.pin();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -29,7 +29,7 @@ client.on("messageReactionAdd", async (reaction, user) => {
|
|||||||
var avatarURL = reaction.message.author.avatarURL({dynamic: true});
|
var avatarURL = reaction.message.author.avatarURL({dynamic: true});
|
||||||
if (avatarURL) {
|
if (avatarURL) {
|
||||||
let afn = avatarURL.split('/').pop();
|
let afn = avatarURL.split('/').pop();
|
||||||
let lapath = `/srv/www/ldb/avatars/${afn}`;
|
let lapath = config.avatar_cache_dir + afn;
|
||||||
if (!fs.existsSync(lapath)) {
|
if (!fs.existsSync(lapath)) {
|
||||||
try {
|
try {
|
||||||
(await fetch(avatarURL)).body.pipe(fs.createWriteStream(lapath));
|
(await fetch(avatarURL)).body.pipe(fs.createWriteStream(lapath));
|
||||||
@ -37,7 +37,7 @@ client.on("messageReactionAdd", async (reaction, user) => {
|
|||||||
console.error("avatar download", error.message);
|
console.error("avatar download", error.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
avatarURL = `https://ldb.owo69.me/avatars/${afn}`;
|
avatarURL = config.avatar_cache_url + afn;
|
||||||
} else avatarURL = reaction.message.author.defaultAvatarURL;
|
} 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)));
|
let imageCandidate = reaction.message.attachments.find(a => [".png",".jpg",".jpeg",".webp",".gif"].some(e => a.url.toLowerCase().endsWith(e)));
|
||||||
@ -52,6 +52,6 @@ client.on("messageReactionAdd", async (reaction, user) => {
|
|||||||
.setColor(reaction.message.member?.roles.color?.color);
|
.setColor(reaction.message.member?.roles.color?.color);
|
||||||
let attachments = reaction.message.attachments.filter(a => !a["will be used for the image of the embed"]).map(a => `[${a.name}](${a.url})`).join('\n');
|
let attachments = reaction.message.attachments.filter(a => !a["will be used for the image of the embed"]).map(a => `[${a.name}](${a.url})`).join('\n');
|
||||||
if (attachments) embed.addField("Attachments", attachments);
|
if (attachments) embed.addField("Attachments", attachments);
|
||||||
(await client.channels.fetch('802280618636869663'))?.send(`https://discord.com/channels/${reaction.message.guild.id}/${reaction.message.channel.id}/${reaction.message.id}`, embed);
|
(await client.channels.fetch(config.archive_channel))?.send(`https://discord.com/channels/${reaction.message.guild.id}/${reaction.message.channel.id}/${reaction.message.id}`, embed);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1 +0,0 @@
|
|||||||
This program is hard-coded for my discord server (environment stuff such as ids are directly in src)
|
|
Loading…
x
Reference in New Issue
Block a user