VylBot App 21.0.0

This commit is contained in:
Vylpes 2021-02-17 18:12:45 +00:00
parent 88dca40dd6
commit 3ddad6972a
27 changed files with 2667 additions and 307 deletions

49
.eslintrc Normal file
View file

@ -0,0 +1,49 @@
{
"parserOptions": {
"ecmaVersion": 6
},
"extends": [
"eslint:recommended"
],
"rules": {
"camelcase": "error",
"brace-style": [
"error",
"1tbs"
],
"comma-dangle": [
"error",
"never"
],
"comma-spacing": [
"error",
{
"before": false,
"after": true
}
],
"comma-style": [
"error",
"last"
],
"arrow-body-style": [
"error",
"as-needed"
],
"arrow-parens": [
"error",
"as-needed"
],
"arrow-spacing": "error",
"no-var": "error",
"prefer-template": "error",
"prefer-const": "error"
},
"globals": {
"exports": "writable",
"module": "writable",
"require": "writable",
"process": "writable",
"console": "writable"
}
}

10
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,10 @@
image: node
stages:
- lint
eslint:
stage: lint
script:
- npm install
- npm run lint

View file

@ -8,25 +8,6 @@ Download the latest version from the [releases page](https://github.com/Vylpes/v
Copy the config template file and fill in the strings.
```json
{
"token": "",
"prefix": "v!",
"commands": [
"essentials/commands",
"commands"
],
"events": [
"events"
]
}
```
* **Token:** Your bot's token
* **Prefix** The command prefix
* **Commands:** An array of the folders which contain your commands
* **Events:** An array of the folders which contain your events
## Usage
Implement the client using something like:

View file

@ -19,6 +19,7 @@ class about extends command {
// date: Date of build
super.requiredConfigs = "description";
super.requiredConfigs = "version";
super.requiredConfigs = "core-ver";
super.requiredConfigs = "author";
super.requiredConfigs = "date";
}
@ -26,11 +27,12 @@ class about extends command {
// The execution method
about(context) {
// Create an embed containing data about the bot
let embed = new MessageEmbed()
const embed = new MessageEmbed()
.setTitle("About")
.setColor(embedColor)
.setDescription(context.client.config.about.description)
.addField("Version", context.client.config.about.version)
.addField("Version", context.client.config.about.version, true)
.addField("VylBot Core", context.client.config.about['core-ver'], true)
.addField("Author", context.client.config.about.author)
.addField("Date", context.client.config.about.date);

View file

@ -23,28 +23,28 @@ class ban extends command {
// If the user has the modrole (set in config.ban.modrole)
if (context.message.guild.roles.cache.find(role => role.name == context.client.config.ban.modrole)) {
// Gets the user pinged in the command
let user = context.message.mentions.users.first();
const user = context.message.mentions.users.first();
// If the user pinged is a valid user
if (user) {
// Get the guild member object from the pinged user
let member = context.message.guild.member(user);
const member = context.message.guild.member(user);
// If the member object exists, i.e. if they are in the server
if (member) {
// Get the arguments and remove what isn't the reason
let reasonArgs = context.arguments;
const reasonArgs = context.arguments;
reasonArgs.splice(0, 1);
// Join the array into a string
let reason = reasonArgs.join(" ");
const reason = reasonArgs.join(" ");
// If the guild is available to work with
if (context.message.guild.available) {
// If the bot client is able to ban the member
if (member.bannable) {
// The Message Embed which goes into the bot log
let embedLog = new MessageEmbed()
const embedLog = new MessageEmbed()
.setTitle("Member Banned")
.setColor(embedColor)
.addField("User", `${user} \`${user.tag}\``, true)
@ -53,7 +53,7 @@ class ban extends command {
.setThumbnail(user.displayAvatarURL);
// The Message Embed which goes into the public channel the message was sent in
let embedPublic = new MessageEmbed()
const embedPublic = new MessageEmbed()
.setColor(embedColor)
.setDescription(`${user} has been banned`);
@ -83,7 +83,7 @@ class ban extends command {
// Post an error embed
function errorEmbed(context, message) {
let embed = new MessageEmbed()
const embed = new MessageEmbed()
.setColor(embedColor)
.setDescription(message);

View file

@ -1,7 +1,7 @@
// Required components
const { command } = require('vylbot-core');
const { MessageEmbed } = require('discord.js');
const randomPuppy = require('random-puppy');
const randomBunny = require('random-bunny');
// Command variables
const embedColor = "0x3050ba";
@ -18,11 +18,13 @@ class bunny extends command {
// Run method
bunny(context) {
// Get a random post from r/Rabbits
randomPuppy('Rabbits').then(image => {
randomBunny('rabbits', 'hot', (image, title) => {
// Create an embed containing the random image
let embed = new MessageEmbed()
const embed = new MessageEmbed()
.setColor(embedColor)
.setImage(image);
.setTitle(title)
.setImage(image)
.setFooter('r/Rabbits');
// Send the embed
context.message.channel.send(embed);

View file

@ -27,7 +27,7 @@ class clear extends command {
// Attempt to bulk delete the amount of messages specified as an argument
context.message.channel.bulkDelete(context.arguments[0]).then(() => {
// Public embed
let embed = new MessageEmbed()
const embed = new MessageEmbed()
.setColor(embedColor)
.setDescription(`${context.arguments[0]} messages were removed`);
@ -48,7 +48,7 @@ class clear extends command {
// Function to send an error embed
function errorEmbed(context, message) {
let embed = new MessageEmbed()
const embed = new MessageEmbed()
.setColor(embedColor)
.setDescription(message);

25
commands/eval.js Normal file
View file

@ -0,0 +1,25 @@
const { command } = require('vylbot-core');
const { MessageEmbed } = require('discord.js');
class evaluate extends command {
constructor() {
super("evaluate");
super.description = "Evaluates an expression";
super.category = "Administration";
super.requiredConfigs = "ownerid";
}
evaluate(context) {
if (context.message.author.id == context.client.config.eval.ownerid) {
const result = eval(context.arguments.join(" "));
const embed = new MessageEmbed()
.setDescription(result)
.setColor(0x3050ba);
context.message.channel.send(embed);
}
}
}
module.exports = evaluate;

View file

@ -18,34 +18,34 @@ class help extends command {
// Execute method
help(context) {
// Get the list of command folders the bot has been setup to check
let commandFolders = context.client.config.commands;
const commandFolders = context.client.config.commands;
// Empty arrays for commands
// allCommands: Will contain objects of all commands with their related info
// categories: Will contain strings of all the categories the commands are set to, unique
let allCommands = [];
let categories = [];
const allCommands = [];
const categories = [];
// Loop through all the command folders set
// i = folder index
for (let i = 0; i < commandFolders.length; i++) {
// The current folder the bot is looking through
let folder = commandFolders[i];
const folder = commandFolders[i];
// Read the directory of the current folder
let contents = readdirSync(`${process.cwd()}/${folder}`);
const contents = readdirSync(`${process.cwd()}/${folder}`);
// Loop through the contents of the folder
// j = file index in folder i
for (let j = 0; j < contents.length; j++) {
// Get command in the current folder to read
let file = require(`${process.cwd()}/${folder}/${contents[j]}`);
const file = require(`${process.cwd()}/${folder}/${contents[j]}`);
// Initialise the command
let obj = new file();
const obj = new file();
// Data object containing the command information
let data = {
const data = {
"name": contents[j].replace(".js", ""),
"description": obj.description,
"category": obj.category,
@ -61,7 +61,7 @@ class help extends command {
// Loop through all the commands discovered by the previous loop
for (let i = 0; i < allCommands.length; i++) {
// Get the current command category name, otherwise "none"
let category = allCommands[i].category || "none";
const category = allCommands[i].category || "none";
// If the command isn't already set, set it.
// This will then make the categories array be an array of all categories which have been used but only one of each.
@ -85,17 +85,17 @@ class help extends command {
// allCommands: The array of the commands found
function sendAll(context, categories, allCommands) {
// Embed to be sent
let embed = new MessageEmbed()
const embed = new MessageEmbed()
.setColor(embedColor)
.setTitle("Commands");
// Loop through each command
for (let i = 0; i < categories.length; i++) {
// The category name of the current one to check
let category = categories[i];
const category = categories[i];
// Empty Array for the next loop to filter out the current category
let commandsFilter = [];
const commandsFilter = [];
// Loop through allCommands
// If the command is set to the current category being checked, add it to the filter array
@ -128,7 +128,7 @@ function sendCommand(context, allCommands, name) {
// Create an embed containing the related information of the command
// The title is the command name but sets the first letter to be capitalised
// If a set of information isn't set, set it to say "none"
let embed = new MessageEmbed()
const embed = new MessageEmbed()
.setColor(embedColor)
.setTitle(command.name[0].toUpperCase() + command.name.substring(1))
.setDescription(command.description || "*none*")
@ -139,7 +139,7 @@ function sendCommand(context, allCommands, name) {
// Send the embed
context.message.channel.send(embed);
} else { // If no command has been found, then send an embed which says this
let embed = new MessageEmbed()
const embed = new MessageEmbed()
.setColor(embedColor)
.setDescription("Command does not exist");

View file

@ -23,28 +23,28 @@ class kick extends command {
// Checks if the user has the mod role, set in the config json string
if (context.message.member.roles.cache.find(role => role.name == context.client.config.kick.modrole)) {
// Gets the first user pinged in the command
let user = context.message.mentions.users.first();
const user = context.message.mentions.users.first();
// If a user was pinged
if (user) {
// Gets the guild member object of the pinged user
let member = context.message.guild.member(user);
const member = context.message.guild.member(user);
// If the member object exists, i.e if the user is in the server
if (member) {
// Gets the part of the argument array which holds the reason
let reasonArgs = context.arguments;
const reasonArgs = context.arguments;
reasonArgs.splice(0, 1);
// Joins the reason into a string
let reason = reasonArgs.join(" ");
const reason = reasonArgs.join(" ");
// If the server is available
if (context.message.guild.available) {
// If the bot client can kick the mentioned member
if (member.kickable) {
// The embed to go into the bot log
let embedLog = new MessageEmbed()
const embedLog = new MessageEmbed()
.setTitle("Member Kicked")
.setColor(embedColor)
.addField("User", `${user} \`${user.tag}\``, true)
@ -53,7 +53,7 @@ class kick extends command {
.setThumbnail(user.displayAvatarURL);
// The embed to go into channel the command was sent in
let embedPublic = new MessageEmbed()
const embedPublic = new MessageEmbed()
.setColor(embedColor)
.setDescription(`${user} has been kicked`);
@ -83,7 +83,7 @@ class kick extends command {
// Function to post an embed in case of an error
function errorEmbed(context, message) {
let embed = new MessageEmbed()
const embed = new MessageEmbed()
.setColor(embedColor)
.setDescription(message);

View file

@ -24,28 +24,28 @@ class mute extends command {
// Check if the user has the mod role
if (context.message.member.roles.cache.find(role => role.name == context.client.config.mute.modrole)) {
// Get the user first pinged in the message
let user = context.message.mentions.users.first();
const user = context.message.mentions.users.first();
// If the user object exists
if (user) {
// Get the guild member object of the mentioned user
let member = context.message.guild.member(user);
const member = context.message.guild.member(user);
// If the member object exists, i.e. if the user is in the server
if (member) {
// Get the part of the arguments array which contains the reason
let reasonArgs = context.arguments;
const reasonArgs = context.arguments;
reasonArgs.splice(0, 1);
// Join the reason into a string
let reason = reasonArgs.join(" ");
const reason = reasonArgs.join(" ");
// If the server is available
if (context.message.guild.available) {
// If the bot client can manage the user's roles
if (member.manageable) {
// The embed to go into the bot log
let embedLog = new MessageEmbed()
const embedLog = new MessageEmbed()
.setTitle("Member Muted")
.setColor(embedColor)
.addField("User", `${user} \`${user.tag}\``, true)
@ -54,13 +54,13 @@ class mute extends command {
.setThumbnail(user.displayAvatarURL);
// The embed to go into the channel the command was sent in
let embedPublic = new MessageEmbed()
const embedPublic = new MessageEmbed()
.setColor(embedColor)
.setDescription(`${user} has been muted`)
.addField("Reason", reason || "*none*");
// Get the 'Muted' role
let mutedRole = context.message.guild.roles.cache.find(role => role.name == context.client.config.mute.muterole);
const mutedRole = context.message.guild.roles.cache.find(role => role.name == context.client.config.mute.muterole);
// Attempt to mute the user, if successful send the embeds, if not log the error
member.roles.add(mutedRole, reason).then(() => {
@ -88,7 +88,7 @@ class mute extends command {
// Send an embed when an error occurs
function errorEmbed(context, message) {
let embed = new MessageEmbed()
const embed = new MessageEmbed()
.setColor(embedColor)
.setDescription(message);

60
commands/partner.js Normal file
View file

@ -0,0 +1,60 @@
// Required components
const { command } = require('vylbot-core');
const { MessageEmbed } = require('discord.js');
const { existsSync, readFileSync } = require('fs');
// Command Variables
const embedColor = "0x3050ba";
// Command class
class partner extends command {
constructor() {
// Set the command's run method, description, and category
super("partner");
super.description = "Generates the embeds for the partner from the partners.json file";
super.category = "Admin";
// Require in the config the name of the admin role and the rules file name
super.requiredConfigs = "adminrole";
super.requiredConfigs = "partnersfile";
}
// Run method
partner(context) {
if (context.message.member.roles.cache.find(role => role.name == context.client.config.partner.adminrole)) {
if (existsSync(context.client.config.partner.partnersfile)) {
const partnerJson = JSON.parse(readFileSync(context.client.config.partner.partnersfile));
for (const i in partnerJson) {
const serverName = partnerJson[i].name;
const serverInvite = partnerJson[i].invite;
const serverDescription = partnerJson[i].description;
const serverIcon = partnerJson[i].icon;
const embed = new MessageEmbed()
.setColor(embedColor)
.setTitle(serverName)
.setDescription(serverDescription)
.setURL(serverInvite)
.setThumbnail(serverIcon);
context.message.channel.send(embed);
}
} else {
const errorEmbed = new MessageEmbed()
.setColor(embedColor)
.setDescription('File does not exist');
context.message.channel.send(errorEmbed);
}
} else {
const errorEmbed = new MessageEmbed()
.setColor(embedColor)
.setDescription('You do not have permission to run this command');
context.message.channel.send(errorEmbed);
}
}
}
module.exports = partner;

View file

@ -1,6 +1,7 @@
// Required components
const { command } = require('vylbot-core');
const { MessageEmbed } = require('discord.js');
const emojiRegex = require('emoji-regex/RGI_Emoji');
// Command variables
const embedColor = "0x3050ba";
@ -20,40 +21,53 @@ class poll extends command {
// Get the command's arguments, and split them by a semicolon rather than a space
// This allows the variables to be able to use spaces in them
let args = context.arguments;
let argsJoined = args.join(' ');
const argsJoined = args.join(' ');
args = argsJoined.split(';');
// If the argument has 3 or more arguments and less than 11 arguments
// This allows the title and 2-9 options
if (args.length >= 3 && args.length < 11) {
// Set the title to the first argument
let title = args[0];
const title = args[0];
let optionString = "";
// Array used to get the numbers as their words
// arrayOfNumbers[n] = "n written in full words"
let arrayOfNumbers = [
'zero',
'one',
'two',
'three',
'four',
'five',
'six',
'seven',
'eight',
'nine'
const arrayOfNumbers = [
':zero:',
':one:',
':two:',
':three:',
':four:',
':five:',
':six:',
':seven:',
':eight:',
':nine:'
];
// Array containing the numbers as their emoji
const reactionEmojis = ["0⃣", "1⃣", "2⃣", "3⃣", "4⃣", "5⃣", "6⃣", "7⃣", "8⃣", "9⃣"];
// Loop through all the arguments after the title
// Add them to the optionString, with their index turned into a number emoji
// Example: :one: Option 1
for (let i = 1; i < args.length; i++) {
optionString += `:${arrayOfNumbers[i]}: ${args[i]}\n`;
// If the option contains an emoji, replace the emoji with it
const regex = emojiRegex();
const match = regex.exec(args[i]);
if (match) {
const emoji = match[0];
reactionEmojis[i] = emoji;
arrayOfNumbers[i] = '';
}
optionString += `${arrayOfNumbers[i]} ${args[i]}\n`;
}
// Create the embed with the title at the top of the description with the options below
let embed = new MessageEmbed()
const embed = new MessageEmbed()
.setColor(embedColor)
.setDescription(`**${title}**\n\n${optionString}`);
@ -61,71 +75,71 @@ class poll extends command {
// the bot will determine how many to react with for the amount of options inputted
context.message.channel.send(embed).then(message => {
if (args.length == 2) {
message.react("1⃣");
message.react(reactionEmojis[1]);
} else if (args.length == 3) {
message.react("1⃣")
.then(() => message.react("2⃣"));
message.react(reactionEmojis[1])
.then(() => message.react(reactionEmojis[2]));
} else if (args.length == 4) {
message.react("1⃣")
.then(() => message.react("2⃣"))
.then(() => message.react("3⃣"));
message.react(reactionEmojis[1])
.then(() => message.react(reactionEmojis[2]))
.then(() => message.react(reactionEmojis[3]));
} else if (args.length == 5) {
message.react("1⃣")
.then(() => message.react("2⃣"))
.then(() => message.react("3⃣"))
.then(() => message.react("4⃣"));
message.react(reactionEmojis[1])
.then(() => message.react(reactionEmojis[2]))
.then(() => message.react(reactionEmojis[3]))
.then(() => message.react(reactionEmojis[4]));
} else if (args.length == 6) {
message.react("1⃣")
.then(() => message.react("2⃣"))
.then(() => message.react("3⃣"))
.then(() => message.react("4⃣"))
.then(() => message.react("5⃣"));
message.react(reactionEmojis[1])
.then(() => message.react(reactionEmojis[2]))
.then(() => message.react(reactionEmojis[3]))
.then(() => message.react(reactionEmojis[4]))
.then(() => message.react(reactionEmojis[5]));
} else if (args.length == 7) {
message.react("1⃣")
.then(() => message.react("2⃣"))
.then(() => message.react("3⃣"))
.then(() => message.react("4⃣"))
.then(() => message.react("5⃣"))
.then(() => message.react("6⃣"));
message.react(reactionEmojis[1])
.then(() => message.react(reactionEmojis[2]))
.then(() => message.react(reactionEmojis[3]))
.then(() => message.react(reactionEmojis[4]))
.then(() => message.react(reactionEmojis[5]))
.then(() => message.react(reactionEmojis[6]));
} else if (args.length == 8) {
message.react("1⃣")
.then(() => message.react("2⃣"))
.then(() => message.react("3⃣"))
.then(() => message.react("4⃣"))
.then(() => message.react("5⃣"))
.then(() => message.react("6⃣"))
.then(() => message.react("7⃣"));
message.react(reactionEmojis[1])
.then(() => message.react(reactionEmojis[2]))
.then(() => message.react(reactionEmojis[3]))
.then(() => message.react(reactionEmojis[4]))
.then(() => message.react(reactionEmojis[5]))
.then(() => message.react(reactionEmojis[6]))
.then(() => message.react(reactionEmojis[7]));
} else if (args.length == 9) {
message.react("1⃣")
.then(() => message.react("2⃣"))
.then(() => message.react("3⃣"))
.then(() => message.react("4⃣"))
.then(() => message.react("5⃣"))
.then(() => message.react("6⃣"))
.then(() => message.react("7⃣"))
.then(() => message.react("8⃣"));
message.react(reactionEmojis[1])
.then(() => message.react(reactionEmojis[2]))
.then(() => message.react(reactionEmojis[3]))
.then(() => message.react(reactionEmojis[4]))
.then(() => message.react(reactionEmojis[5]))
.then(() => message.react(reactionEmojis[6]))
.then(() => message.react(reactionEmojis[7]))
.then(() => message.react(reactionEmojis[8]));
} else if (args.length == 10) {
message.react("1⃣")
.then(() => message.react("2⃣"))
.then(() => message.react("3⃣"))
.then(() => message.react("4⃣"))
.then(() => message.react("5⃣"))
.then(() => message.react("6⃣"))
.then(() => message.react("7⃣"))
.then(() => message.react("8⃣"))
.then(() => message.react("9⃣"));
message.react(reactionEmojis[1])
.then(() => message.react(reactionEmojis[2]))
.then(() => message.react(reactionEmojis[3]))
.then(() => message.react(reactionEmojis[4]))
.then(() => message.react(reactionEmojis[5]))
.then(() => message.react(reactionEmojis[6]))
.then(() => message.react(reactionEmojis[7]))
.then(() => message.react(reactionEmojis[8]))
.then(() => message.react(reactionEmojis[9]));
}
}).catch(console.error);
// Delete the message
context.message.delete();
} else if (args.length >= 11) { // If the user inputted more than 9 options
let errorEmbed = new MessageEmbed()
const errorEmbed = new MessageEmbed()
.setDescription("The poll command can only accept up to 9 options");
context.message.channel.send(errorEmbed);
} else { // If the user didn't give enough data
let errorEmbed = new MessageEmbed()
const errorEmbed = new MessageEmbed()
.setDescription("Please use the correct usage: <title>;<option 1>;<option 2>... (separate options with semicolons)");
context.message.channel.send(errorEmbed);

View file

@ -21,7 +21,7 @@ class role extends command {
// Run method
role(context) {
// Get the array containing the assignable roles
let roles = context.client.config.role.assignable;
const roles = context.client.config.role.assignable;
let requestedRole = "";
// If the arguments specifys a specific role
@ -37,13 +37,13 @@ class role extends command {
// If a matching assignable role was found
if (requestedRole != "") {
// Get the role object from the server with the role name
let role = context.message.guild.roles.cache.find(r => r.name == requestedRole);
const role = context.message.guild.roles.cache.find(r => r.name == requestedRole);
// If the user already has the role, remove the role from them and send an embed
// Otherwise, add the role and send an embed
if (context.message.member.roles.cache.find(r => r.name == requestedRole)) {
context.message.member.roles.remove(role).then(() => {
let embed = new MessageEmbed()
const embed = new MessageEmbed()
.setColor(embedColor)
.setDescription(`Removed role: ${requestedRole}`);
@ -51,7 +51,7 @@ class role extends command {
}).catch(err => {
console.error(err);
let errorEmbed = new MessageEmbed()
const errorEmbed = new MessageEmbed()
.setColor(embedColor)
.setDescription("An error occured. Please check logs");
@ -59,7 +59,7 @@ class role extends command {
});
} else { // If the user doesn't have the role
context.message.member.roles.add(role).then(() => {
let embed = new MessageEmbed()
const embed = new MessageEmbed()
.setColor(embedColor)
.setDescription(`Gave role: ${requestedRole}`);
@ -67,7 +67,7 @@ class role extends command {
}).catch(err => {
console.error(err);
let errorEmbed = new MessageEmbed()
const errorEmbed = new MessageEmbed()
.setColor(embedColor)
.setDescription("An error occured. Please check logs");
@ -75,7 +75,7 @@ class role extends command {
});
}
} else { // If the role can't be found, send an error embed
let embed = new MessageEmbed()
const embed = new MessageEmbed()
.setColor(embedColor)
.setDescription("This role does not exist, see assignable roles with the role command (no arguments)");
@ -91,7 +91,7 @@ class role extends command {
}
// Create an embed containing the text
let embed = new MessageEmbed()
const embed = new MessageEmbed()
.setTitle("Roles")
.setColor(embedColor)
.setDescription(rolesString);

View file

@ -1,4 +1,4 @@
// Required components
// Required Components
const { command } = require('vylbot-core');
const { MessageEmbed } = require('discord.js');
const { existsSync, readFileSync } = require('fs');
@ -12,7 +12,7 @@ class rules extends command {
// Set the command's run method, description, and category
super("rules");
super.description = "Generates the rules embeds from the rules.txt file";
super.category = "Administration";
super.category = "Admin";
// Require in the config the name of the admin role and the rules file name
super.requiredConfigs = "adminrole";
@ -34,19 +34,19 @@ class rules extends command {
for (let i = 0; i < rulesText.length; i++) {
// If the first line after "> " has a "#", create and embed with an image of the url specified after
if (rulesText[i].charAt(0) == '#') {
let embed = new MessageEmbed()
const embed = new MessageEmbed()
.setColor(embedColor)
.setImage(rulesText[i].substring(1));
context.message.channel.send(embed);
} else { // If the file doesn't have a "#" at the start
// Split the embed into different lines, set the first line as the title, and the rest as the description
let rulesLines = rulesText[i].split("\n");
let rulesTitle = rulesLines[0];
let rulesDescription = rulesLines.slice(1).join("\n");
const rulesLines = rulesText[i].split("\n");
const rulesTitle = rulesLines[0];
const rulesDescription = rulesLines.slice(1).join("\n");
// Create the embed with the specified information above
let embed = new MessageEmbed()
const embed = new MessageEmbed()
.setTitle(rulesTitle)
.setColor(embedColor)
.setDescription(rulesDescription);
@ -56,14 +56,14 @@ class rules extends command {
}
}
} else { // If the rules file doesn't exist
let errorEmbed = new MessageEmbed()
const errorEmbed = new MessageEmbed()
.setColor(embedColor)
.setDescription(`${context.client.config.rules.rulesfile} doesn't exist`);
context.message.channel.send(errorEmbed);
}
} else { // If the user doesn't have the Admin role
let errorEmbed = new MessageEmbed()
const errorEmbed = new MessageEmbed()
.setColor(embedColor)
.setDescription("You do not have permission to run this command");

View file

@ -24,28 +24,28 @@ class unmute extends command {
// Check if the user has the mod role
if (context.message.member.roles.cache.find(role => role.name == context.client.config.mute.modrole)) {
// Get the user first pinged in the message
let user = context.message.mentions.users.first();
const user = context.message.mentions.users.first();
// If the user object exists
if (user) {
// Get the guild member object from the pinged user
let member = context.message.guild.member(user);
const member = context.message.guild.member(user);
// If the member object exists, i.e. if the user is in the server
if (member) {
// Get the part of the argument array which contains the reason
let reasonArgs = context.arguments;
const reasonArgs = context.arguments;
reasonArgs.splice(0, 1);
// Join the array into a string
let reason = reasonArgs.join(" ");
const reason = reasonArgs.join(" ");
// If the server is available
if (context.message.guild.available) {
// If the bot client can manage the user
if (member.manageable) {
// The embed to go into the bot log
let embedLog = new MessageEmbed()
const embedLog = new MessageEmbed()
.setColor(embedColor)
.setTitle("Member Unmuted")
.addField("User", `${user} \`${user.tag}\``, true)
@ -54,13 +54,13 @@ class unmute extends command {
.setThumbnail(user.displayAvatarURL);
// The embed to go into the channel the command was sent in
let embedPublic = new MessageEmbed()
const embedPublic = new MessageEmbed()
.setColor(embedColor)
.setDescription(`${user} has been unmuted`)
.addField("Reason", reason || "*none*");
// Get the muted role
let mutedRole = context.message.guild.roles.cache.find(role => role.name == context.client.config.unmute.muterole);
const mutedRole = context.message.guild.roles.cache.find(role => role.name == context.client.config.unmute.muterole);
// Attempt to remove the role from the user, and then send the embeds. If unsuccessful log the error
member.roles.remove(mutedRole, reason).then(() => {
@ -88,7 +88,7 @@ class unmute extends command {
// Send an embed in case of an error
function errorEmbed(context, message) {
let embed = new MessageEmbed()
const embed = new MessageEmbed()
.setColor(embedColor)
.setDescription(message);

View file

@ -23,26 +23,26 @@ class warn extends command {
// If the user has the mod role
if (context.message.member.roles.cache.find(role => role.name == context.client.config.warn.modrole)) {
// Get the user first pinged in the message
let user = context.message.mentions.users.first();
const user = context.message.mentions.users.first();
// If the user object exists
if (user) {
// Get the guild member object from the user
let member = context.message.guild.member(user);
const member = context.message.guild.member(user);
// If the member object exists. i.e. if the user is in the server
if (member) {
// Get the part of the argument array which the reason is in
let reasonArgs = context.arguments;
const reasonArgs = context.arguments;
reasonArgs.splice(0, 1);
// Join the array into a string
let reason = reasonArgs.join(" ");
const reason = reasonArgs.join(" ");
// If the server is available
if (context.message.guild.available) {
// The embed to go into the bot log
let embedLog = new MessageEmbed()
const embedLog = new MessageEmbed()
.setColor(embedColor)
.setTitle("Member Warned")
.addField("User", `${user} \`${user.tag}\``, true)
@ -51,7 +51,7 @@ class warn extends command {
.setThumbnail(user.displayAvatarURL);
// The embed to go into the channel the command was sent in
let embedPublic = new MessageEmbed()
const embedPublic = new MessageEmbed()
.setColor(embedColor)
.setDescription(`${user} has been warned`)
.addField("Reason", reason || "*none*");
@ -76,7 +76,7 @@ class warn extends command {
// Send an embed in case of an error
function errorEmbed(context, message) {
let embed = new MessageEmbed()
const embed = new MessageEmbed()
.setColor(embedColor)
.setDescription(message);

54
config.template.json Normal file
View file

@ -0,0 +1,54 @@
{
"token": "",
"prefix": "d!",
"commands": [
"commands"
],
"events": [
"events"
],
"about": {
"description": "Discord Bot for Vylpes' Den",
"version": "2.1",
"core-ver": "1.0.4",
"author": "Vylpes",
"date": "17-Feb-21"
},
"ban": {
"modrole": "Moderator",
"logchannel": "mod-logs"
},
"clear": {
"modrole": "Moderator",
"logchannel": "mod-logs"
},
"eval": {
"ownerid": "147392775707426816"
},
"kick": {
"modrole": "Moderator",
"logchannel": "mod-logs"
},
"mute": {
"modrole": "Moderator",
"logchannel": "mod-logs",
"muterole": "Muted"
},
"partner": {
"adminrole": "Admin",
"partnersfile": "data/partner/partner.json"
},
"rules": {
"adminrole": "Admin",
"rulesfile": "data/rules/rules.txt"
},
"unmute": {
"modrole": "Moderator",
"logchannel": "mod-logs",
"muterole": "Muted"
},
"warn": {
"modrole": "Moderator",
"logchannel": "mod-logs"
}
}

14
data/partner/partner.json Normal file
View file

@ -0,0 +1,14 @@
[
{
"name": "Cuzethstan",
"description": "Cuzeth Server. Yes.",
"invite": "http://discord.gg/uhEFNw7",
"icon": "https://cdn.discordapp.com/icons/720177983016665251/a_e4250e57b26559c6609dfe562774ee27.gif"
},
{
"name": "Boblin",
"description": "Official server of the... Boblin?\n- Multiple Topics\n- Lots of Very Active Members",
"invite": "https://discord.gg/Td4uzVu",
"icon": "https://cdn.discordapp.com/attachments/464708407010787328/487824441846267907/image0.png"
}
]

View file

@ -8,32 +8,24 @@ All servers are required to follow the Discord Terms of Service. This includes m
- **English Only**
In order for everyone to understand each other we would like to ask everyone to speak in English only.
- **No NSFW content**
Please keep all content SFW, including profile pictures, usernames, and nicknames.
- **No NSFW or Obscene Content**
This includes text, images, or links featuring nudity, sex, hard violence, or other graphically disturbing content.
- **No Excessive Swearing**
You may swear in moderation, but please don't overdo it.
- **Treat Everyone with Respect**
Absolutely no harassment, witch hunting, sexism, racism, or hate speech will be tolerated.
- **Do Not Spam**
This includes posting repeatedly the same text in a short amount of time, copypastas, etc.
- **No spam or self promotion**
Outside of #self-promo. This includes DMing fellow members.
- **Caps Lock**
Having your entire message in capitals counts as spam. You may do it to show emotion, but please keep it to a minimum. Same applies to bold characters. Grammatical use of all caps is allowed.
- **Keep Politics to #general**
And make sure it doesn't become too heated. Debate don't argue.
- **Toxicity**
Do not be toxic towards others.
- **Backseat Modding**
Do not backseat mod. Its annoying for the moderators. If no mod is available you can help but if a mod is there, let them handle it or ping them if needed.
- **Politics**
Please keep politics to #general, and make sure it doesn't become too heated. Debate don't argue.
- **Self Promotion**
Self promotion of your own content is allowed in #self-promo only. You, however, are allowed to post links to others' work in the appropriate channel.
- **No Drama**
- **Drama From Other Servers**
Please don't bring up drama from other servers, keep that to DMs
- **Bot Abuse**
Don't abuse the bots or you will be blocked from using them
> Moderators Discretion
Don't argue with a mod's decision. A moderator's choice is final. If you have an issue with a member of the mod team DM me (Vylpes#0001).
> Supporters
@ -45,4 +37,5 @@ Notify: Get pinged when a new stream or video releases.
YouTube: https://www.youtube.com/channel/UCwPlzKwCmP5Q9bCX3fHk2BA
Patreon: https://www.patreon.com/vylpes
Twitch: https://www.twitch.tv/vylpes_
Twitter: https://twitter.com/vylpes
Twitter: https://twitter.com/vylpes

View file

@ -4,7 +4,7 @@ const { MessageEmbed } = require('discord.js');
// Event variables
const embedColor = "0x3050ba";
const logchannel = "logs";
const logchannel = "member-logs";
// Event class
class guildmemberadd extends event {
@ -16,7 +16,7 @@ class guildmemberadd extends event {
// Run method
guildmemberadd(member) {
// Create an embed with the user who joined's information
let embed = new MessageEmbed()
const embed = new MessageEmbed()
.setTitle("Member Joined")
.setColor(embedColor)
.addField("User", `${member} \`${member.user.tag}\``)

View file

@ -4,7 +4,7 @@ const { MessageEmbed } = require('discord.js');
// Event variables
const embedColor = "0x3050ba";
const logchannel = "logs";
const logchannel = "member-logs";
// Event class
class guildmemberremove extends event {
@ -16,7 +16,7 @@ class guildmemberremove extends event {
// Run method
guildmemberremove(member) {
// Create an embed with the user's information
let embed = new MessageEmbed()
const embed = new MessageEmbed()
.setTitle("Member Left")
.setColor(embedColor)
.addField("User", `${member} \`${member.user.tag}\``)

View file

@ -4,7 +4,7 @@ const { MessageEmbed } = require('discord.js');
// Event variables
const embedColor = "0x3050ba";
const logchannel = "logs";
const logchannel = "member-logs";
// Event class
class guildmemberupdate extends event {
@ -19,12 +19,11 @@ class guildmemberupdate extends event {
if (oldMember.nickname != newMember.nickname) {
// Get the user's name with tag, their old nickname and their new nickname
// If they didn't have a nickname or they removed it, set it to "none" in italics
let memberName = newMember.user.tag;
let oldNickname = oldMember.nickname || "*none*";
let newNickname = newMember.nickname || "*none*";
const oldNickname = oldMember.nickname || "*none*";
const newNickname = newMember.nickname || "*none*";
// Create the embed with the user's information
let embed = new MessageEmbed()
const embed = new MessageEmbed()
.setTitle("Nickname Changed")
.setColor(embedColor)
.addField("User", `${newMember} \`${newMember.user.tag}\``)
@ -34,7 +33,7 @@ class guildmemberupdate extends event {
.setThumbnail(newMember.user.displayAvatarURL({ type: 'png', dynamic: true }));
// Send the embed in the log channel
newMember.guild.channels.cache.find(channel => channel.name == lgochannel).send(embed);
newMember.guild.channels.cache.find(channel => channel.name == logchannel).send(embed);
}
}
}

View file

@ -4,7 +4,7 @@ const { MessageEmbed } = require('discord.js');
// Event variables
const embedColor = "0x3050ba";
const logchannel = "logs";
const logchannel = "message-logs";
// Event class
class messagedelete extends event {
@ -16,7 +16,7 @@ class messagedelete extends event {
// Run method
messagedelete(message) {
// Create an embed with the message's information
let embed = new MessageEmbed()
const embed = new MessageEmbed()
.setTitle("Message Deleted")
.setColor(embedColor)
.addField("User", `${message.author} \`${message.author.tag}\``)

View file

@ -4,7 +4,7 @@ const { MessageEmbed } = require('discord.js');
// Event variables
const embedColor = "0x3050ba";
const logchannel = "logs";
const logchannel = "message-logs";
// Event class
class messageupdate extends event {
@ -20,8 +20,8 @@ class messageupdate extends event {
if (oldMessage.content == newMessage.content) return;
// Create an embed with the message's information
let embed = new MessageEmbed()
.setTitle("Message Embed")
const embed = new MessageEmbed()
.setTitle("Message Edited")
.setColor(embedColor)
.addField("User", `${newMessage.author} \`${newMessage.author.tag}\``)
.addField("Channel", newMessage.channel)

2372
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,11 +1,12 @@
{
"name": "vylbot-app",
"version": "1.0.0",
"version": "2.1.0",
"description": "",
"main": "vylbot.js",
"scripts": {
"start": "node vylbot.js",
"test": "echo \"No tests specified\""
"lint": "eslint .",
"lint:fix": "eslint . --fix"
},
"repository": {
"type": "git",
@ -18,7 +19,11 @@
},
"homepage": "https://github.com/Vylpes/vylbot-app#readme",
"dependencies": {
"random-puppy": "^1.1.0",
"emoji-regex": "^9.2.0",
"random-bunny": "^1.0.0",
"vylbot-core": "^1.0.4"
},
"devDependencies": {
"eslint": "^7.17.0"
}
}