VylBot App 21.0.0
This commit is contained in:
parent
88dca40dd6
commit
3ddad6972a
27 changed files with 2667 additions and 307 deletions
49
.eslintrc
Normal file
49
.eslintrc
Normal 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
10
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
image: node
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- lint
|
||||||
|
|
||||||
|
eslint:
|
||||||
|
stage: lint
|
||||||
|
script:
|
||||||
|
- npm install
|
||||||
|
- npm run lint
|
19
README.md
19
README.md
|
@ -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.
|
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
|
## Usage
|
||||||
|
|
||||||
Implement the client using something like:
|
Implement the client using something like:
|
||||||
|
|
|
@ -19,6 +19,7 @@ class about extends command {
|
||||||
// date: Date of build
|
// date: Date of build
|
||||||
super.requiredConfigs = "description";
|
super.requiredConfigs = "description";
|
||||||
super.requiredConfigs = "version";
|
super.requiredConfigs = "version";
|
||||||
|
super.requiredConfigs = "core-ver";
|
||||||
super.requiredConfigs = "author";
|
super.requiredConfigs = "author";
|
||||||
super.requiredConfigs = "date";
|
super.requiredConfigs = "date";
|
||||||
}
|
}
|
||||||
|
@ -26,11 +27,12 @@ class about extends command {
|
||||||
// The execution method
|
// The execution method
|
||||||
about(context) {
|
about(context) {
|
||||||
// Create an embed containing data about the bot
|
// Create an embed containing data about the bot
|
||||||
let embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setTitle("About")
|
.setTitle("About")
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setDescription(context.client.config.about.description)
|
.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("Author", context.client.config.about.author)
|
||||||
.addField("Date", context.client.config.about.date);
|
.addField("Date", context.client.config.about.date);
|
||||||
|
|
|
@ -23,28 +23,28 @@ class ban extends command {
|
||||||
// If the user has the modrole (set in config.ban.modrole)
|
// 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)) {
|
if (context.message.guild.roles.cache.find(role => role.name == context.client.config.ban.modrole)) {
|
||||||
// Gets the user pinged in the command
|
// 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 the user pinged is a valid user
|
||||||
if (user) {
|
if (user) {
|
||||||
// Get the guild member object from the pinged 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 the member object exists, i.e. if they are in the server
|
||||||
if (member) {
|
if (member) {
|
||||||
// Get the arguments and remove what isn't the reason
|
// Get the arguments and remove what isn't the reason
|
||||||
let reasonArgs = context.arguments;
|
const reasonArgs = context.arguments;
|
||||||
reasonArgs.splice(0, 1);
|
reasonArgs.splice(0, 1);
|
||||||
|
|
||||||
// Join the array into a string
|
// Join the array into a string
|
||||||
let reason = reasonArgs.join(" ");
|
const reason = reasonArgs.join(" ");
|
||||||
|
|
||||||
// If the guild is available to work with
|
// If the guild is available to work with
|
||||||
if (context.message.guild.available) {
|
if (context.message.guild.available) {
|
||||||
// If the bot client is able to ban the member
|
// If the bot client is able to ban the member
|
||||||
if (member.bannable) {
|
if (member.bannable) {
|
||||||
// The Message Embed which goes into the bot log
|
// The Message Embed which goes into the bot log
|
||||||
let embedLog = new MessageEmbed()
|
const embedLog = new MessageEmbed()
|
||||||
.setTitle("Member Banned")
|
.setTitle("Member Banned")
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.addField("User", `${user} \`${user.tag}\``, true)
|
.addField("User", `${user} \`${user.tag}\``, true)
|
||||||
|
@ -53,7 +53,7 @@ class ban extends command {
|
||||||
.setThumbnail(user.displayAvatarURL);
|
.setThumbnail(user.displayAvatarURL);
|
||||||
|
|
||||||
// The Message Embed which goes into the public channel the message was sent in
|
// The Message Embed which goes into the public channel the message was sent in
|
||||||
let embedPublic = new MessageEmbed()
|
const embedPublic = new MessageEmbed()
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setDescription(`${user} has been banned`);
|
.setDescription(`${user} has been banned`);
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ class ban extends command {
|
||||||
|
|
||||||
// Post an error embed
|
// Post an error embed
|
||||||
function errorEmbed(context, message) {
|
function errorEmbed(context, message) {
|
||||||
let embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setDescription(message);
|
.setDescription(message);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Required components
|
// Required components
|
||||||
const { command } = require('vylbot-core');
|
const { command } = require('vylbot-core');
|
||||||
const { MessageEmbed } = require('discord.js');
|
const { MessageEmbed } = require('discord.js');
|
||||||
const randomPuppy = require('random-puppy');
|
const randomBunny = require('random-bunny');
|
||||||
|
|
||||||
// Command variables
|
// Command variables
|
||||||
const embedColor = "0x3050ba";
|
const embedColor = "0x3050ba";
|
||||||
|
@ -18,11 +18,13 @@ class bunny extends command {
|
||||||
// Run method
|
// Run method
|
||||||
bunny(context) {
|
bunny(context) {
|
||||||
// Get a random post from r/Rabbits
|
// Get a random post from r/Rabbits
|
||||||
randomPuppy('Rabbits').then(image => {
|
randomBunny('rabbits', 'hot', (image, title) => {
|
||||||
// Create an embed containing the random image
|
// Create an embed containing the random image
|
||||||
let embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setImage(image);
|
.setTitle(title)
|
||||||
|
.setImage(image)
|
||||||
|
.setFooter('r/Rabbits');
|
||||||
|
|
||||||
// Send the embed
|
// Send the embed
|
||||||
context.message.channel.send(embed);
|
context.message.channel.send(embed);
|
||||||
|
|
|
@ -27,7 +27,7 @@ class clear extends command {
|
||||||
// Attempt to bulk delete the amount of messages specified as an argument
|
// Attempt to bulk delete the amount of messages specified as an argument
|
||||||
context.message.channel.bulkDelete(context.arguments[0]).then(() => {
|
context.message.channel.bulkDelete(context.arguments[0]).then(() => {
|
||||||
// Public embed
|
// Public embed
|
||||||
let embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setDescription(`${context.arguments[0]} messages were removed`);
|
.setDescription(`${context.arguments[0]} messages were removed`);
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ class clear extends command {
|
||||||
|
|
||||||
// Function to send an error embed
|
// Function to send an error embed
|
||||||
function errorEmbed(context, message) {
|
function errorEmbed(context, message) {
|
||||||
let embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setDescription(message);
|
.setDescription(message);
|
||||||
|
|
25
commands/eval.js
Normal file
25
commands/eval.js
Normal 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;
|
|
@ -18,34 +18,34 @@ class help extends command {
|
||||||
// Execute method
|
// Execute method
|
||||||
help(context) {
|
help(context) {
|
||||||
// Get the list of command folders the bot has been setup to check
|
// 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
|
// Empty arrays for commands
|
||||||
// allCommands: Will contain objects of all commands with their related info
|
// 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
|
// categories: Will contain strings of all the categories the commands are set to, unique
|
||||||
let allCommands = [];
|
const allCommands = [];
|
||||||
let categories = [];
|
const categories = [];
|
||||||
|
|
||||||
// Loop through all the command folders set
|
// Loop through all the command folders set
|
||||||
// i = folder index
|
// i = folder index
|
||||||
for (let i = 0; i < commandFolders.length; i++) {
|
for (let i = 0; i < commandFolders.length; i++) {
|
||||||
// The current folder the bot is looking through
|
// The current folder the bot is looking through
|
||||||
let folder = commandFolders[i];
|
const folder = commandFolders[i];
|
||||||
|
|
||||||
// Read the directory of the current folder
|
// 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
|
// Loop through the contents of the folder
|
||||||
// j = file index in folder i
|
// j = file index in folder i
|
||||||
for (let j = 0; j < contents.length; j++) {
|
for (let j = 0; j < contents.length; j++) {
|
||||||
// Get command in the current folder to read
|
// 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
|
// Initialise the command
|
||||||
let obj = new file();
|
const obj = new file();
|
||||||
|
|
||||||
// Data object containing the command information
|
// Data object containing the command information
|
||||||
let data = {
|
const data = {
|
||||||
"name": contents[j].replace(".js", ""),
|
"name": contents[j].replace(".js", ""),
|
||||||
"description": obj.description,
|
"description": obj.description,
|
||||||
"category": obj.category,
|
"category": obj.category,
|
||||||
|
@ -61,7 +61,7 @@ class help extends command {
|
||||||
// Loop through all the commands discovered by the previous loop
|
// Loop through all the commands discovered by the previous loop
|
||||||
for (let i = 0; i < allCommands.length; i++) {
|
for (let i = 0; i < allCommands.length; i++) {
|
||||||
// Get the current command category name, otherwise "none"
|
// 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.
|
// 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.
|
// 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
|
// allCommands: The array of the commands found
|
||||||
function sendAll(context, categories, allCommands) {
|
function sendAll(context, categories, allCommands) {
|
||||||
// Embed to be sent
|
// Embed to be sent
|
||||||
let embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setTitle("Commands");
|
.setTitle("Commands");
|
||||||
|
|
||||||
// Loop through each command
|
// Loop through each command
|
||||||
for (let i = 0; i < categories.length; i++) {
|
for (let i = 0; i < categories.length; i++) {
|
||||||
// The category name of the current one to check
|
// 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
|
// Empty Array for the next loop to filter out the current category
|
||||||
let commandsFilter = [];
|
const commandsFilter = [];
|
||||||
|
|
||||||
// Loop through allCommands
|
// Loop through allCommands
|
||||||
// If the command is set to the current category being checked, add it to the filter array
|
// 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
|
// Create an embed containing the related information of the command
|
||||||
// The title is the command name but sets the first letter to be capitalised
|
// 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"
|
// If a set of information isn't set, set it to say "none"
|
||||||
let embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setTitle(command.name[0].toUpperCase() + command.name.substring(1))
|
.setTitle(command.name[0].toUpperCase() + command.name.substring(1))
|
||||||
.setDescription(command.description || "*none*")
|
.setDescription(command.description || "*none*")
|
||||||
|
@ -139,7 +139,7 @@ function sendCommand(context, allCommands, name) {
|
||||||
// Send the embed
|
// Send the embed
|
||||||
context.message.channel.send(embed);
|
context.message.channel.send(embed);
|
||||||
} else { // If no command has been found, then send an embed which says this
|
} else { // If no command has been found, then send an embed which says this
|
||||||
let embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setDescription("Command does not exist");
|
.setDescription("Command does not exist");
|
||||||
|
|
|
@ -23,28 +23,28 @@ class kick extends command {
|
||||||
// Checks if the user has the mod role, set in the config json string
|
// 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)) {
|
if (context.message.member.roles.cache.find(role => role.name == context.client.config.kick.modrole)) {
|
||||||
// Gets the first user pinged in the command
|
// 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 a user was pinged
|
||||||
if (user) {
|
if (user) {
|
||||||
// Gets the guild member object of the pinged 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 the member object exists, i.e if the user is in the server
|
||||||
if (member) {
|
if (member) {
|
||||||
// Gets the part of the argument array which holds the reason
|
// Gets the part of the argument array which holds the reason
|
||||||
let reasonArgs = context.arguments;
|
const reasonArgs = context.arguments;
|
||||||
reasonArgs.splice(0, 1);
|
reasonArgs.splice(0, 1);
|
||||||
|
|
||||||
// Joins the reason into a string
|
// Joins the reason into a string
|
||||||
let reason = reasonArgs.join(" ");
|
const reason = reasonArgs.join(" ");
|
||||||
|
|
||||||
// If the server is available
|
// If the server is available
|
||||||
if (context.message.guild.available) {
|
if (context.message.guild.available) {
|
||||||
// If the bot client can kick the mentioned member
|
// If the bot client can kick the mentioned member
|
||||||
if (member.kickable) {
|
if (member.kickable) {
|
||||||
// The embed to go into the bot log
|
// The embed to go into the bot log
|
||||||
let embedLog = new MessageEmbed()
|
const embedLog = new MessageEmbed()
|
||||||
.setTitle("Member Kicked")
|
.setTitle("Member Kicked")
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.addField("User", `${user} \`${user.tag}\``, true)
|
.addField("User", `${user} \`${user.tag}\``, true)
|
||||||
|
@ -53,7 +53,7 @@ class kick extends command {
|
||||||
.setThumbnail(user.displayAvatarURL);
|
.setThumbnail(user.displayAvatarURL);
|
||||||
|
|
||||||
// The embed to go into channel the command was sent in
|
// The embed to go into channel the command was sent in
|
||||||
let embedPublic = new MessageEmbed()
|
const embedPublic = new MessageEmbed()
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setDescription(`${user} has been kicked`);
|
.setDescription(`${user} has been kicked`);
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ class kick extends command {
|
||||||
|
|
||||||
// Function to post an embed in case of an error
|
// Function to post an embed in case of an error
|
||||||
function errorEmbed(context, message) {
|
function errorEmbed(context, message) {
|
||||||
let embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setDescription(message);
|
.setDescription(message);
|
||||||
|
|
|
@ -24,28 +24,28 @@ class mute extends command {
|
||||||
// Check if the user has the mod role
|
// Check if the user has the mod role
|
||||||
if (context.message.member.roles.cache.find(role => role.name == context.client.config.mute.modrole)) {
|
if (context.message.member.roles.cache.find(role => role.name == context.client.config.mute.modrole)) {
|
||||||
// Get the user first pinged in the message
|
// 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 the user object exists
|
||||||
if (user) {
|
if (user) {
|
||||||
// Get the guild member object of the mentioned 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 the member object exists, i.e. if the user is in the server
|
||||||
if (member) {
|
if (member) {
|
||||||
// Get the part of the arguments array which contains the reason
|
// Get the part of the arguments array which contains the reason
|
||||||
let reasonArgs = context.arguments;
|
const reasonArgs = context.arguments;
|
||||||
reasonArgs.splice(0, 1);
|
reasonArgs.splice(0, 1);
|
||||||
|
|
||||||
// Join the reason into a string
|
// Join the reason into a string
|
||||||
let reason = reasonArgs.join(" ");
|
const reason = reasonArgs.join(" ");
|
||||||
|
|
||||||
// If the server is available
|
// If the server is available
|
||||||
if (context.message.guild.available) {
|
if (context.message.guild.available) {
|
||||||
// If the bot client can manage the user's roles
|
// If the bot client can manage the user's roles
|
||||||
if (member.manageable) {
|
if (member.manageable) {
|
||||||
// The embed to go into the bot log
|
// The embed to go into the bot log
|
||||||
let embedLog = new MessageEmbed()
|
const embedLog = new MessageEmbed()
|
||||||
.setTitle("Member Muted")
|
.setTitle("Member Muted")
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.addField("User", `${user} \`${user.tag}\``, true)
|
.addField("User", `${user} \`${user.tag}\``, true)
|
||||||
|
@ -54,13 +54,13 @@ class mute extends command {
|
||||||
.setThumbnail(user.displayAvatarURL);
|
.setThumbnail(user.displayAvatarURL);
|
||||||
|
|
||||||
// The embed to go into the channel the command was sent in
|
// The embed to go into the channel the command was sent in
|
||||||
let embedPublic = new MessageEmbed()
|
const embedPublic = new MessageEmbed()
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setDescription(`${user} has been muted`)
|
.setDescription(`${user} has been muted`)
|
||||||
.addField("Reason", reason || "*none*");
|
.addField("Reason", reason || "*none*");
|
||||||
|
|
||||||
// Get the 'Muted' role
|
// 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
|
// Attempt to mute the user, if successful send the embeds, if not log the error
|
||||||
member.roles.add(mutedRole, reason).then(() => {
|
member.roles.add(mutedRole, reason).then(() => {
|
||||||
|
@ -88,7 +88,7 @@ class mute extends command {
|
||||||
|
|
||||||
// Send an embed when an error occurs
|
// Send an embed when an error occurs
|
||||||
function errorEmbed(context, message) {
|
function errorEmbed(context, message) {
|
||||||
let embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setDescription(message);
|
.setDescription(message);
|
||||||
|
|
60
commands/partner.js
Normal file
60
commands/partner.js
Normal 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;
|
138
commands/poll.js
138
commands/poll.js
|
@ -1,6 +1,7 @@
|
||||||
// Required components
|
// Required components
|
||||||
const { command } = require('vylbot-core');
|
const { command } = require('vylbot-core');
|
||||||
const { MessageEmbed } = require('discord.js');
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
const emojiRegex = require('emoji-regex/RGI_Emoji');
|
||||||
|
|
||||||
// Command variables
|
// Command variables
|
||||||
const embedColor = "0x3050ba";
|
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
|
// 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
|
// This allows the variables to be able to use spaces in them
|
||||||
let args = context.arguments;
|
let args = context.arguments;
|
||||||
let argsJoined = args.join(' ');
|
const argsJoined = args.join(' ');
|
||||||
args = argsJoined.split(';');
|
args = argsJoined.split(';');
|
||||||
|
|
||||||
// If the argument has 3 or more arguments and less than 11 arguments
|
// If the argument has 3 or more arguments and less than 11 arguments
|
||||||
// This allows the title and 2-9 options
|
// This allows the title and 2-9 options
|
||||||
if (args.length >= 3 && args.length < 11) {
|
if (args.length >= 3 && args.length < 11) {
|
||||||
// Set the title to the first argument
|
// Set the title to the first argument
|
||||||
let title = args[0];
|
const title = args[0];
|
||||||
let optionString = "";
|
let optionString = "";
|
||||||
|
|
||||||
// Array used to get the numbers as their words
|
// Array used to get the numbers as their words
|
||||||
// arrayOfNumbers[n] = "n written in full words"
|
// arrayOfNumbers[n] = "n written in full words"
|
||||||
let arrayOfNumbers = [
|
const arrayOfNumbers = [
|
||||||
'zero',
|
':zero:',
|
||||||
'one',
|
':one:',
|
||||||
'two',
|
':two:',
|
||||||
'three',
|
':three:',
|
||||||
'four',
|
':four:',
|
||||||
'five',
|
':five:',
|
||||||
'six',
|
':six:',
|
||||||
'seven',
|
':seven:',
|
||||||
'eight',
|
':eight:',
|
||||||
'nine'
|
':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
|
// Loop through all the arguments after the title
|
||||||
// Add them to the optionString, with their index turned into a number emoji
|
// Add them to the optionString, with their index turned into a number emoji
|
||||||
// Example: :one: Option 1
|
// Example: :one: Option 1
|
||||||
for (let i = 1; i < args.length; i++) {
|
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
|
// 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)
|
.setColor(embedColor)
|
||||||
.setDescription(`**${title}**\n\n${optionString}`);
|
.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
|
// the bot will determine how many to react with for the amount of options inputted
|
||||||
context.message.channel.send(embed).then(message => {
|
context.message.channel.send(embed).then(message => {
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
message.react("1️⃣");
|
message.react(reactionEmojis[1]);
|
||||||
} else if (args.length == 3) {
|
} else if (args.length == 3) {
|
||||||
message.react("1️⃣")
|
message.react(reactionEmojis[1])
|
||||||
.then(() => message.react("2️⃣"));
|
.then(() => message.react(reactionEmojis[2]));
|
||||||
} else if (args.length == 4) {
|
} else if (args.length == 4) {
|
||||||
message.react("1️⃣")
|
message.react(reactionEmojis[1])
|
||||||
.then(() => message.react("2️⃣"))
|
.then(() => message.react(reactionEmojis[2]))
|
||||||
.then(() => message.react("3️⃣"));
|
.then(() => message.react(reactionEmojis[3]));
|
||||||
} else if (args.length == 5) {
|
} else if (args.length == 5) {
|
||||||
message.react("1️⃣")
|
message.react(reactionEmojis[1])
|
||||||
.then(() => message.react("2️⃣"))
|
.then(() => message.react(reactionEmojis[2]))
|
||||||
.then(() => message.react("3️⃣"))
|
.then(() => message.react(reactionEmojis[3]))
|
||||||
.then(() => message.react("4️⃣"));
|
.then(() => message.react(reactionEmojis[4]));
|
||||||
} else if (args.length == 6) {
|
} else if (args.length == 6) {
|
||||||
message.react("1️⃣")
|
message.react(reactionEmojis[1])
|
||||||
.then(() => message.react("2️⃣"))
|
.then(() => message.react(reactionEmojis[2]))
|
||||||
.then(() => message.react("3️⃣"))
|
.then(() => message.react(reactionEmojis[3]))
|
||||||
.then(() => message.react("4️⃣"))
|
.then(() => message.react(reactionEmojis[4]))
|
||||||
.then(() => message.react("5️⃣"));
|
.then(() => message.react(reactionEmojis[5]));
|
||||||
} else if (args.length == 7) {
|
} else if (args.length == 7) {
|
||||||
message.react("1️⃣")
|
message.react(reactionEmojis[1])
|
||||||
.then(() => message.react("2️⃣"))
|
.then(() => message.react(reactionEmojis[2]))
|
||||||
.then(() => message.react("3️⃣"))
|
.then(() => message.react(reactionEmojis[3]))
|
||||||
.then(() => message.react("4️⃣"))
|
.then(() => message.react(reactionEmojis[4]))
|
||||||
.then(() => message.react("5️⃣"))
|
.then(() => message.react(reactionEmojis[5]))
|
||||||
.then(() => message.react("6️⃣"));
|
.then(() => message.react(reactionEmojis[6]));
|
||||||
} else if (args.length == 8) {
|
} else if (args.length == 8) {
|
||||||
message.react("1️⃣")
|
message.react(reactionEmojis[1])
|
||||||
.then(() => message.react("2️⃣"))
|
.then(() => message.react(reactionEmojis[2]))
|
||||||
.then(() => message.react("3️⃣"))
|
.then(() => message.react(reactionEmojis[3]))
|
||||||
.then(() => message.react("4️⃣"))
|
.then(() => message.react(reactionEmojis[4]))
|
||||||
.then(() => message.react("5️⃣"))
|
.then(() => message.react(reactionEmojis[5]))
|
||||||
.then(() => message.react("6️⃣"))
|
.then(() => message.react(reactionEmojis[6]))
|
||||||
.then(() => message.react("7️⃣"));
|
.then(() => message.react(reactionEmojis[7]));
|
||||||
} else if (args.length == 9) {
|
} else if (args.length == 9) {
|
||||||
message.react("1️⃣")
|
message.react(reactionEmojis[1])
|
||||||
.then(() => message.react("2️⃣"))
|
.then(() => message.react(reactionEmojis[2]))
|
||||||
.then(() => message.react("3️⃣"))
|
.then(() => message.react(reactionEmojis[3]))
|
||||||
.then(() => message.react("4️⃣"))
|
.then(() => message.react(reactionEmojis[4]))
|
||||||
.then(() => message.react("5️⃣"))
|
.then(() => message.react(reactionEmojis[5]))
|
||||||
.then(() => message.react("6️⃣"))
|
.then(() => message.react(reactionEmojis[6]))
|
||||||
.then(() => message.react("7️⃣"))
|
.then(() => message.react(reactionEmojis[7]))
|
||||||
.then(() => message.react("8️⃣"));
|
.then(() => message.react(reactionEmojis[8]));
|
||||||
} else if (args.length == 10) {
|
} else if (args.length == 10) {
|
||||||
message.react("1️⃣")
|
message.react(reactionEmojis[1])
|
||||||
.then(() => message.react("2️⃣"))
|
.then(() => message.react(reactionEmojis[2]))
|
||||||
.then(() => message.react("3️⃣"))
|
.then(() => message.react(reactionEmojis[3]))
|
||||||
.then(() => message.react("4️⃣"))
|
.then(() => message.react(reactionEmojis[4]))
|
||||||
.then(() => message.react("5️⃣"))
|
.then(() => message.react(reactionEmojis[5]))
|
||||||
.then(() => message.react("6️⃣"))
|
.then(() => message.react(reactionEmojis[6]))
|
||||||
.then(() => message.react("7️⃣"))
|
.then(() => message.react(reactionEmojis[7]))
|
||||||
.then(() => message.react("8️⃣"))
|
.then(() => message.react(reactionEmojis[8]))
|
||||||
.then(() => message.react("9️⃣"));
|
.then(() => message.react(reactionEmojis[9]));
|
||||||
}
|
}
|
||||||
}).catch(console.error);
|
}).catch(console.error);
|
||||||
|
|
||||||
// Delete the message
|
// Delete the message
|
||||||
context.message.delete();
|
context.message.delete();
|
||||||
} else if (args.length >= 11) { // If the user inputted more than 9 options
|
} 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");
|
.setDescription("The poll command can only accept up to 9 options");
|
||||||
|
|
||||||
context.message.channel.send(errorEmbed);
|
context.message.channel.send(errorEmbed);
|
||||||
} else { // If the user didn't give enough data
|
} 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)");
|
.setDescription("Please use the correct usage: <title>;<option 1>;<option 2>... (separate options with semicolons)");
|
||||||
|
|
||||||
context.message.channel.send(errorEmbed);
|
context.message.channel.send(errorEmbed);
|
||||||
|
|
|
@ -21,7 +21,7 @@ class role extends command {
|
||||||
// Run method
|
// Run method
|
||||||
role(context) {
|
role(context) {
|
||||||
// Get the array containing the assignable roles
|
// Get the array containing the assignable roles
|
||||||
let roles = context.client.config.role.assignable;
|
const roles = context.client.config.role.assignable;
|
||||||
let requestedRole = "";
|
let requestedRole = "";
|
||||||
|
|
||||||
// If the arguments specifys a specific role
|
// If the arguments specifys a specific role
|
||||||
|
@ -37,13 +37,13 @@ class role extends command {
|
||||||
// If a matching assignable role was found
|
// If a matching assignable role was found
|
||||||
if (requestedRole != "") {
|
if (requestedRole != "") {
|
||||||
// Get the role object from the server with the role name
|
// 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
|
// If the user already has the role, remove the role from them and send an embed
|
||||||
// Otherwise, add the role and send an embed
|
// Otherwise, add the role and send an embed
|
||||||
if (context.message.member.roles.cache.find(r => r.name == requestedRole)) {
|
if (context.message.member.roles.cache.find(r => r.name == requestedRole)) {
|
||||||
context.message.member.roles.remove(role).then(() => {
|
context.message.member.roles.remove(role).then(() => {
|
||||||
let embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setDescription(`Removed role: ${requestedRole}`);
|
.setDescription(`Removed role: ${requestedRole}`);
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class role extends command {
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|
||||||
let errorEmbed = new MessageEmbed()
|
const errorEmbed = new MessageEmbed()
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setDescription("An error occured. Please check logs");
|
.setDescription("An error occured. Please check logs");
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ class role extends command {
|
||||||
});
|
});
|
||||||
} else { // If the user doesn't have the role
|
} else { // If the user doesn't have the role
|
||||||
context.message.member.roles.add(role).then(() => {
|
context.message.member.roles.add(role).then(() => {
|
||||||
let embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setDescription(`Gave role: ${requestedRole}`);
|
.setDescription(`Gave role: ${requestedRole}`);
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class role extends command {
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|
||||||
let errorEmbed = new MessageEmbed()
|
const errorEmbed = new MessageEmbed()
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setDescription("An error occured. Please check logs");
|
.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
|
} else { // If the role can't be found, send an error embed
|
||||||
let embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setDescription("This role does not exist, see assignable roles with the role command (no arguments)");
|
.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
|
// Create an embed containing the text
|
||||||
let embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setTitle("Roles")
|
.setTitle("Roles")
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setDescription(rolesString);
|
.setDescription(rolesString);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Required components
|
// Required Components
|
||||||
const { command } = require('vylbot-core');
|
const { command } = require('vylbot-core');
|
||||||
const { MessageEmbed } = require('discord.js');
|
const { MessageEmbed } = require('discord.js');
|
||||||
const { existsSync, readFileSync } = require('fs');
|
const { existsSync, readFileSync } = require('fs');
|
||||||
|
@ -12,7 +12,7 @@ class rules extends command {
|
||||||
// Set the command's run method, description, and category
|
// Set the command's run method, description, and category
|
||||||
super("rules");
|
super("rules");
|
||||||
super.description = "Generates the rules embeds from the rules.txt file";
|
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
|
// Require in the config the name of the admin role and the rules file name
|
||||||
super.requiredConfigs = "adminrole";
|
super.requiredConfigs = "adminrole";
|
||||||
|
@ -34,19 +34,19 @@ class rules extends command {
|
||||||
for (let i = 0; i < rulesText.length; i++) {
|
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 the first line after "> " has a "#", create and embed with an image of the url specified after
|
||||||
if (rulesText[i].charAt(0) == '#') {
|
if (rulesText[i].charAt(0) == '#') {
|
||||||
let embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setImage(rulesText[i].substring(1));
|
.setImage(rulesText[i].substring(1));
|
||||||
|
|
||||||
context.message.channel.send(embed);
|
context.message.channel.send(embed);
|
||||||
} else { // If the file doesn't have a "#" at the start
|
} 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
|
// 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");
|
const rulesLines = rulesText[i].split("\n");
|
||||||
let rulesTitle = rulesLines[0];
|
const rulesTitle = rulesLines[0];
|
||||||
let rulesDescription = rulesLines.slice(1).join("\n");
|
const rulesDescription = rulesLines.slice(1).join("\n");
|
||||||
|
|
||||||
// Create the embed with the specified information above
|
// Create the embed with the specified information above
|
||||||
let embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setTitle(rulesTitle)
|
.setTitle(rulesTitle)
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setDescription(rulesDescription);
|
.setDescription(rulesDescription);
|
||||||
|
@ -56,14 +56,14 @@ class rules extends command {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { // If the rules file doesn't exist
|
} else { // If the rules file doesn't exist
|
||||||
let errorEmbed = new MessageEmbed()
|
const errorEmbed = new MessageEmbed()
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setDescription(`${context.client.config.rules.rulesfile} doesn't exist`);
|
.setDescription(`${context.client.config.rules.rulesfile} doesn't exist`);
|
||||||
|
|
||||||
context.message.channel.send(errorEmbed);
|
context.message.channel.send(errorEmbed);
|
||||||
}
|
}
|
||||||
} else { // If the user doesn't have the Admin role
|
} else { // If the user doesn't have the Admin role
|
||||||
let errorEmbed = new MessageEmbed()
|
const errorEmbed = new MessageEmbed()
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setDescription("You do not have permission to run this command");
|
.setDescription("You do not have permission to run this command");
|
||||||
|
|
||||||
|
|
|
@ -24,28 +24,28 @@ class unmute extends command {
|
||||||
// Check if the user has the mod role
|
// Check if the user has the mod role
|
||||||
if (context.message.member.roles.cache.find(role => role.name == context.client.config.mute.modrole)) {
|
if (context.message.member.roles.cache.find(role => role.name == context.client.config.mute.modrole)) {
|
||||||
// Get the user first pinged in the message
|
// 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 the user object exists
|
||||||
if (user) {
|
if (user) {
|
||||||
// Get the guild member object from the pinged 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 the member object exists, i.e. if the user is in the server
|
||||||
if (member) {
|
if (member) {
|
||||||
// Get the part of the argument array which contains the reason
|
// Get the part of the argument array which contains the reason
|
||||||
let reasonArgs = context.arguments;
|
const reasonArgs = context.arguments;
|
||||||
reasonArgs.splice(0, 1);
|
reasonArgs.splice(0, 1);
|
||||||
|
|
||||||
// Join the array into a string
|
// Join the array into a string
|
||||||
let reason = reasonArgs.join(" ");
|
const reason = reasonArgs.join(" ");
|
||||||
|
|
||||||
// If the server is available
|
// If the server is available
|
||||||
if (context.message.guild.available) {
|
if (context.message.guild.available) {
|
||||||
// If the bot client can manage the user
|
// If the bot client can manage the user
|
||||||
if (member.manageable) {
|
if (member.manageable) {
|
||||||
// The embed to go into the bot log
|
// The embed to go into the bot log
|
||||||
let embedLog = new MessageEmbed()
|
const embedLog = new MessageEmbed()
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setTitle("Member Unmuted")
|
.setTitle("Member Unmuted")
|
||||||
.addField("User", `${user} \`${user.tag}\``, true)
|
.addField("User", `${user} \`${user.tag}\``, true)
|
||||||
|
@ -54,13 +54,13 @@ class unmute extends command {
|
||||||
.setThumbnail(user.displayAvatarURL);
|
.setThumbnail(user.displayAvatarURL);
|
||||||
|
|
||||||
// The embed to go into the channel the command was sent in
|
// The embed to go into the channel the command was sent in
|
||||||
let embedPublic = new MessageEmbed()
|
const embedPublic = new MessageEmbed()
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setDescription(`${user} has been unmuted`)
|
.setDescription(`${user} has been unmuted`)
|
||||||
.addField("Reason", reason || "*none*");
|
.addField("Reason", reason || "*none*");
|
||||||
|
|
||||||
// Get the muted role
|
// 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
|
// Attempt to remove the role from the user, and then send the embeds. If unsuccessful log the error
|
||||||
member.roles.remove(mutedRole, reason).then(() => {
|
member.roles.remove(mutedRole, reason).then(() => {
|
||||||
|
@ -88,7 +88,7 @@ class unmute extends command {
|
||||||
|
|
||||||
// Send an embed in case of an error
|
// Send an embed in case of an error
|
||||||
function errorEmbed(context, message) {
|
function errorEmbed(context, message) {
|
||||||
let embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setDescription(message);
|
.setDescription(message);
|
||||||
|
|
|
@ -23,26 +23,26 @@ class warn extends command {
|
||||||
// If the user has the mod role
|
// If the user has the mod role
|
||||||
if (context.message.member.roles.cache.find(role => role.name == context.client.config.warn.modrole)) {
|
if (context.message.member.roles.cache.find(role => role.name == context.client.config.warn.modrole)) {
|
||||||
// Get the user first pinged in the message
|
// 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 the user object exists
|
||||||
if (user) {
|
if (user) {
|
||||||
// Get the guild member object from the 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 the member object exists. i.e. if the user is in the server
|
||||||
if (member) {
|
if (member) {
|
||||||
// Get the part of the argument array which the reason is in
|
// Get the part of the argument array which the reason is in
|
||||||
let reasonArgs = context.arguments;
|
const reasonArgs = context.arguments;
|
||||||
reasonArgs.splice(0, 1);
|
reasonArgs.splice(0, 1);
|
||||||
|
|
||||||
// Join the array into a string
|
// Join the array into a string
|
||||||
let reason = reasonArgs.join(" ");
|
const reason = reasonArgs.join(" ");
|
||||||
|
|
||||||
// If the server is available
|
// If the server is available
|
||||||
if (context.message.guild.available) {
|
if (context.message.guild.available) {
|
||||||
// The embed to go into the bot log
|
// The embed to go into the bot log
|
||||||
let embedLog = new MessageEmbed()
|
const embedLog = new MessageEmbed()
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setTitle("Member Warned")
|
.setTitle("Member Warned")
|
||||||
.addField("User", `${user} \`${user.tag}\``, true)
|
.addField("User", `${user} \`${user.tag}\``, true)
|
||||||
|
@ -51,7 +51,7 @@ class warn extends command {
|
||||||
.setThumbnail(user.displayAvatarURL);
|
.setThumbnail(user.displayAvatarURL);
|
||||||
|
|
||||||
// The embed to go into the channel the command was sent in
|
// The embed to go into the channel the command was sent in
|
||||||
let embedPublic = new MessageEmbed()
|
const embedPublic = new MessageEmbed()
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setDescription(`${user} has been warned`)
|
.setDescription(`${user} has been warned`)
|
||||||
.addField("Reason", reason || "*none*");
|
.addField("Reason", reason || "*none*");
|
||||||
|
@ -76,7 +76,7 @@ class warn extends command {
|
||||||
|
|
||||||
// Send an embed in case of an error
|
// Send an embed in case of an error
|
||||||
function errorEmbed(context, message) {
|
function errorEmbed(context, message) {
|
||||||
let embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.setDescription(message);
|
.setDescription(message);
|
||||||
|
|
54
config.template.json
Normal file
54
config.template.json
Normal 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
14
data/partner/partner.json
Normal 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"
|
||||||
|
}
|
||||||
|
]
|
|
@ -8,32 +8,24 @@ All servers are required to follow the Discord Terms of Service. This includes m
|
||||||
- **English Only**
|
- **English Only**
|
||||||
In order for everyone to understand each other we would like to ask everyone to speak in English only.
|
In order for everyone to understand each other we would like to ask everyone to speak in English only.
|
||||||
|
|
||||||
- **No NSFW content**
|
- **No NSFW or Obscene Content**
|
||||||
Please keep all content SFW, including profile pictures, usernames, and nicknames.
|
This includes text, images, or links featuring nudity, sex, hard violence, or other graphically disturbing content.
|
||||||
|
|
||||||
- **No Excessive Swearing**
|
- **Treat Everyone with Respect**
|
||||||
You may swear in moderation, but please don't overdo it.
|
Absolutely no harassment, witch hunting, sexism, racism, or hate speech will be tolerated.
|
||||||
|
|
||||||
- **Do Not Spam**
|
- **No spam or self promotion**
|
||||||
This includes posting repeatedly the same text in a short amount of time, copypastas, etc.
|
Outside of #self-promo. This includes DMing fellow members.
|
||||||
|
|
||||||
- **Caps Lock**
|
- **Keep Politics to #general**
|
||||||
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.
|
And make sure it doesn't become too heated. Debate don't argue.
|
||||||
|
|
||||||
- **Toxicity**
|
- **Drama From Other Servers**
|
||||||
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**
|
|
||||||
Please don't bring up drama from other servers, keep that to DMs
|
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
|
> 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).
|
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
|
> Supporters
|
||||||
|
@ -45,4 +37,5 @@ Notify: Get pinged when a new stream or video releases.
|
||||||
YouTube: https://www.youtube.com/channel/UCwPlzKwCmP5Q9bCX3fHk2BA
|
YouTube: https://www.youtube.com/channel/UCwPlzKwCmP5Q9bCX3fHk2BA
|
||||||
Patreon: https://www.patreon.com/vylpes
|
Patreon: https://www.patreon.com/vylpes
|
||||||
Twitch: https://www.twitch.tv/vylpes_
|
Twitch: https://www.twitch.tv/vylpes_
|
||||||
Twitter: https://twitter.com/vylpes
|
Twitter: https://twitter.com/vylpes
|
||||||
|
|
|
@ -4,7 +4,7 @@ const { MessageEmbed } = require('discord.js');
|
||||||
|
|
||||||
// Event variables
|
// Event variables
|
||||||
const embedColor = "0x3050ba";
|
const embedColor = "0x3050ba";
|
||||||
const logchannel = "logs";
|
const logchannel = "member-logs";
|
||||||
|
|
||||||
// Event class
|
// Event class
|
||||||
class guildmemberadd extends event {
|
class guildmemberadd extends event {
|
||||||
|
@ -16,7 +16,7 @@ class guildmemberadd extends event {
|
||||||
// Run method
|
// Run method
|
||||||
guildmemberadd(member) {
|
guildmemberadd(member) {
|
||||||
// Create an embed with the user who joined's information
|
// Create an embed with the user who joined's information
|
||||||
let embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setTitle("Member Joined")
|
.setTitle("Member Joined")
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.addField("User", `${member} \`${member.user.tag}\``)
|
.addField("User", `${member} \`${member.user.tag}\``)
|
||||||
|
|
|
@ -4,7 +4,7 @@ const { MessageEmbed } = require('discord.js');
|
||||||
|
|
||||||
// Event variables
|
// Event variables
|
||||||
const embedColor = "0x3050ba";
|
const embedColor = "0x3050ba";
|
||||||
const logchannel = "logs";
|
const logchannel = "member-logs";
|
||||||
|
|
||||||
// Event class
|
// Event class
|
||||||
class guildmemberremove extends event {
|
class guildmemberremove extends event {
|
||||||
|
@ -16,7 +16,7 @@ class guildmemberremove extends event {
|
||||||
// Run method
|
// Run method
|
||||||
guildmemberremove(member) {
|
guildmemberremove(member) {
|
||||||
// Create an embed with the user's information
|
// Create an embed with the user's information
|
||||||
let embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setTitle("Member Left")
|
.setTitle("Member Left")
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.addField("User", `${member} \`${member.user.tag}\``)
|
.addField("User", `${member} \`${member.user.tag}\``)
|
||||||
|
|
|
@ -4,7 +4,7 @@ const { MessageEmbed } = require('discord.js');
|
||||||
|
|
||||||
// Event variables
|
// Event variables
|
||||||
const embedColor = "0x3050ba";
|
const embedColor = "0x3050ba";
|
||||||
const logchannel = "logs";
|
const logchannel = "member-logs";
|
||||||
|
|
||||||
// Event class
|
// Event class
|
||||||
class guildmemberupdate extends event {
|
class guildmemberupdate extends event {
|
||||||
|
@ -19,12 +19,11 @@ class guildmemberupdate extends event {
|
||||||
if (oldMember.nickname != newMember.nickname) {
|
if (oldMember.nickname != newMember.nickname) {
|
||||||
// Get the user's name with tag, their old nickname and their new 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
|
// If they didn't have a nickname or they removed it, set it to "none" in italics
|
||||||
let memberName = newMember.user.tag;
|
const oldNickname = oldMember.nickname || "*none*";
|
||||||
let oldNickname = oldMember.nickname || "*none*";
|
const newNickname = newMember.nickname || "*none*";
|
||||||
let newNickname = newMember.nickname || "*none*";
|
|
||||||
|
|
||||||
// Create the embed with the user's information
|
// Create the embed with the user's information
|
||||||
let embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setTitle("Nickname Changed")
|
.setTitle("Nickname Changed")
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.addField("User", `${newMember} \`${newMember.user.tag}\``)
|
.addField("User", `${newMember} \`${newMember.user.tag}\``)
|
||||||
|
@ -34,7 +33,7 @@ class guildmemberupdate extends event {
|
||||||
.setThumbnail(newMember.user.displayAvatarURL({ type: 'png', dynamic: true }));
|
.setThumbnail(newMember.user.displayAvatarURL({ type: 'png', dynamic: true }));
|
||||||
|
|
||||||
// Send the embed in the log channel
|
// 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ const { MessageEmbed } = require('discord.js');
|
||||||
|
|
||||||
// Event variables
|
// Event variables
|
||||||
const embedColor = "0x3050ba";
|
const embedColor = "0x3050ba";
|
||||||
const logchannel = "logs";
|
const logchannel = "message-logs";
|
||||||
|
|
||||||
// Event class
|
// Event class
|
||||||
class messagedelete extends event {
|
class messagedelete extends event {
|
||||||
|
@ -16,7 +16,7 @@ class messagedelete extends event {
|
||||||
// Run method
|
// Run method
|
||||||
messagedelete(message) {
|
messagedelete(message) {
|
||||||
// Create an embed with the message's information
|
// Create an embed with the message's information
|
||||||
let embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setTitle("Message Deleted")
|
.setTitle("Message Deleted")
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.addField("User", `${message.author} \`${message.author.tag}\``)
|
.addField("User", `${message.author} \`${message.author.tag}\``)
|
||||||
|
|
|
@ -4,7 +4,7 @@ const { MessageEmbed } = require('discord.js');
|
||||||
|
|
||||||
// Event variables
|
// Event variables
|
||||||
const embedColor = "0x3050ba";
|
const embedColor = "0x3050ba";
|
||||||
const logchannel = "logs";
|
const logchannel = "message-logs";
|
||||||
|
|
||||||
// Event class
|
// Event class
|
||||||
class messageupdate extends event {
|
class messageupdate extends event {
|
||||||
|
@ -20,8 +20,8 @@ class messageupdate extends event {
|
||||||
if (oldMessage.content == newMessage.content) return;
|
if (oldMessage.content == newMessage.content) return;
|
||||||
|
|
||||||
// Create an embed with the message's information
|
// Create an embed with the message's information
|
||||||
let embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setTitle("Message Embed")
|
.setTitle("Message Edited")
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
.addField("User", `${newMessage.author} \`${newMessage.author.tag}\``)
|
.addField("User", `${newMessage.author} \`${newMessage.author.tag}\``)
|
||||||
.addField("Channel", newMessage.channel)
|
.addField("Channel", newMessage.channel)
|
||||||
|
|
2372
package-lock.json
generated
2372
package-lock.json
generated
File diff suppressed because it is too large
Load diff
11
package.json
11
package.json
|
@ -1,11 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "vylbot-app",
|
"name": "vylbot-app",
|
||||||
"version": "1.0.0",
|
"version": "2.1.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "vylbot.js",
|
"main": "vylbot.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node vylbot.js",
|
"start": "node vylbot.js",
|
||||||
"test": "echo \"No tests specified\""
|
"lint": "eslint .",
|
||||||
|
"lint:fix": "eslint . --fix"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -18,7 +19,11 @@
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/Vylpes/vylbot-app#readme",
|
"homepage": "https://github.com/Vylpes/vylbot-app#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"random-puppy": "^1.1.0",
|
"emoji-regex": "^9.2.0",
|
||||||
|
"random-bunny": "^1.0.0",
|
||||||
"vylbot-core": "^1.0.4"
|
"vylbot-core": "^1.0.4"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "^7.17.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue