Compare commits
3 Commits
d147167682
...
14ec1867d5
Author | SHA1 | Date | |
---|---|---|---|
14ec1867d5 | |||
7ff1e84f21 | |||
083095e636 |
@ -1,10 +1,10 @@
|
|||||||
client.on("guildMemberAdd", async function (member) {
|
client.on("guildMemberAdd", async function (member) {
|
||||||
member.roles.add(await member.guild.roles.create({data:{
|
member.roles.add(await member.guild.roles.create({
|
||||||
name: member.user.username,
|
name: member.user.username,
|
||||||
color: await user2color(member.user) || "#FF0000",
|
color: await user2color(member.user) || "#FF0000",
|
||||||
mentionable: true,
|
mentionable: true,
|
||||||
permissions: 0
|
permissions: 0
|
||||||
}}));
|
}));
|
||||||
});
|
});
|
||||||
client.on("userUpdate", async function (oldUser, user) {
|
client.on("userUpdate", async function (oldUser, user) {
|
||||||
var colorRole = client.guilds.resolve(config.guild)?.members.resolve(user)?.roles.color;
|
var colorRole = client.guilds.resolve(config.guild)?.members.resolve(user)?.roles.color;
|
||||||
|
29
commands.js
29
commands.js
@ -29,21 +29,28 @@ client.on("messageCreate", async function (message) {
|
|||||||
if (typeof x == "undefined") return void await message.react(config.eval_undefined_emoji);
|
if (typeof x == "undefined") return void await message.react(config.eval_undefined_emoji);
|
||||||
let t = typeof x == 'string' ? 'txt' : 'js';
|
let t = typeof x == 'string' ? 'txt' : 'js';
|
||||||
if (typeof x != 'string' && typeof x != "function") x = require('util').inspect(x, {depth: 1});
|
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:'```'}});
|
let cb = `\`\`\`${t}\n${x}\`\`\``;
|
||||||
|
if (cb.length <= 2000)
|
||||||
|
message.channel.send(cb);
|
||||||
|
else
|
||||||
|
message.channel.send({files:[{
|
||||||
|
attachment: Buffer.from(x),
|
||||||
|
name: `output.${t}`
|
||||||
|
}]});
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (message.content.startsWith("!$")) {
|
else if (message.content.startsWith("!$")) {
|
||||||
let cp = require("child_process").spawn("bash", ["-c", message.content.substr(2).trim()]);
|
let cp = require("child_process").spawn("bash", ["-c", message.content.substr(2).trim()]);
|
||||||
cp.stdout.on("data", data => {
|
function ondat(a) {
|
||||||
message.channel.send(data.toString(), {split:{char:'\n',length:2000}}).catch(()=>{
|
try {
|
||||||
message.channel.send(data.toString(), {split:{char:'',length:2000}});
|
var split = Discord.Util.splitMessage(a.toString(), {split:{char:'\n',length:2000}});
|
||||||
});
|
} catch(x) {
|
||||||
});
|
var split = Discord.Util.splitMessage(a.toString(), {split:{char:'',length:2000}});
|
||||||
cp.stderr.on("data", data => {
|
}
|
||||||
message.channel.send(data.toString(), {split:{char:'\n',length:2000}}).catch(()=>{
|
split.forEach(say);
|
||||||
message.channel.send(data.toString(), {split:{char:'',length:2000}});
|
}
|
||||||
});
|
cp.stdout.on("data", ondat);
|
||||||
});
|
cp.stderr.on("data", ondat);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
@ -5,9 +5,9 @@ module.exports = {
|
|||||||
human_role: "672956630962274306",
|
human_role: "672956630962274306",
|
||||||
bot_role: "673671040010027034",
|
bot_role: "673671040010027034",
|
||||||
eval_undefined_emoji: "707729833601531935",
|
eval_undefined_emoji: "707729833601531935",
|
||||||
|
default_channel: "672956424162115586",
|
||||||
archive_channel: "802280618636869663",
|
archive_channel: "802280618636869663",
|
||||||
porn_channel: "835734868427669574",
|
porn_channel: "835734868427669574",
|
||||||
avatar_cache_dir: "/srv/www/ldb/avatars/",
|
avatar_cache_dir: "/srv/www/ldb/avatars/",
|
||||||
avatar_cache_url: "https://ldb.owo69.me/avatars/",
|
avatar_cache_url: "https://ldb.owo69.me/avatars/",
|
||||||
|
|
||||||
}
|
}
|
18
main.js
18
main.js
@ -1,3 +1,4 @@
|
|||||||
|
require("./util.js");
|
||||||
global.config = require("./config");
|
global.config = require("./config");
|
||||||
global.Discord = require("discord.js");
|
global.Discord = require("discord.js");
|
||||||
|
|
||||||
@ -8,7 +9,22 @@ global.client = new Discord.Client({
|
|||||||
client.login(config.token).then(() => console.log("ready"));
|
client.login(config.token).then(() => console.log("ready"));
|
||||||
|
|
||||||
client.on("guildMemberAdd", member => {
|
client.on("guildMemberAdd", member => {
|
||||||
member.guild.id == config.guild && member.roles.add(member.user.bot ? config.bot_role : config.human_role)
|
if (member.guild.id != config.guild) return;
|
||||||
|
member.roles.add(member.user.bot ? config.bot_role : config.human_role);
|
||||||
|
client.channels.resolve(config.default_channel)?.send(random([
|
||||||
|
`${member.user.username} join`,
|
||||||
|
`${member.user.username} joined`,
|
||||||
|
`${member.user.username} appear`,
|
||||||
|
`${member.user.username.toLowerCase()} here`
|
||||||
|
]));
|
||||||
|
});
|
||||||
|
client.on("guildMemberRemove", member => {
|
||||||
|
if (member.guild.id != config.guild) return;
|
||||||
|
client.channels.resolve(config.default_channel)?.send(random([
|
||||||
|
`${member.user.username} left`,
|
||||||
|
`${member.user.username} disappear`,
|
||||||
|
`${member.user.username.toLowerCase()} gone`
|
||||||
|
]));
|
||||||
});
|
});
|
||||||
|
|
||||||
require('./commands.js');
|
require('./commands.js');
|
||||||
|
Loading…
Reference in New Issue
Block a user