Pepperbot initializing
This commit is contained in:
commit
18c5085262
20 changed files with 2762 additions and 0 deletions
26
src/commands/commands.js
Normal file
26
src/commands/commands.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
const { EmbedBuilder } = require("discord.js");
|
||||
const fs = require("fs");
|
||||
module.exports = {
|
||||
name: "commands",
|
||||
description: "commands list",
|
||||
execute(message, args) {
|
||||
let text = "";
|
||||
|
||||
const commandFiles = fs
|
||||
.readdirSync("src/commands/")
|
||||
.filter((file) => file.endsWith(".js"));
|
||||
for (const file of commandFiles) {
|
||||
const command = require(`./${file}`);
|
||||
text += `p/${command.name} - ${command.description}\n`;
|
||||
}
|
||||
|
||||
const embed = new EmbedBuilder();
|
||||
embed.setTitle("PepperBot Commands");
|
||||
embed.setDescription(text);
|
||||
embed.setColor(0xff0000);
|
||||
embed.setThumbnail(
|
||||
"https://cdn.discordapp.com/attachments/755150633191080073/1149152214850469908/Map_Icon.png"
|
||||
);
|
||||
message.reply({ embeds: [embed] });
|
||||
},
|
||||
};
|
31
src/commands/crash.js
Normal file
31
src/commands/crash.js
Normal file
|
@ -0,0 +1,31 @@
|
|||
const whitelist = ["440163494529073152"];
|
||||
const fs = require("fs");
|
||||
|
||||
module.exports = {
|
||||
name: "crash",
|
||||
description: "crashes the bot (throws an error), requires whitelist",
|
||||
execute(message, args) {
|
||||
if (whitelist.includes(message.author.id)) {
|
||||
message.reply("crashing bot...");
|
||||
fs.appendFileSync(
|
||||
"../pepperbot/src/logs/errors.log",
|
||||
"force crashed at " + Date() + "\n"
|
||||
);
|
||||
throw "crash command executed";
|
||||
} else {
|
||||
message.reply("UNAUTHORIZED");
|
||||
const path = require("path");
|
||||
const scriptName = path.basename(__filename);
|
||||
fs.appendFileSync(
|
||||
"../pepperbot/src/logs/failed.log",
|
||||
"non whitelisted user " +
|
||||
message.author.username +
|
||||
" (" +
|
||||
message.author +
|
||||
") attempted accessing " +
|
||||
scriptName +
|
||||
"\n"
|
||||
);
|
||||
}
|
||||
},
|
||||
};
|
136
src/commands/createreactionrole.js
Normal file
136
src/commands/createreactionrole.js
Normal file
|
@ -0,0 +1,136 @@
|
|||
const { EmbedBuilder } = require("discord.js");
|
||||
const emojiRegex = require("emoji-regex");
|
||||
const irregularsRegex = require("../util/irregularsRegex.js");
|
||||
const irregulars = require("../util/irregulars.json");
|
||||
const fs = require("fs");
|
||||
|
||||
const getEmojis = (message) => {
|
||||
const { content } = message;
|
||||
const result = [];
|
||||
// Normal emojis
|
||||
const normalEmojis = content.match(emojiRegex());
|
||||
if (normalEmojis) {
|
||||
// for (const emoji of normalEmojis) {
|
||||
normalEmojis.forEach((emoji) => {
|
||||
result.push(emoji);
|
||||
});
|
||||
}
|
||||
// Text emojis e.g ♥ ✂ 🗨
|
||||
const textEmojis = content.match(irregularsRegex());
|
||||
if (textEmojis) {
|
||||
textEmojis.forEach((emoji) => {
|
||||
result.push(irregulars[emoji.trim()]);
|
||||
});
|
||||
}
|
||||
// Guild emojis
|
||||
let guildEmojis = content.match(/:[_a-zA-Z0-9]*>/g);
|
||||
if (guildEmojis) {
|
||||
guildEmojis = guildEmojis.map((e) => e.substring(1, e.length - 1));
|
||||
guildEmojis.forEach((e) => {
|
||||
try {
|
||||
const guildEmoji = message.guild.emojis.get(e);
|
||||
if (guildEmoji) {
|
||||
result.push(guildEmoji);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.log("tried using guild emote lmao");
|
||||
}
|
||||
});
|
||||
}
|
||||
// Attempt to sort the results if its not null
|
||||
if (result) {
|
||||
const query = message.content;
|
||||
result.sort((a, b) => {
|
||||
const irregularA = getKeyByValue(irregulars, a);
|
||||
const irregularB = getKeyByValue(irregulars, b);
|
||||
const index1 = irregularA || a;
|
||||
const index2 = irregularB || b;
|
||||
return query.indexOf(index1) - query.indexOf(index2);
|
||||
});
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
let collectors = [];
|
||||
|
||||
const whitelist = ["440163494529073152", "436321340304392222"];
|
||||
|
||||
module.exports = {
|
||||
name: "createreactionrole",
|
||||
description: "creates reaction role, requires whitelist",
|
||||
execute(message, args) {
|
||||
if (whitelist.includes(message.author.id)) {
|
||||
let emojis = getEmojis(message);
|
||||
let emoji = emojis[0];
|
||||
let role = message.mentions.roles.first();
|
||||
if (!role) {
|
||||
console.log("role variable missing");
|
||||
fs.appendFileSync(
|
||||
"../pepperbot/src/logs/failed.log",
|
||||
"role variable missing" +
|
||||
"from: " +
|
||||
message.content +
|
||||
" at " +
|
||||
Date() +
|
||||
"\n"
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (!emoji) {
|
||||
console.log("emoji variable missing");
|
||||
fs.appendFileSync(
|
||||
"../pepperbot/src/logs/failed.log",
|
||||
" emoji variable missing" +
|
||||
"from: " +
|
||||
message.content +
|
||||
" at " +
|
||||
Date() +
|
||||
"\n"
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const embed = new EmbedBuilder();
|
||||
|
||||
embed.setThumbnail(
|
||||
"https://cdn.discordapp.com/attachments/755150633191080073/1149152214850469908/Map_Icon.png"
|
||||
);
|
||||
embed.setColor(0xff0000);
|
||||
|
||||
embed.setTitle(role.name);
|
||||
embed.setDescription(
|
||||
"React with " + emoji + " to recieve the " + role.name + " role."
|
||||
);
|
||||
|
||||
message.channel.send({ embeds: [embed] }).then((m) => m.react(emoji));
|
||||
|
||||
const collectorFilter = function (reaction) {
|
||||
return true;
|
||||
};
|
||||
|
||||
const collector = message.createReactionCollector({
|
||||
filter: collectorFilter,
|
||||
});
|
||||
collectors.push(collector);
|
||||
|
||||
collector.on("collect", (reaction, user) => {
|
||||
console.log(`Collected ${reaction.emoji.name} from ${user.tag}`);
|
||||
});
|
||||
} else {
|
||||
message.reply("UNAUTHORIZED");
|
||||
const path = require("path");
|
||||
const scriptName = path.basename(__filename);
|
||||
fs.appendFileSync(
|
||||
"../pepperbot/src/logs/failed.log",
|
||||
"non whitelisted user " +
|
||||
message.author.username +
|
||||
" (" +
|
||||
message.author +
|
||||
") attempted accessing " +
|
||||
scriptName +
|
||||
"\n"
|
||||
);
|
||||
}
|
||||
},
|
||||
};
|
65
src/commands/dmuser.js
Normal file
65
src/commands/dmuser.js
Normal file
|
@ -0,0 +1,65 @@
|
|||
const fs = require("fs");
|
||||
|
||||
const prefix = process.env.PREFIX;
|
||||
|
||||
function delay(time) {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(resolve, time);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
name: "dmuser",
|
||||
description: "forces bot to dm a user something (this will ghost ping them)",
|
||||
execute(message, args, client) {
|
||||
const user = message.mentions.users.first();
|
||||
if (!user) {
|
||||
return;
|
||||
}
|
||||
const msgnoprefix = message.content.slice(
|
||||
prefix.length + this.name.length + user.id.length + 4
|
||||
);
|
||||
|
||||
console.log(typeof user);
|
||||
console.log(user.username);
|
||||
//const usercache = client.users.fetch(user.id, false, true);
|
||||
|
||||
const msg = msgnoprefix.slice(0, 2000);
|
||||
|
||||
if (msg !== "") {
|
||||
user.send(msg);
|
||||
message.delete();
|
||||
fs.appendFileSync(
|
||||
"../pepperbot/src/logs/forcesay.log",
|
||||
Date() +
|
||||
" " +
|
||||
message.author.username +
|
||||
" (" +
|
||||
message.author +
|
||||
") forced bot to dm " +
|
||||
user.username +
|
||||
msg +
|
||||
"\n",
|
||||
(err) => {
|
||||
if (err !== null) {
|
||||
console.error(err);
|
||||
fs.appendFileSync(
|
||||
"../pepperbot/src/logs/errors.log",
|
||||
err + " from: " + message.content + " at " + Date()
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
console.log(
|
||||
Date() +
|
||||
message.author.username +
|
||||
" (" +
|
||||
message.author +
|
||||
") forced bot to dm " +
|
||||
user.username +
|
||||
msg +
|
||||
"\n"
|
||||
);
|
||||
}
|
||||
},
|
||||
};
|
21
src/commands/links.js
Normal file
21
src/commands/links.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
const { EmbedBuilder } = require("discord.js");
|
||||
module.exports = {
|
||||
name: "links",
|
||||
description: 'posts "important" links',
|
||||
execute(message, args) {
|
||||
const embed = new EmbedBuilder();
|
||||
embed.setTitle("very imphortance linkers");
|
||||
embed.setThumbnail(
|
||||
"https://cdn.discordapp.com/attachments/755150633191080073/1149152214850469908/Map_Icon.png"
|
||||
);
|
||||
embed.setColor(0xff0000);
|
||||
|
||||
embed.setDescription(`
|
||||
https://reidlab.online
|
||||
https://goop.network -- VERY IMPORTANT!!!!
|
||||
pepper.church releasing [TIME] (never (not anytime soon))
|
||||
`);
|
||||
|
||||
message.reply({ embeds: [embed] });
|
||||
},
|
||||
};
|
7
src/commands/mymovie.js
Normal file
7
src/commands/mymovie.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
module.exports = {
|
||||
name: 'mymovie',
|
||||
description: 'posts my movie',
|
||||
execute(message, args){
|
||||
message.reply('https://cdn.discordapp.com/attachments/755150633191080073/1149158052784775219/My_Movie.mp4')
|
||||
}
|
||||
}
|
12
src/commands/pepper.js
Normal file
12
src/commands/pepper.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
const { EmbedBuilder } = require('discord.js');
|
||||
module.exports = {
|
||||
name: 'pepper',
|
||||
description: 'Muchas Perfectas!',
|
||||
execute(message, args){
|
||||
const embed = new EmbedBuilder
|
||||
embed.setTitle('Muchas Perfectas!')
|
||||
embed.setImage('https://cdn.discordapp.com/attachments/755150633191080073/1148815491822002177/240_F_531030593_fOjJqzacbhzXwL1F9Mfyv0ML3YzZfm5c.jpg')
|
||||
embed.setColor(0xFF0000)
|
||||
message.reply({ embeds: [embed] })
|
||||
}
|
||||
}
|
30
src/commands/say.js
Normal file
30
src/commands/say.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
const fs = require('fs')
|
||||
|
||||
const prefix = process.env.PREFIX
|
||||
|
||||
function delay(time) {
|
||||
return new Promise(resolve => {
|
||||
setTimeout(resolve, time);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
name: 'say',
|
||||
description: 'forces bot to say something',
|
||||
execute(message, args){
|
||||
const msgnoprefix = message.content.slice(prefix.length + this.name.length)
|
||||
const msg = msgnoprefix.slice(0, 2000)
|
||||
|
||||
if (msg !== '') {
|
||||
message.channel.send(msg)
|
||||
message.delete()
|
||||
fs.appendFileSync("../pepperbot/src/logs/forcesay.log", Date() + " " + message.author.username + " (" + message.author + ") forced bot to say " + msg + "\n", (err) => {
|
||||
if (err !== null) {
|
||||
console.error(err)
|
||||
fs.appendFileSync("../pepperbot/src/logs/errors.log", err + ' from: ' + message.content + " at " + Date())
|
||||
}
|
||||
})
|
||||
console.log(Date() + " " + message.author.username + " (" + message.author + ") forced bot to say " + msg)
|
||||
}
|
||||
}
|
||||
}
|
35
src/commands/sendlog.js
Normal file
35
src/commands/sendlog.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
const { Collection } = require("discord.js");
|
||||
const prefix = process.env.PREFIX;
|
||||
const ignore = [];
|
||||
const fs = require("fs");
|
||||
|
||||
module.exports = {
|
||||
name: "sendlog",
|
||||
description: "sends log file (if the file is valid)",
|
||||
execute(message, args) {
|
||||
let msgnoprefix = message.content.slice(
|
||||
prefix.length + this.name.length + 1
|
||||
);
|
||||
if (!msgnoprefix.endsWith(".log")) {
|
||||
msgnoprefix += ".log";
|
||||
}
|
||||
|
||||
const logs = fs
|
||||
.readdirSync("../pepperbot/src/logs/")
|
||||
.filter((file) => file.endsWith(".log"));
|
||||
if (!logs.includes(msgnoprefix)) {
|
||||
message.reply("invalid log file");
|
||||
return;
|
||||
}
|
||||
if (ignore.includes(msgnoprefix)) return;
|
||||
const path = `../pepperbot/src/logs/${msgnoprefix}`;
|
||||
message.channel.send({
|
||||
files: [
|
||||
{
|
||||
attachment: path,
|
||||
name: "file.log",
|
||||
},
|
||||
],
|
||||
});
|
||||
},
|
||||
};
|
7
src/commands/test.js
Normal file
7
src/commands/test.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
module.exports = {
|
||||
name: "test",
|
||||
description: "test command",
|
||||
execute(message, args) {
|
||||
message.reply("MOTHAFUCKA SHUT UPPPPPP");
|
||||
},
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue