Compare commits
No commits in common. "14ec1867d5ea53c27802f0db513d4e5c01235f47" and "d147167682fd54d2005f6de8936e541db09f843e" have entirely different histories.
14ec1867d5
...
d147167682
@ -1,10 +1,10 @@
|
||||
client.on("guildMemberAdd", async function (member) {
|
||||
member.roles.add(await member.guild.roles.create({
|
||||
member.roles.add(await member.guild.roles.create({data:{
|
||||
name: member.user.username,
|
||||
color: await user2color(member.user) || "#FF0000",
|
||||
mentionable: true,
|
||||
permissions: 0
|
||||
}));
|
||||
}}));
|
||||
});
|
||||
client.on("userUpdate", async function (oldUser, user) {
|
||||
var colorRole = client.guilds.resolve(config.guild)?.members.resolve(user)?.roles.color;
|
||||
|
29
commands.js
29
commands.js
@ -29,28 +29,21 @@ client.on("messageCreate", async function (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});
|
||||
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}`
|
||||
}]});
|
||||
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()]);
|
||||
function ondat(a) {
|
||||
try {
|
||||
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}});
|
||||
}
|
||||
split.forEach(say);
|
||||
}
|
||||
cp.stdout.on("data", ondat);
|
||||
cp.stderr.on("data", ondat);
|
||||
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}});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
});
|
@ -5,9 +5,9 @@ module.exports = {
|
||||
human_role: "672956630962274306",
|
||||
bot_role: "673671040010027034",
|
||||
eval_undefined_emoji: "707729833601531935",
|
||||
default_channel: "672956424162115586",
|
||||
archive_channel: "802280618636869663",
|
||||
porn_channel: "835734868427669574",
|
||||
avatar_cache_dir: "/srv/www/ldb/avatars/",
|
||||
avatar_cache_url: "https://ldb.owo69.me/avatars/",
|
||||
|
||||
}
|
18
main.js
18
main.js
@ -1,4 +1,3 @@
|
||||
require("./util.js");
|
||||
global.config = require("./config");
|
||||
global.Discord = require("discord.js");
|
||||
|
||||
@ -9,22 +8,7 @@ global.client = new Discord.Client({
|
||||
client.login(config.token).then(() => console.log("ready"));
|
||||
|
||||
client.on("guildMemberAdd", member => {
|
||||
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`
|
||||
]));
|
||||
member.guild.id == config.guild && member.roles.add(member.user.bot ? config.bot_role : config.human_role)
|
||||
});
|
||||
|
||||
require('./commands.js');
|
||||
|
Loading…
Reference in New Issue
Block a user