forked from embee/woomy
First commit, woop
This commit is contained in:
commit
ccaba7d925
87 changed files with 10282 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
node_modules
|
||||||
|
data
|
||||||
|
config.js
|
21
LICENSE.md
Normal file
21
LICENSE.md
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 mudkipscience
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
21
README.md
Normal file
21
README.md
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# Woomy
|
||||||
|
Woomy is a all-purpose discord bot built off the [guidebot](https://github.com/AnIdiotsGuide/guidebot) base and coded in node.js using discord.js.
|
||||||
|
|
||||||
|
# How to use
|
||||||
|
The easiest way to use Woomy is to invite it to your server with [this link.](https://discordapp.com/oauth2/authorize?client_id=435961704145485835&permissions=2134240503&scope=bot) It is hosted 24/7 and automatically updates itself when a new release is made available, making sure you always get the newest features.
|
||||||
|
|
||||||
|
Self hosting is generally not recommended, but instructions are provided below if you still wish to do so. Woomy's code will need to be modified before it will run on your machine.
|
||||||
|
|
||||||
|
# Requirements
|
||||||
|
- git
|
||||||
|
- node.js v8.0.0 or higher
|
||||||
|
- node-gyp build tools
|
||||||
|
- ffmpeg
|
||||||
|
|
||||||
|
# Installation
|
||||||
|
- Clone Woomy to your machine
|
||||||
|
- Run `npm i` in Woomy's directory
|
||||||
|
- Open config.js in your code editor and insert all the required information
|
||||||
|
|
||||||
|
# Contributing
|
||||||
|
If you wish to contribute to Woomy, please fork the repository and open a pull request.
|
BIN
media/sounds/WOOMY.mp3
Normal file
BIN
media/sounds/WOOMY.mp3
Normal file
Binary file not shown.
5617
package-lock.json
generated
Normal file
5617
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
49
package.json
Normal file
49
package.json
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
{
|
||||||
|
"name": "woomy",
|
||||||
|
"version": "0.5.0",
|
||||||
|
"description": "Discord bot made with <3 by mudkipscience#0001",
|
||||||
|
"main": "woomy.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
|
"start": "node woomy.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/mudkipscience/woomy.git"
|
||||||
|
},
|
||||||
|
"author": "mudkipscience",
|
||||||
|
"dependencies": {
|
||||||
|
"better-sqlite-pool": "^0.2.2",
|
||||||
|
"chalk": "^2.4.2",
|
||||||
|
"cpu-stats": "^1.0.0",
|
||||||
|
"dblapi.js": "^2.3.0",
|
||||||
|
"discord.js": "^11.5.1",
|
||||||
|
"enmap": "^4.8.1",
|
||||||
|
"ffmpeg": "0.0.4",
|
||||||
|
"ffmpeg-static": "^2.5.0",
|
||||||
|
"garfield": "^1.1.2",
|
||||||
|
"get-youtube-id": "^1.0.1",
|
||||||
|
"moment": "^2.24.0",
|
||||||
|
"moment-duration-format": "^2.2.2",
|
||||||
|
"node-opus": "^0.3.2",
|
||||||
|
"nodemon": "^2.0.2",
|
||||||
|
"npm": "^6.12.1",
|
||||||
|
"openweather-apis": "^4.0.0",
|
||||||
|
"opusscript": "0.0.7",
|
||||||
|
"prism-media": "^1.2.0",
|
||||||
|
"randomcolor": "^0.5.4",
|
||||||
|
"regex": "^0.1.1",
|
||||||
|
"relevant-urban": "^2.0.0",
|
||||||
|
"request": "^2.88.0",
|
||||||
|
"splat2api": "^1.4.0",
|
||||||
|
"urban": "^0.3.2",
|
||||||
|
"weather-js": "^2.0.0",
|
||||||
|
"youtube-info": "^1.3.2",
|
||||||
|
"yt-search": "^0.4.1",
|
||||||
|
"ytdl-core": "^0.29.1",
|
||||||
|
"ytdl-core-discord": "github:amishshah/ytdl-core-discord"
|
||||||
|
}
|
||||||
|
}
|
45
src/commands/8ball.js
Normal file
45
src/commands/8ball.js
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
exports.run = async (client, message, args) => {
|
||||||
|
if (!args[0])
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> You did not ask me a question. Usage: \`${client.commands.get(`8ball`).help.usage}\``
|
||||||
|
);
|
||||||
|
|
||||||
|
var ball = [
|
||||||
|
"No darndested clue.",
|
||||||
|
"Stupid question. You should be ashamed of yourself for even asking.",
|
||||||
|
"Yes!",
|
||||||
|
"Not in your wildest dreams!",
|
||||||
|
"No chance.",
|
||||||
|
"Never.",
|
||||||
|
"Just Google it.",
|
||||||
|
"¯\\_(ツ)_/¯",
|
||||||
|
"Possibly.",
|
||||||
|
"There's a high chance.",
|
||||||
|
"I'd rather not say."
|
||||||
|
];
|
||||||
|
|
||||||
|
let mess = ball.random();
|
||||||
|
var msg = message.content.toLowerCase();
|
||||||
|
|
||||||
|
if (msg.includes("is donald trump a good president".toLowerCase())) {
|
||||||
|
return message.channel.send(
|
||||||
|
":8ball: Stupid question. You should be ashamed of yourself for even asking."
|
||||||
|
);
|
||||||
|
};
|
||||||
|
message.channel.send(":8ball: " + mess);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "8ball",
|
||||||
|
category: "Fun",
|
||||||
|
description: "Consult the 8ball for advice.",
|
||||||
|
usage: "8ball [question]"
|
||||||
|
};
|
61
src/commands/about.js
Normal file
61
src/commands/about.js
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
|
||||||
|
const { version } = require("discord.js");
|
||||||
|
const moment = require("moment");
|
||||||
|
require("moment-duration-format");
|
||||||
|
|
||||||
|
exports.run = (client, message) => {
|
||||||
|
const duration = moment
|
||||||
|
.duration(client.uptime)
|
||||||
|
.format(" D [days], H [hrs], m [mins], s [secs]");
|
||||||
|
|
||||||
|
var mud = client.users.get(client.config.owners[0]).tag;
|
||||||
|
var flgx = client.users.get(client.config.owners[1]).tag;
|
||||||
|
var build;
|
||||||
|
var prefix;
|
||||||
|
|
||||||
|
if(message.guild) {
|
||||||
|
prefix = message.settings.prefix;
|
||||||
|
} else {
|
||||||
|
prefix = client.config.defaultSettings.prefix;
|
||||||
|
};
|
||||||
|
|
||||||
|
if(client.devmode == true) {
|
||||||
|
build = "development"
|
||||||
|
} else {
|
||||||
|
build = "production"
|
||||||
|
}
|
||||||
|
|
||||||
|
embed = new Discord.RichEmbed();
|
||||||
|
embed.setTitle(`Woomy`);
|
||||||
|
embed.setColor(client.embedColour(message));
|
||||||
|
embed.setDescription(
|
||||||
|
`Woomy is a multipurpose bot developed by ${mud} and ${flgx}. You can suggest new features by joining my support server,
|
||||||
|
or using \`${prefix}feedback\``
|
||||||
|
);
|
||||||
|
embed.addField(
|
||||||
|
"General", `users: \`${client.users.size}\`\nchannels: \`${client.channels.size}\`\nservers: \`${client.guilds.size}\`\ncommands: \`${client.commands.size}\`\nuptime: \`${duration}\``,true
|
||||||
|
);
|
||||||
|
embed.addField(
|
||||||
|
`Technical`, `RAM Usage: \`${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} MB\`\nOS: \`${require("os").type}\`\nbot version: \`${client.update.version} (${build})\`\ndiscord.js version: \`v${version}\`\nnode.js version: \`${process.version}\``,true
|
||||||
|
);
|
||||||
|
embed.addField(
|
||||||
|
"Links", "[Support](https://discord.gg/HCF8mdv) | [GitHub](https://github.com/mudkipscience/woomy) | [db.org](https://discordbots.org/bot/435961704145485835/vote) | [BFD](https://botsfordiscord.com/bots/435961704145485835/vote) | [top.gg](https://discordbotlist.com/bots/435961704145485835) | [discord.js](https://discord.js.org/#/) | [guidebot](https://github.com/AnIdiotsGuide/guidebot/)"
|
||||||
|
);
|
||||||
|
|
||||||
|
message.channel.send(embed);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: ["stats"],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "about",
|
||||||
|
category: "Utility",
|
||||||
|
description: "Information about the bot, as well as a couple of helpful links",
|
||||||
|
usage: "about"
|
||||||
|
};
|
35
src/commands/achievement.js
Normal file
35
src/commands/achievement.js
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
Discord = require("discord.js");
|
||||||
|
|
||||||
|
const url = "https://www.minecraftskinstealer.com/achievement/a.php";
|
||||||
|
|
||||||
|
exports.run = (client, message, args) => {
|
||||||
|
let text = args.join(" ");
|
||||||
|
|
||||||
|
if (!text) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> No text provided to turn into an achievement. Usage: \`${client.commands.get(`achievement`).help.usage}\``
|
||||||
|
);
|
||||||
|
};
|
||||||
|
message.channel.startTyping();
|
||||||
|
let params = "h=Achievement+Get%21&i=1&t=" + encodeURIComponent(text);
|
||||||
|
|
||||||
|
message.channel.send({
|
||||||
|
files: [new Discord.Attachment(url + "?" + params, "achievement.png")]
|
||||||
|
});
|
||||||
|
message.channel.stopTyping();
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: ["ATTACH_FILES"]
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "achievement",
|
||||||
|
category: "Fun",
|
||||||
|
description: "Generates an minecraft achievement.",
|
||||||
|
usage: "achievement [text]"
|
||||||
|
};
|
45
src/commands/activity.js
Normal file
45
src/commands/activity.js
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
exports.run = (client, message, args) => {
|
||||||
|
if(!args[0]) {
|
||||||
|
return message.channel.send(`<:error:466995152976871434> No arguments! Usage: \`${client.commands.get(`activity`).help.usage}\``)
|
||||||
|
}
|
||||||
|
if(client.lockActivity == true) {
|
||||||
|
activityLocked = "locked";
|
||||||
|
} else {
|
||||||
|
activityLocked = "unlocked";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(args[0] == "lock" && !args[1]) {
|
||||||
|
client.lockActivity = true;
|
||||||
|
return message.channel.send(
|
||||||
|
"<:success:466995111885144095> Activity has been locked will no longer change automatically."
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
if(args[0] == "unlock" && !args[1]) {
|
||||||
|
client.lockActivity = false;
|
||||||
|
return message.channel.send(
|
||||||
|
"<:success:466995111885144095> Activity has been unlocked and will begin changing automatically."
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
client.lockActivity = true;
|
||||||
|
client.user.setActivity(args.join(" "));
|
||||||
|
message.channel.send(
|
||||||
|
`<:success:466995111885144095> Activity locked and changed to \`${args.join(" ")}\`
|
||||||
|
`);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "Developer",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "activity",
|
||||||
|
category: "Owner",
|
||||||
|
description: "Changes the bot's activity and disables automatic changing of the activity",
|
||||||
|
usage: "activity [activity] **OR** activity [lock/unlock]"
|
||||||
|
};
|
62
src/commands/adminrole.js
Normal file
62
src/commands/adminrole.js
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
exports.run = async (client, message, args) => {
|
||||||
|
|
||||||
|
const settings = message.settings;
|
||||||
|
|
||||||
|
if (!client.settings.has(message.guild.id)) {
|
||||||
|
client.settings.set(message.guild.id, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
var adminRole = message.guild.roles.get(settings.adminRole)
|
||||||
|
|
||||||
|
if (!args[0]) {
|
||||||
|
if(!adminRole) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> There is no admin role set for this server. Please set one using \`${message.settings.prefix}adminrole <role>\``
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
message.channel.send(`The current admin role is: \`${adminRole.name}\``)
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
const joinedValue = args.join(" ");
|
||||||
|
if (joinedValue.length < 1) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> You didn't specify a role. Usage: \`${client.commands.get(`adminrole`).help.usage}\``
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (settings.adminRole != "None set" && joinedValue === adminRole.name) {
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> The admin role is already set to that!"
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
let roleExists = message.guild.roles.find(r => r.name === args.join(" "));
|
||||||
|
if (!roleExists) {
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> The specified role does not exist."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
client.settings.set(message.guild.id, roleExists.id, "adminRole");
|
||||||
|
|
||||||
|
message.channel.send(
|
||||||
|
`<:success:466995111885144095> The admin role has been set to \`${joinedValue}\`
|
||||||
|
`);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "Server Owner",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "adminrole",
|
||||||
|
category: "Configure",
|
||||||
|
description: "Sets the admin role for this server.",
|
||||||
|
usage: "adminrole [role]"
|
||||||
|
};
|
66
src/commands/autorole.js
Normal file
66
src/commands/autorole.js
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
exports.run = async (client, message, args) => {
|
||||||
|
|
||||||
|
const settings = message.settings;
|
||||||
|
|
||||||
|
if (!client.settings.has(message.guild.id)) {
|
||||||
|
client.settings.set(message.guild.id, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!message.channel.permissionsFor(client.user).has("MANAGE_ROLES")) {
|
||||||
|
return message.channel.send("<:error:466995152976871434> This command requires the `manage roles` permission to work.")
|
||||||
|
}
|
||||||
|
|
||||||
|
var autorole = message.guild.roles.get(settings.autorole)
|
||||||
|
|
||||||
|
if (!args[0]) {
|
||||||
|
if(!autorole) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> There is no autorole set for this server. Please set one using \`${message.settings.prefix}autorole <role>\``
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
message.channel.send(`Users recieve this role upon joining: \`${autorole.name}\``)
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
const joinedValue = args.join(" ");
|
||||||
|
if (joinedValue.length < 1) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> You didn't specify a role. Usage: \`${client.commands.get(`autorole`).help.usage}\``
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (settings.autorole != "off" && joinedValue === autorole.name) {
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> The autorole is already set to that!"
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
let roleExists = message.guild.roles.find(r => r.name === args.join(" "));
|
||||||
|
if (!roleExists) {
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> The specified role does not exist."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
client.settings.set(message.guild.id, roleExists.id, "autorole");
|
||||||
|
|
||||||
|
message.channel.send(
|
||||||
|
`<:success:466995111885144095> The autorole has been set to \`${joinedValue}\`
|
||||||
|
`);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "Administrator",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "autorole",
|
||||||
|
category: "Configure",
|
||||||
|
description: "Sets the autorole for this server.",
|
||||||
|
usage: "autorole <role> **OR** autorole off"
|
||||||
|
};
|
38
src/commands/avatar.js
Normal file
38
src/commands/avatar.js
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
exports.run = (client, message, args) => {
|
||||||
|
let user = message.mentions.users.first();
|
||||||
|
let users;
|
||||||
|
if (!args[0] || !message.guild) {
|
||||||
|
user = message.author;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!user && message.guild) {
|
||||||
|
users = client.searchForMembers(message.guild, args[0]);
|
||||||
|
if (users.length > 1) {
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> Found multiple users, please be more specific or mention the user instead."
|
||||||
|
);
|
||||||
|
} else if (users.length == 0) {
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> That user doesn't seem to exist, try again!"
|
||||||
|
);
|
||||||
|
};
|
||||||
|
user = users[0];
|
||||||
|
user = user.user;
|
||||||
|
}
|
||||||
|
message.channel.send(`**${user.tag}'s** avatar is: ${user.avatarURL}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: ["EMBED_LINKS"]
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "avatar",
|
||||||
|
category: "Utility",
|
||||||
|
description: "Gives you the specified users avatar.",
|
||||||
|
usage: "avatar <user>"
|
||||||
|
};
|
88
src/commands/ban.js
Normal file
88
src/commands/ban.js
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
exports.run = async (client, message, args) => {
|
||||||
|
const settings = (message.settings = client.getSettings(message.guild.id));
|
||||||
|
|
||||||
|
if(!args[0]) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> No username provided. Usage: \`${client.commands.get(`ban`).help.usage}\``
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
let user = message.mentions.members.first();
|
||||||
|
|
||||||
|
if (!user) {
|
||||||
|
let users;
|
||||||
|
users = client.searchForMembers(message.guild, args[0]);
|
||||||
|
if (users.length > 1)
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> Found multiple users! Please be more specific or mention the user instead."
|
||||||
|
);
|
||||||
|
else if (users.length == 0)
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> That user doesn't seem to exist. Try again!"
|
||||||
|
);
|
||||||
|
user = users[0];
|
||||||
|
};
|
||||||
|
if (user.user.id === client.user.id) {
|
||||||
|
return message.channel.send("lol no")
|
||||||
|
};
|
||||||
|
if (user.user.id === message.guild.owner.id) {
|
||||||
|
return message.channel.send("<:error:466995152976871434> You can't ban the owner!")
|
||||||
|
};
|
||||||
|
let moderator = message.guild.member(message.author)
|
||||||
|
if (user.highestRole.position >= moderator.highestRole.position && moderator.user.id !== message.guild.ownerID) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> You can't ban people higher ranked than yourself!`
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
let bot = message.guild.member(client.user)
|
||||||
|
if (user.highestRole.position >= bot.highestRole.position) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> I can't ban people who are higher ranked than me!`
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!user.bannable)
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> Specified user is not bannable."
|
||||||
|
);
|
||||||
|
|
||||||
|
let reason = args.slice(1).join(" ");
|
||||||
|
if (!reason) reason = `Banned by ${message.author.tag}`;
|
||||||
|
await user.ban(reason).catch(console.error);
|
||||||
|
message.channel.send(`<:success:466995111885144095> Banned \`${user.user.tag}\``);
|
||||||
|
|
||||||
|
if (settings.modlogsChannel !== "off") {
|
||||||
|
const channel = message.guild.channels.find(
|
||||||
|
channel => channel.name === settings.modlogsChannel
|
||||||
|
);
|
||||||
|
|
||||||
|
if (channel) {
|
||||||
|
let embed = new Discord.RichEmbed();
|
||||||
|
embed.setColor("#BC0057");
|
||||||
|
embed.setAuthor("User banned!", user.user.avatarURL);
|
||||||
|
embed.setDescription(`❯ User: ${user.user.tag} (${user.user.id})\n❯ Mod: ${message.author} (${message.author.id})\n
|
||||||
|
❯ Reason: ${reason}`)
|
||||||
|
try {
|
||||||
|
channel.send({ embed });
|
||||||
|
} catch (err) {
|
||||||
|
// probably no permissions to send messages/embeds there
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "Moderator",
|
||||||
|
requiredPerms: ["BAN_MEMBERS"]
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "ban",
|
||||||
|
category: "Moderation",
|
||||||
|
description: "Bans specified user.",
|
||||||
|
usage: "ban [user] <reason>"
|
||||||
|
};
|
114
src/commands/blacklist.js
Normal file
114
src/commands/blacklist.js
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
exports.run = async (client, message, [action, ...member]) => {
|
||||||
|
const settings = message.settings;
|
||||||
|
|
||||||
|
if(settings.blacklisted == "ARRAY") {
|
||||||
|
client.settings.set(message.guild.id, [], "blacklisted");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!action) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> You didn't tell me if I was meant to add or remove someone from the blacklist! Usage: \`${client.commands.get(`blacklist`).help.usage}\``
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
member = member.join(" ")
|
||||||
|
|
||||||
|
if(!member) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> You didn't tell me who to blacklist! Usage: \`${client.commands.get(`blacklist`).help.usage}\``
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
let user = message.mentions.members.first();
|
||||||
|
|
||||||
|
if(action == "add") {
|
||||||
|
if (!user) {
|
||||||
|
let users;
|
||||||
|
users = client.searchForMembers(message.guild, member);
|
||||||
|
if (users.length > 1)
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> Found multiple users! Please be more specific or mention the user instead."
|
||||||
|
);
|
||||||
|
else if (users.length == 0)
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> That user doesn't seem to exist. Try again!"
|
||||||
|
);
|
||||||
|
user = users[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
if(user.id === client.user.id) {
|
||||||
|
return message.channel.send('lol no');
|
||||||
|
};
|
||||||
|
|
||||||
|
if(user.id === message.member.id) {
|
||||||
|
return message.channel.send('<:error:466995152976871434> You can\'t blacklist yourself!');
|
||||||
|
};
|
||||||
|
|
||||||
|
let blacklisted = false;
|
||||||
|
|
||||||
|
if(settings.blacklisted.length > 0) {
|
||||||
|
settings.blacklisted.forEach(function(ID) {
|
||||||
|
if(ID == user.id) {
|
||||||
|
blacklisted = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if(blacklisted == true) {
|
||||||
|
return message.channel.send('<:error:466995152976871434> This person has already been blacklisted!');
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
client.settings.push(message.guild.id, user.id, "blacklisted")
|
||||||
|
|
||||||
|
return message.channel.send(`<:success:466995111885144095> Blacklisted \`${user.user.tag}\``)
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
if (action == "remove") {
|
||||||
|
if (!user) {
|
||||||
|
let users;
|
||||||
|
users = client.searchForMembers(message.guild, member);
|
||||||
|
if (users.length > 1)
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> Found multiple users! Please be more specific or mention the user instead."
|
||||||
|
);
|
||||||
|
else if (users.length == 0)
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> That user doesn't seem to exist. Try again!"
|
||||||
|
);
|
||||||
|
user = users[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
let blacklisted = false;
|
||||||
|
|
||||||
|
settings.blacklisted.forEach(function(ID) {
|
||||||
|
console.log("does this work")
|
||||||
|
if(ID == user.id) {
|
||||||
|
blacklisted = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if(blacklisted != true) {
|
||||||
|
return message.channel.send('<:error:466995152976871434> This user isn\'t blacklisted!');
|
||||||
|
};
|
||||||
|
|
||||||
|
client.settings.remove(message.guild.id, user.id, "blacklisted")
|
||||||
|
|
||||||
|
return message.channel.send(`<:success:466995111885144095> Removed \`${user.user.tag}\` from the blacklist.`)
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "Administrator",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "blacklist",
|
||||||
|
category: "Moderation",
|
||||||
|
description: "Allows you to configure Woomy's blacklist. Blacklisted users cannot use commands.",
|
||||||
|
usage: "blacklist [add/remove] [member]"
|
||||||
|
};
|
93
src/commands/bohemian_rhapsody.js
Normal file
93
src/commands/bohemian_rhapsody.js
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
const Discord = require("discord.js");
|
||||||
|
exports.run = async (client, message, args, level) => {
|
||||||
|
const lyrics = [
|
||||||
|
"Is this the real life?",
|
||||||
|
"i this just fantasy?",
|
||||||
|
"Caught in a landslide, no escape from reality",
|
||||||
|
"open your eyes, look up to the skies and see",
|
||||||
|
"I'm just a poor boy, I need no sympathy",
|
||||||
|
"because I'm easy come, easy go, little high, little low",
|
||||||
|
"Any way the wind blows doesn't really matter to me, to me",
|
||||||
|
"mama, just killed a man",
|
||||||
|
"Put a gun against his head, pulled my trigger, now he's dead",
|
||||||
|
"mama, life had just begun",
|
||||||
|
"But now I've gone and thrown it all away",
|
||||||
|
"mama, ooh, didn't mean to make you cry",
|
||||||
|
"If I'm not back again this time tomorrow",
|
||||||
|
"carry on, carry on as if nothing really matters",
|
||||||
|
"Too late, my time has come",
|
||||||
|
"sends shivers down my spine, body's aching all the time",
|
||||||
|
"Goodbye, everybody, I've got to go",
|
||||||
|
"gotta leave you all behind and face the truth",
|
||||||
|
"Mama, ooh, (Anyway the wind blows)",
|
||||||
|
"i don't wanna die",
|
||||||
|
"I sometimes wish I'd never been born at all",
|
||||||
|
"i see a little silhouetto of a man",
|
||||||
|
"Scaramouche! Scaramouche! will you do the Fandango?",
|
||||||
|
"thunderbolt and lightning, very, very fright'ning me",
|
||||||
|
"(Galileo) Galileo, (Galileo) Galileo, Galileo Figaro magnifico",
|
||||||
|
"i'm just a poor boy, nobody loves me",
|
||||||
|
"He's just a poor boy from a poor family",
|
||||||
|
"spare him his life from this monstrosity",
|
||||||
|
"Easy come, easy go, will you not let me go?",
|
||||||
|
"bismillah! No, we will not let you go",
|
||||||
|
"(Let him go!) Bismillah! We will not let you go",
|
||||||
|
"(let him go!) Bismillah! We will not let you go",
|
||||||
|
"(Let me go) Will not let you go",
|
||||||
|
"(let me go) Will not let you go",
|
||||||
|
"(Let me go) Ah",
|
||||||
|
"no, no, no, no, no, no, no",
|
||||||
|
"(Oh mamma mia, mamma mia) Mamma mia, let me go",
|
||||||
|
"beelzebub has the devil put aside for me, for me, for me!",
|
||||||
|
"So you think you can stone me and spit in my eye?",
|
||||||
|
"so you think you can love me and leave me to die?",
|
||||||
|
"Oh baby, can't do this to me, baby!",
|
||||||
|
"just gotta get out, just gotta get right outta here!",
|
||||||
|
"Nothing really matters, anyone can see",
|
||||||
|
"nothing really matters",
|
||||||
|
"Nothing really matters, to me",
|
||||||
|
"any way the wind blows"
|
||||||
|
];
|
||||||
|
|
||||||
|
var runtop = true;
|
||||||
|
var runbottom = false;
|
||||||
|
for(var br = 0; br < lyrics.length; br++) {
|
||||||
|
{
|
||||||
|
if (runtop === true) {
|
||||||
|
var response = await client.awaitReply(message, lyrics[br]);
|
||||||
|
response = response.toLowerCase();
|
||||||
|
runbottom = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (runbottom === true) {
|
||||||
|
if (response !== lyrics[br]) {
|
||||||
|
return message.channel.send("Those aren't the lyrics!");
|
||||||
|
}
|
||||||
|
runtop = false
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if (runtop === true) {
|
||||||
|
runtop = false
|
||||||
|
runbottom = true
|
||||||
|
} else if (runbottom === true) {
|
||||||
|
runtop = true
|
||||||
|
runbottom = false
|
||||||
|
};
|
||||||
|
};
|
||||||
|
message.channel.send("What a lovely duet!");
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: ["br"],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "bohemian_rhapsody",
|
||||||
|
category: "Fun",
|
||||||
|
description: "Queen kareoke",
|
||||||
|
usage: "bohemian_rhapsody"
|
||||||
|
};
|
18
src/commands/changelog.js
Normal file
18
src/commands/changelog.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
exports.run = (client, message) => {
|
||||||
|
message.channel.send(client.update.changelog)
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: ["updates"],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "changelog",
|
||||||
|
category: "Utility",
|
||||||
|
description: "Gives you the changes/features introduced with the latest update",
|
||||||
|
usage: "changelog"
|
||||||
|
};
|
29
src/commands/chatlogs.js
Normal file
29
src/commands/chatlogs.js
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
exports.run = async (client, message) => {
|
||||||
|
|
||||||
|
const settings = message.settings;
|
||||||
|
|
||||||
|
if (!client.settings.has(message.guild.id)) client.settings.set(message.guild.id, {});
|
||||||
|
|
||||||
|
if (message.channel.name !== settings.chatlogsChannel) {
|
||||||
|
client.settings.set(message.guild.id, message.channel.name, "chatlogsChannel")
|
||||||
|
message.channel.send(`<:success:466995111885144095> Chat logs will now be displayed in \`${message.channel.name}\``);
|
||||||
|
} else {
|
||||||
|
client.settings.set(message.guild.id, "off", "chatlogsChannel")
|
||||||
|
message.channel.send(`<:success:466995111885144095> Chat logs disabled.`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "Administrator",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "chatlogs",
|
||||||
|
category: "Configure",
|
||||||
|
description: "Enables chat logging in your server.",
|
||||||
|
usage: "chatlogs **OR** chatlogs off"
|
||||||
|
};
|
40
src/commands/colour.js
Normal file
40
src/commands/colour.js
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
const randomColour = require("randomcolor");
|
||||||
|
exports.run = async (client, message, args, level) => {
|
||||||
|
if(!args[0]) {
|
||||||
|
var colour = randomColour();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(args[0]) {
|
||||||
|
if(args[0].startsWith('#')) {
|
||||||
|
colour = args[0];
|
||||||
|
} else {
|
||||||
|
colour = `#${args[0]}`;
|
||||||
|
}
|
||||||
|
if(colour.length > 7) return message.channel.send(
|
||||||
|
`<:error:466995152976871434> Has to be a hex code! Usage: \`${client.commands.get(`colour`).help.usage}\``
|
||||||
|
);
|
||||||
|
if(colour.length < 7) return message.channel.send(
|
||||||
|
`<:error:466995152976871434> Has to be a hex code! Usage: \`${client.commands.get(`colour`).help.usage}\``
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
embed = new Discord.RichEmbed();
|
||||||
|
embed.setColor(colour);
|
||||||
|
embed.setDescription(colour)
|
||||||
|
message.channel.send(embed)
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: ["color"],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "colour",
|
||||||
|
category: "Utility",
|
||||||
|
description: "Gives you a random colour",
|
||||||
|
usage: "colour <hex>"
|
||||||
|
};
|
20
src/commands/credits.js
Normal file
20
src/commands/credits.js
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
exports.run = async (client, message, args) => {
|
||||||
|
message.channel.send(
|
||||||
|
`**Credits:**\n❯ \`mudkipscience#3739\` and \`FLGX#9896\`for developing the bot\n❯ \`An Idiots Guide\` for the Guidebot bot base\n❯ \`dellannie#6057\` for helping with the music commands\n❯ \`TheCakeChicken#9088\` and \`Tina the Cyclops girl#0064\` for helping me not suck at coding\n❯ \`AirVentTrent\` for the icon, find him on Instagram`
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "credits",
|
||||||
|
category: "Miscellaneous",
|
||||||
|
description: "Cool people",
|
||||||
|
usage: "credits"
|
||||||
|
};
|
114
src/commands/creeper.js
Normal file
114
src/commands/creeper.js
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
exports.run = async (client, message, args, level) => {
|
||||||
|
const lyrics = [
|
||||||
|
"Aw man",
|
||||||
|
"so we back in the mine",
|
||||||
|
"Got our pickaxe swinging from side to side",
|
||||||
|
"side side to side",
|
||||||
|
"This task a grueling one",
|
||||||
|
"hope to find some diamonds tonight night night",
|
||||||
|
"Diamonds tonight",
|
||||||
|
"heads up",
|
||||||
|
"You hear a sound turn around and look up",
|
||||||
|
"total shock fills your body",
|
||||||
|
"Oh no it's you again",
|
||||||
|
"i can never forget those eyes eyes eyes",
|
||||||
|
"Eyes-eye-eyes",
|
||||||
|
"cause baby tonight",
|
||||||
|
"The creeper's tryna steal all our stuff again",
|
||||||
|
"cause baby tonight",
|
||||||
|
"You grab your pick, shovel and bolt again",
|
||||||
|
"and run run until it's done done",
|
||||||
|
"Until the sun comes up in the morn",
|
||||||
|
"cause baby tonight",
|
||||||
|
"The creeper's tryna steal all our stuff again",
|
||||||
|
"just when you think you're safe",
|
||||||
|
"Overhear some hissing from right behind",
|
||||||
|
"right right behind",
|
||||||
|
"That's a nice life you have",
|
||||||
|
"shame it's gotta end at this time time time",
|
||||||
|
"Time-time-time-time",
|
||||||
|
"blows up",
|
||||||
|
"Then your health bar drops and you could use a one up",
|
||||||
|
"get inside, don't be tardy",
|
||||||
|
"So now you're stuck in there",
|
||||||
|
"half a heart is left, but don't die die die",
|
||||||
|
"Die-die-die",
|
||||||
|
"cause baby tonight",
|
||||||
|
"The creeper's tryna steal all our stuff again",
|
||||||
|
"cause baby tonight",
|
||||||
|
"You grab your pick shovel and bolt again",
|
||||||
|
"and run run until it's done done",
|
||||||
|
"Until the sun comes up in the morn",
|
||||||
|
"cause baby tonight?",
|
||||||
|
"The creeper's tryna steal all our stuff again",
|
||||||
|
"dig up diamonds and craft those diamonds",
|
||||||
|
"And make some armor, get it baby",
|
||||||
|
"go and forge that like you so MLG pro",
|
||||||
|
"The sword's made of diamonds, so come at me bro, huh",
|
||||||
|
"training in your room under the torchlight",
|
||||||
|
"Hone that form to get you ready for the big fight",
|
||||||
|
"every single day and the whole night",
|
||||||
|
"Creeper's out prowlin', hoo, alright",
|
||||||
|
"look at me, look at you",
|
||||||
|
"Take my revenge, that's what I'm gonna do",
|
||||||
|
"i'm a warrior baby, what else is new",
|
||||||
|
"And my blade's gonna tear through you, bring it",
|
||||||
|
"cause baby tonight",
|
||||||
|
"The creeper's tryna steal all our stuff again",
|
||||||
|
"(gather your stuff, yeah, let's take back the world)",
|
||||||
|
"Yeah baby tonight",
|
||||||
|
"grab your sword armor and go",
|
||||||
|
"Take your revenge",
|
||||||
|
"so fight fight like it's the last last night",
|
||||||
|
"Of your life life show them your bite",
|
||||||
|
"cause baby tonight",
|
||||||
|
"The creeper's tryna steal all our stuff again",
|
||||||
|
"cause baby tonight",
|
||||||
|
"You grab your pick shovel and bolt again",
|
||||||
|
"and run run until it's done done",
|
||||||
|
"Until the sun comes up in the morn",
|
||||||
|
"cause baby tonight",
|
||||||
|
"The creeper's tryna steal all our stuff again"
|
||||||
|
];
|
||||||
|
|
||||||
|
var runtop = true;
|
||||||
|
var runbottom = false;
|
||||||
|
for(var br = 0; br < lyrics.length; br++) {
|
||||||
|
{
|
||||||
|
if (runtop === true) {
|
||||||
|
var response = await client.awaitReply(message, lyrics[br]);
|
||||||
|
response = response.toLowerCase();
|
||||||
|
runbottom = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (runbottom === true) {
|
||||||
|
if (response !== lyrics[br]) {
|
||||||
|
return message.channel.send("Those aren't the lyrics!")
|
||||||
|
}
|
||||||
|
runtop = false
|
||||||
|
};
|
||||||
|
} if (runtop === true) {
|
||||||
|
runtop = false
|
||||||
|
runbottom = true
|
||||||
|
} else if (runbottom === true) {
|
||||||
|
runtop = true
|
||||||
|
runbottom = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
message.channel.send("What a lovely duet!")
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "creeper",
|
||||||
|
category: "Fun",
|
||||||
|
description: "Aww man",
|
||||||
|
usage: "creeper"
|
||||||
|
};
|
27
src/commands/echo.js
Normal file
27
src/commands/echo.js
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
exports.run = (client, message, args, level) => {
|
||||||
|
if(!args[0]) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> No message provided.
|
||||||
|
Usage: \`${client.commands.get(`echo`).help.usage}\``
|
||||||
|
);
|
||||||
|
};
|
||||||
|
if (message.content.includes("@everyone")) return message.channel.send(message.author);
|
||||||
|
const sayMessage = args.join(" ");
|
||||||
|
message.delete().catch(O_o => {});
|
||||||
|
message.channel.send(sayMessage);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: ["say"],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "echo",
|
||||||
|
category: "Fun",
|
||||||
|
description: "Makes Woomy copy what the user says.",
|
||||||
|
usage: "echo [message]"
|
||||||
|
};
|
51
src/commands/emojify.js
Normal file
51
src/commands/emojify.js
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
Discord = require("discord.js");
|
||||||
|
exports.run = (client, message, args) => {
|
||||||
|
if (!args[0]) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> You must include a message for me to emojify! Usage: \`${client.commands.get(`emojify`).help.usage}\``
|
||||||
|
);
|
||||||
|
};
|
||||||
|
const specialChars = {
|
||||||
|
'0': ':zero:',
|
||||||
|
'1': ':one:',
|
||||||
|
'2': ':two:',
|
||||||
|
'3': ':three:',
|
||||||
|
'4': ':four:',
|
||||||
|
'5': ':five:',
|
||||||
|
'6': ':six:',
|
||||||
|
'7': ':seven:',
|
||||||
|
'8': ':eight:',
|
||||||
|
'9': ':nine:',
|
||||||
|
'#': ':hash:',
|
||||||
|
'*': ':asterisk:',
|
||||||
|
'?': ':grey_question:',
|
||||||
|
'!': ':grey_exclamation:',
|
||||||
|
' ': ' '
|
||||||
|
};
|
||||||
|
|
||||||
|
const emojified = `${args.join(' ')}`.toLowerCase().split('').map(letter => {
|
||||||
|
if (/[a-z]/g.test(letter)) {
|
||||||
|
return `:regional_indicator_${letter}: `
|
||||||
|
} else if (specialChars[letter]) {
|
||||||
|
return `${specialChars[letter]} `
|
||||||
|
};
|
||||||
|
return letter
|
||||||
|
}).join('');
|
||||||
|
message.channel.send(emojified);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "emojify",
|
||||||
|
category: "Fun",
|
||||||
|
description: "Changes text into emojis",
|
||||||
|
usage: "emojify [message]"
|
||||||
|
};
|
25
src/commands/eval.js
Normal file
25
src/commands/eval.js
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
exports.run = async (client, message, args) => {
|
||||||
|
const code = args.join(" ");
|
||||||
|
try {
|
||||||
|
const evaled = eval(code);
|
||||||
|
const clean = await client.clean(client, evaled);
|
||||||
|
message.channel.send(`\`OUTPUT\` \`\`\`js\n${await clean}\n\`\`\``);
|
||||||
|
} catch (err) {
|
||||||
|
message.channel.send(`\`ERROR\` \`\`\`xl\n${await client.clean(client, err)}\n\`\`\``);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "Developer",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "eval",
|
||||||
|
category: "Owner",
|
||||||
|
description: "Evaluates arbitrary javascript.",
|
||||||
|
usage: "eval [code]"
|
||||||
|
};
|
28
src/commands/feedback.js
Normal file
28
src/commands/feedback.js
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
exports.run = (client, message, args, level) => {
|
||||||
|
if(!args[0]) return message.channel.send(`<:error:466995152976871434> You didn't give me any feedback! Usage: \`${client.commands.get(`feedback`).help.usage}\``)
|
||||||
|
const feedback = args.join(" ")
|
||||||
|
let guild = client.guilds.get("410990517841690625")
|
||||||
|
let channel = guild.channels.get("438825830949453824")
|
||||||
|
let embed = new Discord.RichEmbed()
|
||||||
|
.setTitle(`Feedback:`)
|
||||||
|
.setColor(client.embedColour(message))
|
||||||
|
.addField("User:",message.author.tag)
|
||||||
|
.addField("Feedback: ", feedback)
|
||||||
|
channel.send({embed: embed})
|
||||||
|
message.channel.send("<:success:466995111885144095> Your feedback has been sent to my developer. Thank you!")
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: ["suggest"],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "feedback",
|
||||||
|
category: "Miscellaneous",
|
||||||
|
description: "Send feedback to my developer.",
|
||||||
|
usage: "feedback [message]"
|
||||||
|
};
|
35
src/commands/flip.js
Normal file
35
src/commands/flip.js
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
exports.run = (client, message, args) => {
|
||||||
|
if(!args[0]) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> Invalid choice. Usage: \`${client.commands.get(`emojify`).help.usage}\``
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
if(args[0].toLowerCase() != "heads" || args[0].toLowerCase() != "tails") {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> Invalid choice. Usage: \`${client.commands.get(`emojify`).help.usage}\``
|
||||||
|
);
|
||||||
|
};
|
||||||
|
var coin = [
|
||||||
|
"Heads!",
|
||||||
|
"Tails!"
|
||||||
|
];
|
||||||
|
|
||||||
|
let mess = coin.random();
|
||||||
|
message.channel.send(mess);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "flip",
|
||||||
|
category: "Fun",
|
||||||
|
description: "Flips a coin!",
|
||||||
|
usage: "flip [heads/tails]"
|
||||||
|
};
|
28
src/commands/forceskip.js
Normal file
28
src/commands/forceskip.js
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
exports.run = (client, message) => {
|
||||||
|
let guild = client.music.getGuild(message.guild.id);
|
||||||
|
|
||||||
|
if(guild.queue.length < 1) return message.channel.send(
|
||||||
|
`<:error:466995152976871434> There is nothing for me to skip!`
|
||||||
|
);
|
||||||
|
skip_song(guild);
|
||||||
|
message.channel.send("<:skip:467216735356059660> Skipped the song!")
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "Moderator",
|
||||||
|
requiredPerms: ["SPEAK"]
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "forceskip",
|
||||||
|
category: "Music",
|
||||||
|
description: "Skips the currently playing song without requiring a vote.",
|
||||||
|
usage: "forceskip"
|
||||||
|
};
|
||||||
|
|
||||||
|
function skip_song(guild) {
|
||||||
|
guild.dispatcher.end();
|
||||||
|
}
|
21
src/commands/garfield.js
Normal file
21
src/commands/garfield.js
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
const garfield = require("garfield");
|
||||||
|
exports.run = async (client, message) => {
|
||||||
|
message.channel.send({ files: [garfield.random()] }).catch(() => message.channel.send(
|
||||||
|
"<:error:466995152976871434> API didn't respond, try again in a few seconds."
|
||||||
|
));
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: ["ATTACH_FILES"]
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "garfield",
|
||||||
|
category: "Fun",
|
||||||
|
description: "Sends you a random garfield comic",
|
||||||
|
usage: "garfield"
|
||||||
|
};
|
86
src/commands/giverole.js
Normal file
86
src/commands/giverole.js
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
exports.run = async (client, message, [member, ...role2add], query) => {
|
||||||
|
if (!member) {
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> Who am I meant to give a role?"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
let user = message.mentions.members.first();
|
||||||
|
let users;
|
||||||
|
if (!user) {
|
||||||
|
users = client.searchForMembers(message.guild, member);
|
||||||
|
if (users.length > 1)
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> Found multiple users! Please be more specific or mention the user instead."
|
||||||
|
);
|
||||||
|
else if (users.length == 0)
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> That user doesn't seem to exist. Try again!"
|
||||||
|
);
|
||||||
|
user = users[0];
|
||||||
|
}
|
||||||
|
let role = role2add.join(" ");
|
||||||
|
|
||||||
|
let gRole = message.guild.roles.find(r => r.name === role);
|
||||||
|
if (!gRole) {
|
||||||
|
return message.channel.send(`<:error:466995152976871434> That role doesn't seem to exist. Try again!`);
|
||||||
|
}
|
||||||
|
|
||||||
|
let moderator = message.guild.member(message.author)
|
||||||
|
if (gRole.position >= moderator.highestRole.position) {
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> You cannot give roles higher than your own!"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
var bot = message.guild.members.get(client.user.id)
|
||||||
|
if (gRole.position >= bot.highestRole.position) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> I cannot give roles higher than my own!`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (user.roles.has(gRole.id)) {
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> They already have that role!"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
await user.addRole(gRole.id);
|
||||||
|
message.channel.send(
|
||||||
|
`<:success:466995111885144095> Gave \`${user.user.tag}\` the \`${gRole.name}\` role.`
|
||||||
|
);
|
||||||
|
|
||||||
|
if (client.getSettings(message.guild.id).modlogsChannel !== "off") {
|
||||||
|
const channel = message.guild.channels.find(
|
||||||
|
channel => channel.name === client.getSettings(message.guild.id).modlogsChannel
|
||||||
|
);
|
||||||
|
|
||||||
|
if (channel) {
|
||||||
|
let embed = new Discord.RichEmbed();
|
||||||
|
embed.setColor("#00c09a");
|
||||||
|
embed.setAuthor("Role given:", user.user.avatarURL);
|
||||||
|
embed.setDescription(`❯ User: ${user} (${user.user.id})\n❯ Mod: ${message.author} (${message.author.id})\n❯ Role: ${gRole}`)
|
||||||
|
try {
|
||||||
|
channel.send({ embed });
|
||||||
|
} catch (err) {
|
||||||
|
// probably no permissions to send messages/embeds there
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: ["addrole"],
|
||||||
|
permLevel: "Moderator",
|
||||||
|
requiredPerms: ["MANAGE_ROLES"]
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "giverole",
|
||||||
|
category: "Moderation",
|
||||||
|
description: "Gives the user the specified role.",
|
||||||
|
usage: "giverole [user] [role]"
|
||||||
|
};
|
42
src/commands/goodbye.js
Normal file
42
src/commands/goodbye.js
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
exports.run = async (client, message, args, level) => {
|
||||||
|
|
||||||
|
const settings = message.settings;
|
||||||
|
if (!client.settings.has(message.guild.id)) client.settings.set(message.guild.id, {});
|
||||||
|
|
||||||
|
if (args[0]) {
|
||||||
|
const joinedValue = args.join(" ");
|
||||||
|
if (joinedValue === settings.welcomeMessage) return message.channel.send(
|
||||||
|
"<:error:466995152976871434> The leave message is already set to that!"
|
||||||
|
);
|
||||||
|
if (!client.settings.has(message.guild.id)) client.settings.set(message.guild.id, {});
|
||||||
|
if (joinedValue === "off") {
|
||||||
|
if (!client.settings.has(message.guild.id)) client.settings.set(message.guild.id, {});
|
||||||
|
client.settings.set(message.guild.id, "off", "leaveMessage");
|
||||||
|
return message.channel.send(`<:success:466995111885144095> Leave messages have been disabled.`);
|
||||||
|
}
|
||||||
|
client.settings.set(message.guild.id, joinedValue, "leaveMessage");
|
||||||
|
client.settings.set(message.guild.id, message.channel.id, "welcomeChannel")
|
||||||
|
message.channel.send(`<:success:466995111885144095> Set the leave message to \`${joinedValue}\``);
|
||||||
|
} else {
|
||||||
|
if (settings.leaveMessage === "off") {
|
||||||
|
message.channel.send(`Leave messages are off.`)
|
||||||
|
} else {
|
||||||
|
message.channel.send(`The current leave message is: \`${settings.leaveMessage}\``)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "Administrator",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "goodbye",
|
||||||
|
category: "Configure",
|
||||||
|
description: "Sets the leave message for this server. try using [[server]], [[user]] and [[members]] in your message!",
|
||||||
|
usage: "goodbye <message> **OR** goodbye off"
|
||||||
|
};
|
58
src/commands/hackban.js
Normal file
58
src/commands/hackban.js
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
exports.run = async (client, message, args) => {
|
||||||
|
const settings = (message.settings = client.getSettings(message.guild.id));
|
||||||
|
|
||||||
|
if(!args[0]) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> No user ID provided. Usage: \`${client.commands.get(`hackban`).help.usage}\``
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
user = client.users.get(args[0])
|
||||||
|
if(!user) {
|
||||||
|
return message.channel.send("<:error:466995152976871434> Invalid ID")
|
||||||
|
}
|
||||||
|
|
||||||
|
if(message.guild.member(args[0])) {
|
||||||
|
if(!message.guild.member(args[0]).bannable) {
|
||||||
|
return message.channel.send("<:error:466995152976871434> User is not bannable.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let reason = args.slice(1).join(" ");
|
||||||
|
if (!reason) reason = `Banned by ${message.author.tag}`;
|
||||||
|
await message.guild.ban(args[0], reason).catch(console.error);
|
||||||
|
message.channel.send(`<:success:466995111885144095> Hackbanned \`${user.tag}\``);
|
||||||
|
|
||||||
|
if (settings.modlogsChannel !== "off") {
|
||||||
|
const channel = message.guild.channels.find(
|
||||||
|
channel => channel.name === settings.modlogsChannel
|
||||||
|
);
|
||||||
|
|
||||||
|
if (channel) {
|
||||||
|
let embed = new Discord.RichEmbed();
|
||||||
|
embed.setColor("#7c0136");
|
||||||
|
embed.setAuthor("User preemptively banned!", user.avatarURL);
|
||||||
|
embed.setDescription(`❯ User: ${user.tag} (${user.id})\n❯ Mod: ${message.author} (${message.author.id})\n❯ Reason: ${reason}`)
|
||||||
|
try {
|
||||||
|
channel.send({ embed });
|
||||||
|
} catch (err) {
|
||||||
|
// probably no permissions to send messages/embeds there
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "Moderator",
|
||||||
|
requiredPerms: ["BAN_MEMBERS"]
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "hackban",
|
||||||
|
category: "Moderation",
|
||||||
|
description: "Ban users who are not in the server.",
|
||||||
|
usage: "ban [userID] <reason>"
|
||||||
|
};
|
168
src/commands/help.js
Normal file
168
src/commands/help.js
Normal file
|
@ -0,0 +1,168 @@
|
||||||
|
exports.run = (client, message, args, level) => {
|
||||||
|
embed = new Discord.RichEmbed();
|
||||||
|
embed.setColor(client.embedColour(message));
|
||||||
|
|
||||||
|
var ran = false;
|
||||||
|
var output = "";
|
||||||
|
var prefix;
|
||||||
|
var currentCategory;
|
||||||
|
|
||||||
|
if(message.guild) {
|
||||||
|
prefix = message.settings.prefix;
|
||||||
|
} else {
|
||||||
|
prefix = client.config.defaultSettings.prefix;
|
||||||
|
};
|
||||||
|
|
||||||
|
if(!args[0]) {
|
||||||
|
embed.setTitle("Command list");
|
||||||
|
embed.setDescription(`For more information on a specific command use \`${prefix}help <command>\`\nFor the full command list use \`${prefix}help all\`\n`);
|
||||||
|
|
||||||
|
const myCommands = message.guild ? client.commands.filter(
|
||||||
|
cmd => client.levelCache[cmd.conf.permLevel] <= level
|
||||||
|
) : client.commands.filter(
|
||||||
|
cmd => client.levelCache[cmd.conf.permLevel] <= level && cmd.conf.guildOnly !== true
|
||||||
|
);
|
||||||
|
|
||||||
|
const commandNames = myCommands.keyArray();
|
||||||
|
const longest = commandNames.reduce(
|
||||||
|
(long, str) => Math.max(long, str.length),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
|
const sorted = myCommands.array().sort(
|
||||||
|
(p, c) => p.help.category > c.help.category ? 1 : p.help.name > c.help.name && p.help.category === c.help.category ? 1 : -1
|
||||||
|
);
|
||||||
|
|
||||||
|
sorted.forEach( c => {
|
||||||
|
const cat = c.help.category.toProperCase();
|
||||||
|
if (currentCategory !== cat) {
|
||||||
|
if(ran == true) {
|
||||||
|
embed.addField(currentCategory + ":", output.slice(0, -6))
|
||||||
|
output = "";
|
||||||
|
}
|
||||||
|
currentCategory = cat;
|
||||||
|
ran = true
|
||||||
|
}
|
||||||
|
output += `\`${prefix}${c.help.name}\`**,** `;
|
||||||
|
});
|
||||||
|
|
||||||
|
embed.addField(currentCategory + ":", output.slice(0, -6));
|
||||||
|
|
||||||
|
embed.addField(
|
||||||
|
"Invite me",
|
||||||
|
"[Click here](https://discordapp.com/oauth2/authorize?client_id=435961704145485835&permissions=8&scope=bot) to add me to your server",
|
||||||
|
true
|
||||||
|
);
|
||||||
|
embed.addField(
|
||||||
|
"Support",
|
||||||
|
"[Click here](https://discord.gg/HCF8mdv) if bot broke",
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
message.channel.send(embed);
|
||||||
|
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
if(args[0].toLowerCase() == "all") {
|
||||||
|
embed.setTitle("Command list");
|
||||||
|
embed.setDescription(`For more information on a specific command use \`${prefix}help <command>\`\nFor the full command list use \`${prefix}help all\`\n`);
|
||||||
|
|
||||||
|
const myCommands = client.commands
|
||||||
|
|
||||||
|
const commandNames = myCommands.keyArray();
|
||||||
|
const longest = commandNames.reduce(
|
||||||
|
(long, str) => Math.max(long, str.length),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
|
const sorted = myCommands.array().sort(
|
||||||
|
(p, c) => p.help.category > c.help.category ? 1 : p.help.name > c.help.name && p.help.category === c.help.category ? 1 : -1
|
||||||
|
);
|
||||||
|
|
||||||
|
sorted.forEach( c => {
|
||||||
|
const cat = c.help.category.toProperCase();
|
||||||
|
if (currentCategory !== cat) {
|
||||||
|
if(ran == true) {
|
||||||
|
embed.addField(currentCategory + ":", output.slice(0, -6))
|
||||||
|
output = "";
|
||||||
|
}
|
||||||
|
currentCategory = cat;
|
||||||
|
ran = true
|
||||||
|
}
|
||||||
|
output += `\`${prefix}${c.help.name}\`**,** `;
|
||||||
|
});
|
||||||
|
|
||||||
|
embed.addField(currentCategory + ":", output.slice(0, -6));
|
||||||
|
|
||||||
|
embed.addField(
|
||||||
|
"Invite me",
|
||||||
|
"[Click here](https://discordapp.com/oauth2/authorize?client_id=435961704145485835&permissions=8&scope=bot) to add me to your server",
|
||||||
|
true
|
||||||
|
);
|
||||||
|
embed.addField(
|
||||||
|
"Support",
|
||||||
|
"[Click here](https://discord.gg/HCF8mdv) if bot broke",
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
message.channel.send(embed);
|
||||||
|
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
if(args[0]) {
|
||||||
|
let command = args.shift().toLowerCase();
|
||||||
|
let cmd = client.commands.get(command) || client.commands.get(client.aliases.get(command));
|
||||||
|
|
||||||
|
if(!client.commands.has(command)) {
|
||||||
|
return message.channel.send("<:error:466995152976871434> That command doesn't exist!")
|
||||||
|
};
|
||||||
|
|
||||||
|
command = client.commands.get(command);
|
||||||
|
|
||||||
|
var requiredPerms = "";
|
||||||
|
|
||||||
|
if(cmd.conf.requiredPerms.length > 0 ) {
|
||||||
|
requiredPerms = "`" + cmd.conf.requiredPerms.join("`, `") + "`";
|
||||||
|
} else {
|
||||||
|
requiredPerms = "None";
|
||||||
|
};
|
||||||
|
|
||||||
|
var aliases = "";
|
||||||
|
|
||||||
|
if(cmd.conf.aliases.length > 0 ) {
|
||||||
|
aliases = "`" + cmd.conf.aliases.join("`, `") + "`";
|
||||||
|
} else {
|
||||||
|
aliases = "None";
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
embed.setTitle(prefix + command.help.name);
|
||||||
|
embed.setDescription(
|
||||||
|
`❯ **Description:** ${command.help.description}\n❯ **Usage:** ${prefix + command.help.usage}\n❯ **Permission Level:** ${cmd.conf.permLevel} \n❯ **Guild Only:** ${cmd.conf.guildOnly}\n❯ **Aliases:** ${aliases}\n❯ **Required perms:** ${requiredPerms}`
|
||||||
|
);
|
||||||
|
embed.setFooter("Arguments in [] are required, <> are optional.");
|
||||||
|
|
||||||
|
message.channel.send(embed);
|
||||||
|
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: ["h", "cmds"],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: ["EMBED_LINKS"]
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "help",
|
||||||
|
category: "Utility",
|
||||||
|
description:
|
||||||
|
"Displays all the commands you are able to use.",
|
||||||
|
usage: "help <command> **OR** help all"
|
||||||
|
};
|
20
src/commands/invite.js
Normal file
20
src/commands/invite.js
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
exports.run = async (client, message) => {
|
||||||
|
message.channel.send(
|
||||||
|
`Use this link to invite me to your server:\n<https://discordapp.com/oauth2/authorize?client_id=${client.user.id}&permissions=2134240503&scope=bot>`
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "invite",
|
||||||
|
category: "Utility",
|
||||||
|
description: "Sends you a link so you can add Woomy to your own servers",
|
||||||
|
usage: "invite"
|
||||||
|
};
|
87
src/commands/kick.js
Normal file
87
src/commands/kick.js
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
exports.run = async (client, message, args) => {
|
||||||
|
const settings = client.getSettings(message.guild.id);
|
||||||
|
|
||||||
|
if(!args[0]) {
|
||||||
|
return message.channel.send("<:error:466995152976871434> Who am I meant to kick?")
|
||||||
|
}
|
||||||
|
|
||||||
|
let user = message.mentions.members.first();
|
||||||
|
|
||||||
|
if (!user) {
|
||||||
|
let users;
|
||||||
|
users = client.searchForMembers(message.guild, args[0]);
|
||||||
|
if (users.length > 1)
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> Found multiple users! Please be more specific or mention the user instead."
|
||||||
|
);
|
||||||
|
else if (users.length == 0)
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> That user doesn't seem to exist. Try again!"
|
||||||
|
);
|
||||||
|
user = users[0];
|
||||||
|
}
|
||||||
|
if (user.user.id === client.user.id) {
|
||||||
|
return message.channel.send("lol no")
|
||||||
|
}
|
||||||
|
if (user.user.id === message.guild.owner.id) {
|
||||||
|
return message.channel.send("<:error:466995152976871434> You can't kick the owner!")
|
||||||
|
}
|
||||||
|
let moderator = message.guild.member(message.author)
|
||||||
|
if (user.highestRole.position >= moderator.highestRole.position && moderator.user.id !== message.guild.ownerID) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> You can't kick people higher ranked than yourself!`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
let bot = message.guild.member(client.user)
|
||||||
|
if (user.highestRole.position >= bot.highestRole.position) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> I can't kick people who are higher ranked than me!`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!user.bannable)
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> Specified user is not bannable."
|
||||||
|
);
|
||||||
|
|
||||||
|
let reason = args.slice(1).join(" ");
|
||||||
|
if (!reason) reason = `Kicked by ${message.author.tag}`;
|
||||||
|
await user.kick(reason).catch(console.error);
|
||||||
|
message.channel.send(`<:success:466995111885144095> Kicked \`${user.user.tag}\``);
|
||||||
|
|
||||||
|
if (settings.modlogsChannel !== "off") {
|
||||||
|
const channel = message.guild.channels.find(
|
||||||
|
channel => channel.name === settings.modlogsChannel
|
||||||
|
);
|
||||||
|
|
||||||
|
if (channel) {
|
||||||
|
let embed = new Discord.RichEmbed();
|
||||||
|
embed.setColor("#fd0061");
|
||||||
|
embed.setAuthor("User kicked!", user.user.avatarURL);
|
||||||
|
embed.setDescription(
|
||||||
|
`❯ User: ${user.user.tag} (${user.user.id})\n❯ Mod: ${message.author} (${message.author.id})\n❯ Reason: ${reason}`
|
||||||
|
);
|
||||||
|
try {
|
||||||
|
channel.send({ embed });
|
||||||
|
} catch (err) {
|
||||||
|
// probably no permissions to send messages/embeds there
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "Moderator",
|
||||||
|
requiredPerms: ["KICK_MEMBERS"]
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "kick",
|
||||||
|
category: "Moderation",
|
||||||
|
description: "Kicks specified user.",
|
||||||
|
usage: "kick [user] <reason>"
|
||||||
|
};
|
45
src/commands/math.js
Normal file
45
src/commands/math.js
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
var allowed = ["+", "-", "*", "/", "(", ")", " "];
|
||||||
|
exports.run = (client, message, args) => {
|
||||||
|
let exercise = args.join(" ");
|
||||||
|
|
||||||
|
if (!exercise) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> No equation provided. Usage :\`${client.commands.get(`calculate`).help.usage}\``
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < exercise.length; i++) {
|
||||||
|
let c = exercise.charAt(i);
|
||||||
|
let found = allowed.find((element) => element === c);
|
||||||
|
|
||||||
|
if(c == "0") found = true;
|
||||||
|
if(!(Number(c) || found))
|
||||||
|
{
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> Invalid equation. Please use \`*\` for multiplication and \`/\` for division!`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let result = (new Function( 'return ' + exercise )());
|
||||||
|
if (exercise === "9+10" || exercise === "9 + 10") {
|
||||||
|
result = "21"
|
||||||
|
}
|
||||||
|
|
||||||
|
message.channel.send(`\`RESULTS:\`\n\`\`\`${result}\`\`\``);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: ["calculate"],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "math",
|
||||||
|
category: "Utility",
|
||||||
|
description: "Solves basic mathematical equations.",
|
||||||
|
usage: "math [equation]"
|
||||||
|
};
|
29
src/commands/modlogs.js
Normal file
29
src/commands/modlogs.js
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
exports.run = async (client, message) => {
|
||||||
|
|
||||||
|
const settings = message.settings;
|
||||||
|
|
||||||
|
if (!client.settings.has(message.guild.id)) client.settings.set(message.guild.id, {});
|
||||||
|
|
||||||
|
if (message.channel.name !== settings.modlogsChannel) {
|
||||||
|
client.settings.set(message.guild.id, message.channel.name, "modlogsChannel")
|
||||||
|
message.channel.send(`<:success:466995111885144095> Mod logs will now be displayed in \`${message.channel.name}\``);
|
||||||
|
} else {
|
||||||
|
client.settings.set(message.guild.id, "off", "modlogsChannel")
|
||||||
|
message.channel.send(`<:success:466995111885144095> Mod logging disabled.`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "Administrator",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "modlogs",
|
||||||
|
category: "Configure",
|
||||||
|
description: "Enables mod action logging in your server.",
|
||||||
|
usage: "modlogs **OR** modlogs off"
|
||||||
|
};
|
62
src/commands/modrole.js
Normal file
62
src/commands/modrole.js
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
exports.run = async (client, message, args) => {
|
||||||
|
|
||||||
|
const settings = message.settings;
|
||||||
|
|
||||||
|
if (!client.settings.has(message.guild.id)) {
|
||||||
|
client.settings.set(message.guild.id, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
var modRole = message.guild.roles.get(settings.modRole)
|
||||||
|
|
||||||
|
if (!args[0]) {
|
||||||
|
if(!modRole) {
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> There is no mod role set for this server. Please set one using `" + message.settings.prefix + "modrole <role>`"
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
message.channel.send(`The current mod role is: \`${modRole.name}\``)
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
const joinedValue = args.join(" ");
|
||||||
|
if (joinedValue.length < 1) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> You didn't specify a role. Usage: \`${client.commands.get(`modrole`).help.usage}\``
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (settings.modRole != "None set" && joinedValue === modRole.name) {
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> The mod role is already set to that!"
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
let roleExists = message.guild.roles.find(r => r.name === args.join(" "));
|
||||||
|
if (!roleExists) {
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> The specified role does not exist."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
client.settings.set(message.guild.id, roleExists.id, "modRole");
|
||||||
|
|
||||||
|
message.channel.send(
|
||||||
|
`<:success:466995111885144095> The mod role has been set to \`${joinedValue}\`
|
||||||
|
`);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "Administrator",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "modrole",
|
||||||
|
category: "Configure",
|
||||||
|
description: "Sets the mod role for this server.",
|
||||||
|
usage: "modrole <role>"
|
||||||
|
};
|
39
src/commands/msearch.js
Normal file
39
src/commands/msearch.js
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
exports.run = (client, message, args) => {
|
||||||
|
if (!args[0])
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> No username provided. Usage: \`${client.commands.get(``).help.usage}\``
|
||||||
|
);
|
||||||
|
var mlist = "";
|
||||||
|
var count = 0;
|
||||||
|
client.searchForMembers(message.guild, args[0]).forEach((member) => {
|
||||||
|
if (member) {
|
||||||
|
mlist += `\`${member.user.tag}\``;
|
||||||
|
count = count + 1;
|
||||||
|
}
|
||||||
|
mlist += "**, **";
|
||||||
|
});
|
||||||
|
mlist = mlist.substring(0, mlist.length - 6);
|
||||||
|
|
||||||
|
var mlist1 = `Found ${count} users:\n` + mlist;
|
||||||
|
|
||||||
|
if (!mlist1) {
|
||||||
|
return message.channel.send("<:error:466995152976871434> No users found!");
|
||||||
|
}
|
||||||
|
|
||||||
|
message.channel.send(mlist1);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "msearch",
|
||||||
|
category: "Utility",
|
||||||
|
description: "Search for server members.",
|
||||||
|
usage: "msearch [user]"
|
||||||
|
};
|
133
src/commands/mute.js
Normal file
133
src/commands/mute.js
Normal file
|
@ -0,0 +1,133 @@
|
||||||
|
exports.run = async (client, message, [args, ...reason], level) => {
|
||||||
|
const settings = message.settings;
|
||||||
|
|
||||||
|
if(!args) {
|
||||||
|
return message.channel.send("<:error:466995152976871434> Who am I meant to mute?")
|
||||||
|
}
|
||||||
|
let user = message.mentions.members.first();
|
||||||
|
let users;
|
||||||
|
if (!user) {
|
||||||
|
users = client.searchForMembers(message.guild, args);
|
||||||
|
if (users.length > 1)
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> Found multiple users! Please be more specific or mention the user instead."
|
||||||
|
);
|
||||||
|
else if (users.length == 0)
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> That user doesn't seem to exist. Try again!"
|
||||||
|
);
|
||||||
|
user = users[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
if (user.user.id === message.guild.ownerID) {
|
||||||
|
return message.channel.send("<:error:466995152976871434> You can't mute the owner!")
|
||||||
|
};
|
||||||
|
|
||||||
|
let moderator = message.guild.member(message.author)
|
||||||
|
if (message.settings.mutedRole.position >= moderator.highestRole.position && level < 2) {
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> The muted role is positioned above the moderator role! Please move the muted role below the moderator role."
|
||||||
|
);
|
||||||
|
};
|
||||||
|
if (user.highestRole.position >= moderator.highestRole.position && moderator.user.id !== message.guild.ownerID) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> You can't mute people who have a higher role than you!`
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
let bot = message.guild.member(client.user)
|
||||||
|
|
||||||
|
if (user.highestRole.position >= bot.highestRole.position) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> I can't mute people who have a higher role than me!`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
var role = message.guild.roles.get(settings.mutedRole);
|
||||||
|
var modrole = message.guild.roles.get(settings.modRole);
|
||||||
|
|
||||||
|
if(!role) {
|
||||||
|
if (!modrole.id) {
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> There is no mod role set for this server. Please set one using `" + message.settings.prefix + "modrole <role>` before using this command."
|
||||||
|
);
|
||||||
|
};
|
||||||
|
let rolepos = (modrole.position)
|
||||||
|
rolepos = rolepos-1
|
||||||
|
try {
|
||||||
|
role = await message.guild.createRole({
|
||||||
|
name: "Muted",
|
||||||
|
color: "#707fa5",
|
||||||
|
permissions: [],
|
||||||
|
position: rolepos
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch(e) {
|
||||||
|
client.logger.log(`Mute command error: \n${e}`, "error")
|
||||||
|
};
|
||||||
|
client.settings.set(message.guild.id, role.id, "mutedRole");
|
||||||
|
message.channel.send("Created a `Muted` role, since your server didn't have one.")
|
||||||
|
};
|
||||||
|
|
||||||
|
if (bot.highestRole.position <= role.position) {
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> The muted role is above my highest role! Please move the muted role below my highest role."
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
message.guild.channels.forEach(async (channel, id) => {
|
||||||
|
await channel.overwritePermissions(role, {
|
||||||
|
SEND_MESSAGES: false,
|
||||||
|
ADD_REACTIONS: false
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
if (user.roles.has(role.id)) {
|
||||||
|
return message.channel.send("<:error:466995152976871434> They're already muted!")
|
||||||
|
}
|
||||||
|
|
||||||
|
await user.addRole(role.id);
|
||||||
|
message.channel.send(`<:success:466995111885144095> Muted \`${user.user.tag}\``)
|
||||||
|
|
||||||
|
var muteReason = reason.join(" ");
|
||||||
|
|
||||||
|
if(muteReason.length == 0) {
|
||||||
|
muteReason = "**No reason provided.**"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.modlogsChannel !== "off") {
|
||||||
|
const channel = message.guild.channels.find(
|
||||||
|
channel => channel.name === settings.modlogsChannel
|
||||||
|
);
|
||||||
|
|
||||||
|
if (channel) {
|
||||||
|
let embed = new Discord.RichEmbed();
|
||||||
|
embed.setColor("#a652bb");
|
||||||
|
embed.setAuthor("User muted!", user.user.avatarURL);
|
||||||
|
embed.setDescription(
|
||||||
|
`❯ User: ${user} (${user.user.id})\n❯ Mod: ${message.author} (${message.author.id})\n
|
||||||
|
❯ Reason: ${muteReason}`
|
||||||
|
);
|
||||||
|
try {
|
||||||
|
channel.send({ embed });
|
||||||
|
} catch (err) {
|
||||||
|
// probably no permissions to send messages/embeds there
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: ["stfu"],
|
||||||
|
permLevel: "Moderator",
|
||||||
|
requiredPerms: ["MANAGE_ROLES", "MANAGE_CHANNELS"]
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "mute",
|
||||||
|
category: "Moderation",
|
||||||
|
description: "Prevents the specified user from typing.",
|
||||||
|
usage: "mute [member] <reason>"
|
||||||
|
};
|
62
src/commands/mutedrole.js
Normal file
62
src/commands/mutedrole.js
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
exports.run = async (client, message, args) => {
|
||||||
|
|
||||||
|
const settings = message.settings;
|
||||||
|
|
||||||
|
if (!client.settings.has(message.guild.id)) {
|
||||||
|
client.settings.set(message.guild.id, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
var mutedRole = message.guild.roles.get(settings.mutedRole)
|
||||||
|
|
||||||
|
if (!args[0]) {
|
||||||
|
if(!mutedRole) {
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> There is no muted role set for this server. Please set one using `" + message.settings.prefix + "mutedrole <role>`"
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
message.channel.send(`The current muted role is: \`${mutedRole.name}\``)
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
const joinedValue = args.join(" ");
|
||||||
|
if (joinedValue.length < 1) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> You didn't specify a role. Usage: \`${client.commands.get(`mutedRole`).help.usage}\``
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (settings.mutedRole != "None set" && joinedValue === mutedRole.name) {
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> The muted role is already set to that!"
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
let roleExists = message.guild.roles.find(r => r.name === args.join(" "));
|
||||||
|
if (!roleExists) {
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> The specified role does not exist."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
client.settings.set(message.guild.id, roleExists.id, "mutedRole");
|
||||||
|
|
||||||
|
message.channel.send(
|
||||||
|
`<:success:466995111885144095> The muted role has been set to \`${joinedValue}\`
|
||||||
|
`);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "Administrator",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "mutedrole",
|
||||||
|
category: "Configure",
|
||||||
|
description: "Sets the muted role for this server.",
|
||||||
|
usage: "mutedrole [role]"
|
||||||
|
};
|
44
src/commands/nowplaying.js
Normal file
44
src/commands/nowplaying.js
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
const Discord = require("discord.js");
|
||||||
|
exports.run = async (client, message) => {
|
||||||
|
let guild = client.music.getGuild(message.guild.id);
|
||||||
|
|
||||||
|
if(guild.queue.length < 1) {
|
||||||
|
return message.channel.send("<:error:466995152976871434> Nothing is playing.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var song = guild.queue[0];
|
||||||
|
var elapsedTime = client.createTimestamp(guild.dispatcher.time / 1000);
|
||||||
|
var timestamp;
|
||||||
|
|
||||||
|
if(song.duration == 0) {
|
||||||
|
timestamp = "`[LIVE]`";
|
||||||
|
} else {
|
||||||
|
timestamp = `\`[${elapsedTime + "/" + client.createTimestamp(song.duration)}]\``;
|
||||||
|
};
|
||||||
|
|
||||||
|
embed = new Discord.RichEmbed();
|
||||||
|
embed.setTitle("Now playing:")
|
||||||
|
embed.setThumbnail(song.thumbnail)
|
||||||
|
embed.setColor(client.embedColour(message));
|
||||||
|
embed.setDescription(`**[${song.title}](https://www.youtube.com/watch?v=${song.id})**`)
|
||||||
|
embed.addField("Channel:", song.author, true)
|
||||||
|
embed.addField("Time:", timestamp, true)
|
||||||
|
embed.setFooter("Requested by " + song.requestedBy.tag, song.requestedBy.avatarURL)
|
||||||
|
|
||||||
|
message.channel.send(embed)
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: ["np"],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: ["EMBED_LINKS"]
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "nowplaying",
|
||||||
|
category: "Music",
|
||||||
|
description: "Shows details about the currently playing song.",
|
||||||
|
usage: "nowplaying"
|
||||||
|
};
|
31
src/commands/owoify.js
Normal file
31
src/commands/owoify.js
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
// totally not stolen from https://github.com/GmdDjca/Hitomi-Manaka
|
||||||
|
exports.run = (client, message, args) => {
|
||||||
|
if (!args[0]) {
|
||||||
|
return message.channel.send(`<:error:466995152976871434> pwease incwude some text fow me to owoify UwU`)
|
||||||
|
}
|
||||||
|
const faces = ['(・`ω´・)', 'x3', 'owo', 'UwU', '>w<', '^w^']
|
||||||
|
owoified = `${args.join(' ')}`.replace(/(?:r|l)/g, 'w')
|
||||||
|
owoified = owoified.replace(/(?:R|L)/g, 'W')
|
||||||
|
owoified = owoified.replace(/n([aeiou])/g, 'ny$1')
|
||||||
|
owoified = owoified.replace(/N([aeiou])/g, 'Ny$1')
|
||||||
|
owoified = owoified.replace(/N([AEIOU])/g, 'Ny$1')
|
||||||
|
owoified = owoified.replace(/ove/g, 'uv')
|
||||||
|
owoified = owoified.replace(/!+/g, ' ' + faces[~~(Math.random() * faces.length)] + ' ')
|
||||||
|
|
||||||
|
message.channel.send(owoified)
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "owoify",
|
||||||
|
category: "Fun",
|
||||||
|
description: "Makes nyowmal tewxt owo'ed x3",
|
||||||
|
usage: "owoify [message]"
|
||||||
|
};
|
30
src/commands/pause.js
Normal file
30
src/commands/pause.js
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
exports.run = (client, message, args, level) => {
|
||||||
|
let guild = client.music.getGuild(message.guild.id);
|
||||||
|
if(guild.queue.length < 1) {
|
||||||
|
return message.channel.send("<:error:466995152976871434> Nothing is playing.");
|
||||||
|
};
|
||||||
|
|
||||||
|
guild.playing = false;
|
||||||
|
guild.paused = true;
|
||||||
|
guild.dispatcher.pause();
|
||||||
|
message.channel.send("<:pause:467639357961142273> Playback paused!");
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "Moderator",
|
||||||
|
requiredPerms: ["CONNECT", "SPEAK"]
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "pause",
|
||||||
|
category: "Music",
|
||||||
|
description: "Pauses music playback.",
|
||||||
|
usage: "pause"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
19
src/commands/permlevel.js
Normal file
19
src/commands/permlevel.js
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
exports.run = async (client, message, args, level) => {
|
||||||
|
const friendly = client.config.permLevels.find(l => l.level === level).name;
|
||||||
|
message.reply(`Your permission level is: ${level} - ${friendly}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: ["plevel"],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "permlevel",
|
||||||
|
category: "Utility",
|
||||||
|
description: "Tells you your permission level for that server.",
|
||||||
|
usage: "permlevel"
|
||||||
|
};
|
21
src/commands/ping.js
Normal file
21
src/commands/ping.js
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
exports.run = async (client, message) => { // eslint-disable-line no-unused-vars
|
||||||
|
const msg = await message.channel.send("<:wait:467115775849922570> Please wait...");
|
||||||
|
msg.edit(
|
||||||
|
`:ping_pong: Pong! Latency is ${msg.createdTimestamp - message.createdTimestamp}ms, API Latency is ${Math.round(client.ping)}ms`
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "ping",
|
||||||
|
category: "Utility",
|
||||||
|
description: "Displays bot latency in miliseconds.",
|
||||||
|
usage: "ping"
|
||||||
|
};
|
33
src/commands/play.js
Normal file
33
src/commands/play.js
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
const util = require("util")
|
||||||
|
const Discord = require("discord.js")
|
||||||
|
|
||||||
|
module.exports.run = (client, message, args, level) =>{
|
||||||
|
if(!args[0])
|
||||||
|
{
|
||||||
|
message.channel.send(`<:error:466995152976871434> You didn't give me a song to play! Usage: \`${client.commands.get(`play`).help.usage}\``);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let voiceChannel = message.member.voiceChannel;
|
||||||
|
if(!voiceChannel) return message.channel.send('<:error:466995152976871434> You need to be in a voice channel to use this command!');
|
||||||
|
|
||||||
|
message.channel.send(`🔎 searching YouTube for \`${args.join(" ")}\``);
|
||||||
|
|
||||||
|
client.music.play(message, args.join(" "));
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: ["CONNECT", "SPEAK"]
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "play",
|
||||||
|
category: "Music",
|
||||||
|
description: "Plays a song.",
|
||||||
|
usage: "play [youtube-url] **OR** play [song-name]"
|
||||||
|
};
|
36
src/commands/prefix.js
Normal file
36
src/commands/prefix.js
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
exports.run = async (client, message, args) => {
|
||||||
|
if(client.devmode === true) {
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> This command has been disabled because Woomy is in development mode."
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const settings = message.settings;
|
||||||
|
|
||||||
|
if (!client.settings.has(message.guild.id)) client.settings.set(message.guild.id, {});
|
||||||
|
|
||||||
|
if (args[0]) {
|
||||||
|
const joinedValue = args.join(" ");
|
||||||
|
if (joinedValue === settings.prefix) return message.channel.send("<:error:466995152976871434> The prefix is already set to that!");
|
||||||
|
if (!client.settings.has(message.guild.id)) client.settings.set(message.guild.id, {});
|
||||||
|
client.settings.set(message.guild.id, joinedValue, "prefix");
|
||||||
|
message.channel.send(`<:success:466995111885144095> Set the prefix to \`${joinedValue}\``);
|
||||||
|
} else {
|
||||||
|
message.channel.send(`The current prefix is: \`${settings.prefix}\``)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "Administrator",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "prefix",
|
||||||
|
category: "Configure",
|
||||||
|
description: "Sets the prefix for this server.",
|
||||||
|
usage: "prefix [prefix]"
|
||||||
|
};
|
61
src/commands/purge.js
Normal file
61
src/commands/purge.js
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
exports.run = (client, message, args, level) => {
|
||||||
|
const settings = message.settings;
|
||||||
|
|
||||||
|
if(message.channel.name === settings.chatlogsChannel) {
|
||||||
|
return message.channel.send("<:error:466995152976871434> Can't purge logs.")
|
||||||
|
}
|
||||||
|
|
||||||
|
if(message.channel.name === settings.modlogsChannel) {
|
||||||
|
return message.channel.send("<:error:466995152976871434> Can't purge logs.")
|
||||||
|
}
|
||||||
|
const amount = !!parseInt(message.content.split(' ')[1]) ? parseInt(message.content.split(' ')[1]) : parseInt(message.content.split(' ')[2])
|
||||||
|
if(amount > 100) {
|
||||||
|
return message.channel.send("<:error:466995152976871434> Can only purge a maximum of 100 messages!")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!amount) return message.channel.send(
|
||||||
|
'<:error:466995152976871434> You didn\'t tell me how many messages to purge. Usage: \`' + client.commands.get(`purge`).help.usage + "`"
|
||||||
|
);
|
||||||
|
|
||||||
|
message.delete().catch(O_o => {});
|
||||||
|
|
||||||
|
message.channel.fetchMessages({
|
||||||
|
limit: amount,
|
||||||
|
}).then((messages) => {
|
||||||
|
message.channel.bulkDelete(messages, true).catch(console.error);
|
||||||
|
message.channel.send(`<:success:466995111885144095> Purged ${amount} messages!`).then(m => m.delete(5000));
|
||||||
|
});
|
||||||
|
|
||||||
|
if (settings.modlogsChannel !== "off") {
|
||||||
|
const channel = message.guild.channels.find(
|
||||||
|
channel => channel.name === settings.modlogsChannel
|
||||||
|
);
|
||||||
|
|
||||||
|
if (channel) {
|
||||||
|
let embed = new Discord.RichEmbed();
|
||||||
|
embed.setColor("#a62019");
|
||||||
|
embed.setAuthor(`${amount} messages purged!`, message.author.avatarURL);
|
||||||
|
embed.setDescription(`❯ Mod: ${message.author} (${message.author.id})`)
|
||||||
|
try {
|
||||||
|
channel.send({ embed });
|
||||||
|
} catch (err) {
|
||||||
|
// probably no permissions to send messages/embeds there
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "Moderator",
|
||||||
|
requiredPerms: ["MANAGE_MESSAGES"]
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "purge",
|
||||||
|
category: "Moderation",
|
||||||
|
description: "Bulk deletes messages. **cannot delete messages older than 14 days.**",
|
||||||
|
usage: "purge [amount]"
|
||||||
|
};
|
183
src/commands/queue.js
Normal file
183
src/commands/queue.js
Normal file
|
@ -0,0 +1,183 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const Discord = require("discord.js");
|
||||||
|
exports.run = (client, message, args) => {
|
||||||
|
var queue = client.music.getGuild(message.guild.id).queue;
|
||||||
|
|
||||||
|
if(queue.length < 1) {
|
||||||
|
return message.channel.send("<:error:466995152976871434> Nothing is playing.");
|
||||||
|
}
|
||||||
|
|
||||||
|
let lists = [];
|
||||||
|
|
||||||
|
function generateList(start, number) {
|
||||||
|
var list = "";
|
||||||
|
var timestamp;
|
||||||
|
var livestream;
|
||||||
|
|
||||||
|
if(start == 1 && queue.length == 1) {
|
||||||
|
return ["There's nothing else waiting to be played!", 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(number == 1 && queue.length + 1 < start) {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
let q = queue.slice(start);
|
||||||
|
|
||||||
|
let i = 0;
|
||||||
|
|
||||||
|
for(i = 0; i < q.length; i++) {
|
||||||
|
let song = q[i];
|
||||||
|
|
||||||
|
if(song.duration == 0) {
|
||||||
|
timestamp = "LIVE";
|
||||||
|
livestream = true;
|
||||||
|
} else {
|
||||||
|
timestamp = client.createTimestamp(song.duration);
|
||||||
|
};
|
||||||
|
|
||||||
|
let aaa = list + `\`${(i + 1) + start - 1}:\` **[${song.title}](https://www.youtube.com/watch?v=${song.id})** added by ${song.requestedBy} \`[${timestamp}]\`\n`;
|
||||||
|
|
||||||
|
if(aaa.length > 1024) {
|
||||||
|
return [list, start + i - 1];
|
||||||
|
} else {
|
||||||
|
list = aaa;
|
||||||
|
}
|
||||||
|
|
||||||
|
//totalDuration = totalDuration + song.duration;
|
||||||
|
};
|
||||||
|
|
||||||
|
return [list, start + i + 1];
|
||||||
|
};
|
||||||
|
|
||||||
|
let songsInQueue = queue.length - 1;
|
||||||
|
let songsInQueueEnglish = "song";
|
||||||
|
let timeRemaining = 0;
|
||||||
|
|
||||||
|
function generatePage(list, page) {
|
||||||
|
if(!list || list == "") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var embed = new Discord.RichEmbed();
|
||||||
|
embed.setTitle(`Queue for: ${message.guild.name}`);
|
||||||
|
embed.setColor(client.embedColour(message));
|
||||||
|
|
||||||
|
var elapsedTime = client.music.getGuild(message.guild.id).dispatcher.time / 1000
|
||||||
|
var totalDuration = queue[0].duration - elapsedTime;
|
||||||
|
|
||||||
|
let timeRemaining = "";
|
||||||
|
|
||||||
|
for(let i = 1; i < queue.length; i++) {
|
||||||
|
let b = queue[i];
|
||||||
|
|
||||||
|
if(b.duration == 0) {
|
||||||
|
timeRemaining = "∞";
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
totalDuration += b.duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(timeRemaining == "") {
|
||||||
|
let queueDuration = client.createTimestamp(totalDuration);
|
||||||
|
|
||||||
|
timeRemaining = queueDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
let timestamp;
|
||||||
|
|
||||||
|
if(queue[0].duration == 0) {
|
||||||
|
timestamp = "LIVE";
|
||||||
|
livestream = true;
|
||||||
|
} else {
|
||||||
|
timestamp = client.createTimestamp(queue[0].duration);
|
||||||
|
};
|
||||||
|
|
||||||
|
embed.addField(`Now playing:`, `**[${queue[0].title}](https://www.youtube.com/watch?v=${queue[0].id})** added by ${queue[0].requestedBy} \`[${timestamp}]\``)
|
||||||
|
|
||||||
|
embed.addField(`Up next:`, list);
|
||||||
|
|
||||||
|
if(songsInQueue > 1) {
|
||||||
|
songsInQueueEnglish = "songs";
|
||||||
|
}
|
||||||
|
|
||||||
|
embed.setFooter(`Page ${page}/${lists.length} | ${songsInQueue + " " + songsInQueueEnglish} in queue | ${timeRemaining} time remaining`);
|
||||||
|
|
||||||
|
return embed;
|
||||||
|
};
|
||||||
|
|
||||||
|
var myMessage = null;
|
||||||
|
|
||||||
|
function displayPage(number) {
|
||||||
|
let page = generatePage(lists[number - 1], number);
|
||||||
|
|
||||||
|
if(page) {
|
||||||
|
if(myMessage) {
|
||||||
|
myMessage.edit(page);
|
||||||
|
} else {
|
||||||
|
myMessage = message.channel.send(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function aFunction(start) {
|
||||||
|
// start - index of song, which we should start with
|
||||||
|
// end - index of song, which we ended with
|
||||||
|
|
||||||
|
let [list, end] = generateList(start, lists.length + 1);
|
||||||
|
|
||||||
|
if(list && list != "") {
|
||||||
|
lists.push(list);
|
||||||
|
|
||||||
|
if(queue[end + 1]) {
|
||||||
|
aFunction(end + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
aFunction(1);
|
||||||
|
|
||||||
|
let page = 1;
|
||||||
|
|
||||||
|
if(args[0]) {
|
||||||
|
let userPage = Number(args[0]);
|
||||||
|
|
||||||
|
if(userPage) {
|
||||||
|
page = userPage;
|
||||||
|
} else {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> Invalid page. Usage: \`${client.commands.get(`queue`).help.usage}\``
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if(displayPage(page)) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> Page ${page} doesn't exist!`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "queue",
|
||||||
|
category: "Music",
|
||||||
|
description: "Displays what songs are in the queue.",
|
||||||
|
usage: "queue <page>"
|
||||||
|
};
|
70
src/commands/raidmode.js
Normal file
70
src/commands/raidmode.js
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
const Discord = require("discord.js")
|
||||||
|
exports.run = async (client, message, args, level) => {
|
||||||
|
|
||||||
|
const settings = message.settings;
|
||||||
|
const defaults = client.config.defaultSettings;
|
||||||
|
const overrides = client.settings.get(message.guild.id);
|
||||||
|
if (!client.settings.has(message.guild.id)) client.settings.set(message.guild.id, {});
|
||||||
|
|
||||||
|
var raidToggle;
|
||||||
|
var embColour;
|
||||||
|
var mutedRole = message.guild.roles.get(settings.mutedRole)
|
||||||
|
|
||||||
|
if(!mutedRole) {
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> This command requires a muted role to be set! Please ask an admin or the owner to set this with `" + message.settings.prefix + "mutedrole <role>`"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if(args[0] == "strict") {
|
||||||
|
client.settings.set(message.guild.id, "on", "raidModeStrict");
|
||||||
|
client.settings.set(message.guild.id, "on", "raidMode");
|
||||||
|
message.channel.send(`<:success:466995111885144095> Strict raid mode enabled! New users will now be automatically kicked.`);
|
||||||
|
raidToggle = "Strict raid mode activated!"
|
||||||
|
embColour = "#777B7E"
|
||||||
|
} else {
|
||||||
|
if (settings.raidMode === "off") {
|
||||||
|
client.settings.set(message.guild.id, "on", "raidMode")
|
||||||
|
message.channel.send(`<:success:466995111885144095> Raid mode enabled! New users will now be automatically muted.`);
|
||||||
|
raidToggle = "Raid mode activated!"
|
||||||
|
embColour = "#777B7E"
|
||||||
|
} else {
|
||||||
|
client.settings.set(message.guild.id, "off", "raidMode")
|
||||||
|
client.settings.set(message.guild.id, "off", "raidModeStrict");
|
||||||
|
message.channel.send(`<:success:466995111885144095> Raid mode disabled.`);
|
||||||
|
raidToggle = "Raid mode deactivated!"
|
||||||
|
embColour = "#48494b"
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if (settings.modlogsChannel !== "off") {
|
||||||
|
const channel = message.guild.channels.find(
|
||||||
|
channel => channel.name === settings.modlogsChannel
|
||||||
|
);
|
||||||
|
|
||||||
|
if (channel) {
|
||||||
|
let embed = new Discord.RichEmbed();
|
||||||
|
embed.setColor(embColour);
|
||||||
|
embed.setAuthor(raidToggle, message.author.avatarURL);
|
||||||
|
embed.setDescription(`Mod: ${message.author} (${message.author.id})`)
|
||||||
|
try {
|
||||||
|
channel.send({ embed });
|
||||||
|
} catch (err) {
|
||||||
|
// probably no permissions to send messages/embeds there
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "Administrator",
|
||||||
|
requiredPerms: ["MANAGE_ROLES", "KICK_MEMBERS"]
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "raidmode",
|
||||||
|
category: "Moderation",
|
||||||
|
description: "Enables/disables raid mode in your server, which automatically mutes new members. Strict raidmode automatically kicks new members.",
|
||||||
|
usage: "raidmode **OR** raidmode strict"
|
||||||
|
};
|
41
src/commands/randurban.js
Normal file
41
src/commands/randurban.js
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
const urban = require("urban");
|
||||||
|
exports.run = (client, message) => {
|
||||||
|
urban.random().first(json => {
|
||||||
|
if(message.channel.nsfw === false) return message.channel.send(
|
||||||
|
"<:error:466995152976871434> This command can only be executed in channels marked as NSFW!"
|
||||||
|
);
|
||||||
|
if(json.definition.length > 2000) return message.channel.send(
|
||||||
|
`<:error:466995152976871434> Definition cannot exceed 2000 characters! Use this link instead: ${json.permalink}`
|
||||||
|
);
|
||||||
|
if(json.example.length > 2000) return message.channel.send(
|
||||||
|
"<:error:466995152976871434> Example cannot exceed 2000 characters!"
|
||||||
|
);
|
||||||
|
|
||||||
|
embed = new Discord.RichEmbed()
|
||||||
|
.setTitle(json.word)
|
||||||
|
.setURL(json.permalink)
|
||||||
|
.setColor("#EFFF00")
|
||||||
|
.setDescription(json.definition || "None")
|
||||||
|
.addField("Example", json.example || "None")
|
||||||
|
.addField("Upvotes", json.thumbs_up, true)
|
||||||
|
.addField("Downvotes", json.thumbs_down, true)
|
||||||
|
.setFooter(`Submitted by ${json.author}`)
|
||||||
|
message.channel.send(embed);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: ["rurban"],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "randurban",
|
||||||
|
category: "Fun",
|
||||||
|
description: "Grabs a random definition from the Urban Dictonary.",
|
||||||
|
usage: "randurban"
|
||||||
|
};
|
36
src/commands/rate.js
Normal file
36
src/commands/rate.js
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
exports.run = async (client, message, args) => {
|
||||||
|
if (!args[0])
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> What am I meant to rate? Usage: \`${client.commands.get(`rate`).help.usage}\``
|
||||||
|
);
|
||||||
|
var rating = [
|
||||||
|
"0/10",
|
||||||
|
"1/10",
|
||||||
|
"2/10",
|
||||||
|
"3/10",
|
||||||
|
"4/10",
|
||||||
|
"5/10",
|
||||||
|
"6/10",
|
||||||
|
"7/10",
|
||||||
|
"8/10",
|
||||||
|
"9/10",
|
||||||
|
"10/10"
|
||||||
|
];
|
||||||
|
let mess = rating.random();
|
||||||
|
message.channel.send(`<:star:618393201501536258> I give ${args.join(" ")} a **${mess}**`);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "rate",
|
||||||
|
category: "Fun",
|
||||||
|
description: "Gives something a rating from 0-10",
|
||||||
|
usage: "rate [thing]"
|
||||||
|
};
|
28
src/commands/reload.js
Normal file
28
src/commands/reload.js
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
exports.run = async (client, message, args) => {// eslint-disable-line no-unused-vars
|
||||||
|
if (!args || args.length < 1) return message.channel.send(
|
||||||
|
`<:error:466995152976871434> You must provide a command to reload! Usage: \`${client.commands.get(`reload`).help.usage}\``
|
||||||
|
);
|
||||||
|
|
||||||
|
let response = await client.unloadCommand(args[0]);
|
||||||
|
if (response) return message.channel.send(`<:error:466995152976871434> Error unloading: ${response}`);
|
||||||
|
|
||||||
|
response = client.loadCommand(args[0]);
|
||||||
|
if (response) return message.channel.send(`<:error:466995152976871434> Error loading: ${response}`);
|
||||||
|
|
||||||
|
message.channel.send(`<:success:466995111885144095> \`${args[0]}\` has been reloaded!`);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "Developer",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "reload",
|
||||||
|
category: "Owner",
|
||||||
|
description: "Reloads the specified command.",
|
||||||
|
usage: "reload [command]"
|
||||||
|
};
|
49
src/commands/removesong.js
Normal file
49
src/commands/removesong.js
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
const util = require("util")
|
||||||
|
const Discord = require("discord.js")
|
||||||
|
|
||||||
|
module.exports.run = (client, message, args, level) =>{
|
||||||
|
var queue = client.music.getGuild(message.guild.id).queue;
|
||||||
|
|
||||||
|
if(queue.length < 2) {
|
||||||
|
return message.channel.send(`<:error:466995152976871434> Not enough songs are in the queue for this command to work!`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!args[0]) {
|
||||||
|
return message.channel.send(`<:error:466995152976871434> You didn't tell me what song to remove! Usage: \`${client.commands.get(`removesong`).help.usage}\``);
|
||||||
|
};
|
||||||
|
|
||||||
|
var input = +args[0];
|
||||||
|
|
||||||
|
if(isNaN(input) == true) {
|
||||||
|
return message.channel.send(`<:error:466995152976871434> That isn't a number! You need to tell me the songs position in the queue (1, 2, etc.)`);
|
||||||
|
};
|
||||||
|
|
||||||
|
if(input >= queue.length) {
|
||||||
|
return message.channel.send("Invalid (too large)");
|
||||||
|
};
|
||||||
|
|
||||||
|
if(input < 1) {
|
||||||
|
return message.channel.send("Invalid (too small)");
|
||||||
|
};
|
||||||
|
|
||||||
|
var songName = queue[input].title;
|
||||||
|
|
||||||
|
queue.splice(input, 1);
|
||||||
|
|
||||||
|
message.channel.send(`<:success:466995111885144095> Removed from queue: **${songName}**`);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: ["rmsong"],
|
||||||
|
permLevel: "Moderator",
|
||||||
|
requiredPerms: ["SPEAK"]
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "removesong",
|
||||||
|
category: "Music",
|
||||||
|
description: "Removes the specified song from the queue.",
|
||||||
|
usage: "removesong [position]"
|
||||||
|
};
|
30
src/commands/reset.js
Normal file
30
src/commands/reset.js
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
const Discord = require("discord.js")
|
||||||
|
exports.run = async (client, message) => {
|
||||||
|
|
||||||
|
if (!client.settings.has(message.guild.id)) client.settings.set(message.guild.id, {});
|
||||||
|
|
||||||
|
const response = await client.awaitReply(message,
|
||||||
|
"<:reboot:467216876938985482> This will clear the guild config and restore me to my default settings. Are you sure you want to do this?"
|
||||||
|
);
|
||||||
|
if (["y", "yes"].includes(response.toLowerCase())) {
|
||||||
|
client.settings.set(message.guild.id, {});
|
||||||
|
message.channel.send("<:success:466995111885144095> All settings have been restored to their default values.")
|
||||||
|
} else {
|
||||||
|
message.channel.send("<:success:466995111885144095> Action cancelled.")
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "Administrator",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "reset",
|
||||||
|
category: "Configure",
|
||||||
|
description: "Resets all settings to their default values.",
|
||||||
|
usage: "reset"
|
||||||
|
};
|
22
src/commands/restart.js
Normal file
22
src/commands/restart.js
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
exports.run = async (client, message) => {// eslint-disable-line no-unused-vars
|
||||||
|
await message.channel.send("<:reboot:467216876938985482> Restarting...");
|
||||||
|
client.commands.forEach( async cmd => {
|
||||||
|
await client.unloadCommand(cmd);
|
||||||
|
});
|
||||||
|
process.exit(1);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "Developer",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "restart",
|
||||||
|
category: "Owner",
|
||||||
|
description: "Restarts the bot.",
|
||||||
|
usage: "restart"
|
||||||
|
};
|
28
src/commands/resume.js
Normal file
28
src/commands/resume.js
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
const Discord = require("discord.js")
|
||||||
|
exports.run = (client, message, args, level) => {
|
||||||
|
let guild = client.music.getGuild(message.guild.id);
|
||||||
|
if(guild.queue.length < 1) {
|
||||||
|
return message.channel.send("<:error:466995152976871434> Nothing is playing.");
|
||||||
|
};
|
||||||
|
guild.playing = true;
|
||||||
|
guild.paused = false;
|
||||||
|
guild.dispatcher.resume();
|
||||||
|
message.channel.send("<:play:467216788187512832> Playback resumed!");
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: ["unpause"],
|
||||||
|
permLevel: "Moderator",
|
||||||
|
requiredPerms: ["SPEAK"]
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "resume",
|
||||||
|
category: "Music",
|
||||||
|
description: "Unpauses music.",
|
||||||
|
usage: "resume"
|
||||||
|
};
|
25
src/commands/rip.js
Normal file
25
src/commands/rip.js
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
var request = require('request');
|
||||||
|
const Discord = require("discord.js")
|
||||||
|
exports.run = (client, message) => {
|
||||||
|
message.channel.startTyping();
|
||||||
|
var r = request.get('http://mityurl.com/y/yKsQ/r', function (err, res, body) {
|
||||||
|
var rip = r.uri.href
|
||||||
|
message.channel.send(`>:] ${rip}`)
|
||||||
|
message.channel.stopTyping();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "rip",
|
||||||
|
category: "Fun",
|
||||||
|
description: "nice >:]",
|
||||||
|
usage: "`rip`"
|
||||||
|
};
|
53
src/commands/rolecolour.js
Normal file
53
src/commands/rolecolour.js
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
exports.run = async (client, message, [colour, ...givenRole], query) => {
|
||||||
|
let role = givenRole.join(" ");
|
||||||
|
|
||||||
|
let gRole = message.guild.roles.find(r => r.name === role);
|
||||||
|
if (!gRole) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> That role doesn't seem to exist. Usage: \`${client.commands.get(`rolecolour`).help.usage}\``
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!colour.startsWith('#')) {
|
||||||
|
colour = `#`+colour;
|
||||||
|
}
|
||||||
|
if(colour.length > 7) return message.channel.send(
|
||||||
|
`<:error:466995152976871434> Colour has to be a hex code. Usage: \`${client.commands.get(`rolecolour`).help.usage}\``
|
||||||
|
);
|
||||||
|
if(colour.length < 7) return message.channel.send(
|
||||||
|
`<:error:466995152976871434> Colour has to be a hex code. Usage: \`${client.commands.get(`rolecolour`).help.usage}\``
|
||||||
|
);
|
||||||
|
|
||||||
|
let moderator = message.guild.member(message.author)
|
||||||
|
if (gRole.position >= moderator.highestRole.position) {
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> You cannot modify roles higher than your own!"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
var bot = message.guild.members.get(client.user.id)
|
||||||
|
if (gRole.position >= bot.highestRole.position) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> I cannot modify roles higher than my own!`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
await gRole.edit({color: colour})
|
||||||
|
message.channel.send(
|
||||||
|
`<:success:466995111885144095> Role colour changed to \`${colour}\``);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: ["rolecolor"],
|
||||||
|
permLevel: "Moderator",
|
||||||
|
requiredPerms: ["MANAGE_ROLES"]
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "rolecolour",
|
||||||
|
category: "Utility",
|
||||||
|
description: "Sets the colour of a role to the specified hex.",
|
||||||
|
usage: "rolecolour [hex] [role]"
|
||||||
|
};
|
45
src/commands/roleinfo.js
Normal file
45
src/commands/roleinfo.js
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
const Discord = require("discord.js");
|
||||||
|
exports.run = async (client, message, args, level) => {
|
||||||
|
if (!args[0])
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> You didn't provide me with a role name or ID! Usage: \`${client.commands.get(`roleinfo`).help.usage}\``
|
||||||
|
);
|
||||||
|
|
||||||
|
var role = message.guild.roles.get(args[0])
|
||||||
|
if(!role) {
|
||||||
|
role = message.guild.roles.find(r => r.name === args.join(" "));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!role) {
|
||||||
|
return message.channel.send(`<:error:466995152976871434> Role not found.`)
|
||||||
|
}
|
||||||
|
|
||||||
|
if(role.hoist === true) {
|
||||||
|
var hoist = `Yes`
|
||||||
|
} else {
|
||||||
|
var hoist = `No`
|
||||||
|
}
|
||||||
|
|
||||||
|
var embed = new Discord.RichEmbed();
|
||||||
|
embed.setColor(role.color)
|
||||||
|
embed.setDescription(
|
||||||
|
`**Name:** ${role.name}\n **ID:** ${role.id}\n**Hex:** ${role.hexColor}\n**Members:** ${role.members.size}
|
||||||
|
\n**Position:** ${role.position}\n**Hoisted:** ${hoist}`
|
||||||
|
);
|
||||||
|
message.channel.send(embed)
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: ["rinfo"],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "roleinfo",
|
||||||
|
category: "Utility",
|
||||||
|
description: "Gives information about a role.",
|
||||||
|
usage: "roleinfo [role]"
|
||||||
|
};
|
29
src/commands/sans.js
Normal file
29
src/commands/sans.js
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
const url = "https://demirramon.com/gen/undertale_text_box.png";
|
||||||
|
exports.run = (client, message, args) => {
|
||||||
|
let text = args.join(" ");
|
||||||
|
|
||||||
|
if (!text) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> No message provided. Usage: \`${client.commands.get(`sans`).help.usage}\``
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
let params = "box=undertale&boxcolor=white&character=undertale-sans&expression=default&charcolor=white&font=determination&asterisk=true&mode=regular&text=" + encodeURIComponent(text);
|
||||||
|
|
||||||
|
message.channel.send({files: [new Discord.Attachment(url + "?" + params, "undertale.png")]});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: ["undertale"],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: ["ATTACH_FILES"]
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "sans",
|
||||||
|
category: "Fun",
|
||||||
|
description: "Generates a sans text box",
|
||||||
|
usage: "sans [message]"
|
||||||
|
};
|
18
src/commands/servericon.js
Normal file
18
src/commands/servericon.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
exports.run = (client, message) => {
|
||||||
|
message.channel.send(`**${message.guild}'s** icon is:\n${message.guild.iconURL}`)
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: ["sicon", "guildicon"],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: ["EMBED_LINKS"]
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "servericon",
|
||||||
|
category: "Utility",
|
||||||
|
description: "Displays the icon for the server.",
|
||||||
|
usage: "servericon"
|
||||||
|
};
|
53
src/commands/serverinfo.js
Normal file
53
src/commands/serverinfo.js
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
exports.run = (client, message) => {
|
||||||
|
|
||||||
|
let guild = message.guild
|
||||||
|
|
||||||
|
var roleCount = 0;
|
||||||
|
let roles = guild.roles
|
||||||
|
roles.forEach((role) => { roleCount = roleCount + 1; });
|
||||||
|
|
||||||
|
var chanCount = 0;
|
||||||
|
let channels = guild.channels
|
||||||
|
channels.forEach((channel) => { chanCount = chanCount + 1; });
|
||||||
|
|
||||||
|
var emojiList = "";
|
||||||
|
let emojis = guild.emojis;
|
||||||
|
emojis.forEach((emoji) => { emojiList = emojiList + emoji; });
|
||||||
|
eListOutput = `\n**Emojis:** ${emojiList}`;
|
||||||
|
if(emojiList === "") eListOutput = "";
|
||||||
|
|
||||||
|
let vlvl = guild.verificationLevel;
|
||||||
|
if(vlvl === 0) vlvl = "None";
|
||||||
|
if(vlvl === 1) vlvl = "Low";
|
||||||
|
if(vlvl === 2) vlvl = "Medium";
|
||||||
|
if(vlvl === 3) vlvl = "(╯°□°)╯︵ ┻━┻"
|
||||||
|
if(vlvl === 4) vlvl = "┻━┻彡 ヽ(ಠ益ಠ)ノ彡┻━┻"
|
||||||
|
|
||||||
|
content = `**ID:** ${guild.id}\n**Owner:** ${guild.owner}\n**Region:** ${guild.region}\n**Verification Level:** ${vlvl}\n**Members:** ${guild.memberCount}\n**Roles:** ${roleCount}\n**Channels:** ${chanCount}\n**Created:** ${guild.createdAt}${eListOutput}`;
|
||||||
|
if (content.length > 2048) {
|
||||||
|
eListOutput = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
let embed = new Discord.RichEmbed()
|
||||||
|
.setColor(message.guild.member(client.user).displayHexColor)
|
||||||
|
.setAuthor(guild.name)
|
||||||
|
.setDescription(content)
|
||||||
|
.setThumbnail(message.guild.iconURL);
|
||||||
|
|
||||||
|
message.channel.send(embed);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: ["sinfo", "guildinfo", "ginfo", "server"],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: ["EMBED_LINKS"]
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "serverinfo",
|
||||||
|
category: "Utility",
|
||||||
|
description: "Displays some useful information about the current server.",
|
||||||
|
usage: "serverinfo"
|
||||||
|
};
|
102
src/commands/settings.js
Normal file
102
src/commands/settings.js
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
exports.run = async (client, message, args) => {
|
||||||
|
|
||||||
|
const settings = message.settings;
|
||||||
|
if (!client.settings.has(message.guild.id)) client.settings.set(message.guild.id, {});
|
||||||
|
|
||||||
|
modChan = message.guild.channels.find(channel => channel.name === settings.modlogsChannel) || "__Disabled__";
|
||||||
|
chatChan = message.guild.channels.find(channel => channel.name === settings.chatlogsChannel) || "__Disabled__"
|
||||||
|
greetChan = message.guild.channels.get(settings.welcomeChannel) || "__Disabled__";
|
||||||
|
prefix = settings.prefix;
|
||||||
|
|
||||||
|
var raidMode;
|
||||||
|
var rmDisabled = false;
|
||||||
|
if(settings.raidMode == "off") {
|
||||||
|
raidMode = "__Disabled__"
|
||||||
|
rmDisabled = true;
|
||||||
|
} else {
|
||||||
|
raidMode = `\`${settings.raidMode}`
|
||||||
|
}
|
||||||
|
|
||||||
|
if(settings.raidModeStrict == "on") {
|
||||||
|
raidMode += " (strict)`"
|
||||||
|
} else if(rmDisabled != true) {
|
||||||
|
raidMode += "`"
|
||||||
|
}
|
||||||
|
|
||||||
|
var modRole = message.guild.roles.get(settings.modRole);
|
||||||
|
var adminRole = message.guild.roles.get(settings.adminRole);
|
||||||
|
var autorole = message.guild.roles.get(settings.autorole);
|
||||||
|
var mutedRole = message.guild.roles.get(settings.mutedRole);
|
||||||
|
var blacklist = "";
|
||||||
|
|
||||||
|
if(settings.modRole == "off" || !modRole) {
|
||||||
|
modRole = "__None set__";
|
||||||
|
} else {
|
||||||
|
modRole = "`" + modRole.name + "`";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(settings.adminRole == "off" || !adminRole) {
|
||||||
|
adminRole = "__None set__";
|
||||||
|
} else {
|
||||||
|
adminRole = "`" + adminRole.name + "`";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(settings.autorole == "off" || !autorole) {
|
||||||
|
autorole = "__None set__";
|
||||||
|
} else {
|
||||||
|
autorole = "`" + autorole.name + "`";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(settings.mutedRole == "off" || !mutedRole) {
|
||||||
|
mutedRole = "__None set__";
|
||||||
|
} else {
|
||||||
|
mutedRole = "`" + mutedRole.name + "`";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(settings.welcomeMessage == "off") {
|
||||||
|
welcomeMessage = "__Disabled__";
|
||||||
|
} else {
|
||||||
|
welcomeMessage = "`" + settings.welcomeMessage + "`";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(settings.leaveMessage == "off") {
|
||||||
|
leaveMessage = "__Disabled__";
|
||||||
|
} else {
|
||||||
|
leaveMessage = "`" + settings.leaveMessage + "`";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(settings.blacklisted == "ARRAY") {
|
||||||
|
blacklist = "__Disabled__";
|
||||||
|
} else {
|
||||||
|
if(settings.blacklisted.length > 0) {
|
||||||
|
settings.blacklisted.forEach(function(user) {
|
||||||
|
blacklist += "`" + (client.users.get(user) || user) + "` ,"
|
||||||
|
});
|
||||||
|
blacklist = blacklist.substr(0, blacklist.length, -3)
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
embed = new Discord.RichEmbed()
|
||||||
|
embed.setAuthor("Settings for: " + message.guild.name, message.guild.iconURL)
|
||||||
|
embed.setColor(message.guild.member(client.user).displayHexColor)
|
||||||
|
embed.setDescription("You can edit these settings using the commands in the 'configure' section of the help command.")
|
||||||
|
embed.addField("General:", `Prefix: \`${prefix}\`\nChat logging: ${chatChan}\nMod logging: ${modChan}\nRaid mode: ${raidMode}\nJoin/leave channel: ${greetChan}\nWelcome message: ${welcomeMessage}\nLeave message: ${leaveMessage}`, true)
|
||||||
|
embed.addField("Roles:", `Moderator: ${modRole}\nAdministrator: ${adminRole}\nMuted: ${mutedRole}\nBlacklisted: ${blacklist}\nAutorole: ${autorole}`, true);
|
||||||
|
message.channel.send(embed)
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: ["config"],
|
||||||
|
permLevel: "Administrator",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "settings",
|
||||||
|
category: "Configure",
|
||||||
|
description: "View your server's settings.",
|
||||||
|
usage: "settings"
|
||||||
|
};
|
66
src/commands/skip.js
Normal file
66
src/commands/skip.js
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
const Discord = require("discord.js")
|
||||||
|
exports.run = (client, message, args, level) => {
|
||||||
|
let guild = client.music.getGuild(message.guild.id);
|
||||||
|
|
||||||
|
if(guild.queue.length < 1 || !guild.playing || !guild.dispatcher) return message.channel.send(
|
||||||
|
"<:error:466995152976871434> Nothing is playing."
|
||||||
|
);
|
||||||
|
|
||||||
|
let vc = message.guild.members.get(client.user.id).voiceChannel;
|
||||||
|
|
||||||
|
if(vc != message.member.voiceChannel) return message.channel.send(
|
||||||
|
'<:error:466995152976871434> You need to be in my voice channel to use this command!'
|
||||||
|
);
|
||||||
|
|
||||||
|
if(guild.queue[0].requestedBy.id == message.author.id) {
|
||||||
|
skip_song(guild);
|
||||||
|
|
||||||
|
message.channel.send(
|
||||||
|
`<:skip:467216735356059660> Song has been skipped by the user who requested it.`
|
||||||
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guild.skippers.indexOf(message.author.id) == -1) {
|
||||||
|
guild.skippers.push(message.author.id);
|
||||||
|
|
||||||
|
if (guild.skippers.length >= Math.ceil(vc.members.filter(member => !member.user.bot).size / 2)) {
|
||||||
|
|
||||||
|
skip_song(guild);
|
||||||
|
|
||||||
|
message.channel.send(
|
||||||
|
`<:skip:467216735356059660> Song has been skipped.`
|
||||||
|
);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
message.channel.send(
|
||||||
|
`<:success:466995111885144095> Your vote has been acknowledged! **${guild.skippers.length + "/" + Math.ceil(vc.members.filter(member => !member.user.bot).size / 2)}**`
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
} else {
|
||||||
|
message.channel.send(
|
||||||
|
"<:denied:466995195150336020> You cannot vote twice!"
|
||||||
|
);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: ["voteskip"],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: ["SPEAK"]
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "skip",
|
||||||
|
category: "Music",
|
||||||
|
description: "Vote to skip the currently playing song. Song will be skipped instantly if executed by the user who requested it.",
|
||||||
|
usage: "skip"
|
||||||
|
};
|
||||||
|
|
||||||
|
function skip_song(guild) {
|
||||||
|
guild.dispatcher.end("silent");
|
||||||
|
}
|
32
src/commands/stop.js
Normal file
32
src/commands/stop.js
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
const Discord = require("discord.js");
|
||||||
|
|
||||||
|
exports.run = async (client, message) => {
|
||||||
|
let guild = client.music.getGuild(message.guild.id);
|
||||||
|
|
||||||
|
if(guild.queue.length < 1 || !guild.playing || !guild.dispatcher) return message.channel.send("<:error:466995152976871434> Nothing is playing.");
|
||||||
|
if(!message.member.voiceChannel) return message.channel.send('<:error:466995152976871434> You need to be in voice channel to use this command!');
|
||||||
|
|
||||||
|
guild.playing = false;
|
||||||
|
guild.paused = false;
|
||||||
|
guild.queue = [];
|
||||||
|
|
||||||
|
guild.dispatcher.end("silent");
|
||||||
|
|
||||||
|
message.channel.send("<:stop:467639381390262284> Playback stopped!");
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "Moderator",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "stop",
|
||||||
|
category: "Music",
|
||||||
|
description: "Clears the queue and disconnects from the voice channel. (run this if music stopS working)",
|
||||||
|
usage: "stop"
|
||||||
|
};
|
||||||
|
|
18
src/commands/support.js
Normal file
18
src/commands/support.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
exports.run = async (client, message, args) =>{
|
||||||
|
message.channel.send("Use this link to join my support server: https://discord.gg/HCF8mdv")
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "support",
|
||||||
|
category: "utility",
|
||||||
|
description: "Sends a link to Woomy's support/development server.",
|
||||||
|
usage: "support"
|
||||||
|
};
|
85
src/commands/takerole.js
Normal file
85
src/commands/takerole.js
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
exports.run = async (client, message, [member, ...role2add], query) => {
|
||||||
|
if (!member) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> No user specified. Usage: \`${client.commands.get(`takerole`).help.usage}\``
|
||||||
|
);
|
||||||
|
}
|
||||||
|
let user = message.mentions.members.first();
|
||||||
|
let users;
|
||||||
|
if (!user) {
|
||||||
|
users = client.searchForMembers(message.guild, member);
|
||||||
|
if (users.length > 1)
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> Found multiple users, please be more specific or mention the user instead."
|
||||||
|
);
|
||||||
|
else if (users.length == 0)
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> That user doesn't seem to exist. Try again!"
|
||||||
|
);
|
||||||
|
user = users[0];
|
||||||
|
}
|
||||||
|
let role = role2add.join(" ");
|
||||||
|
|
||||||
|
let gRole = message.guild.roles.find(r => r.name === role);
|
||||||
|
if (!gRole) {
|
||||||
|
return message.channel.send(`<:error:466995152976871434> That role doesn't seem to exist. Try again!`);
|
||||||
|
}
|
||||||
|
|
||||||
|
let moderator = message.guild.member(message.author)
|
||||||
|
if (gRole.position >= moderator.highestRole.position) {
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> You cannot take roles higher than your own!"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
var bot = message.guild.members.get(client.user.id)
|
||||||
|
if (gRole.position >= bot.highestRole.position) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> I can't take roles higher than my own!`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!user.roles.has(gRole.id)) {
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> They don't have that role!"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
await user.removeRole(gRole.id);
|
||||||
|
message.channel.send(
|
||||||
|
`<:success:466995111885144095> Took the \`${gRole.name}\` role from \`${
|
||||||
|
user.user.tag
|
||||||
|
}\``
|
||||||
|
);
|
||||||
|
|
||||||
|
if (client.getSettings(message.guild.id).modlogsChannel !== "off") {
|
||||||
|
const channel = message.guild.channels.find(
|
||||||
|
channel => channel.name === client.getSettings(message.guild.id).modlogsChannel
|
||||||
|
);
|
||||||
|
|
||||||
|
if (channel) {
|
||||||
|
let embed = new Discord.RichEmbed();
|
||||||
|
embed.setColor("#008369");
|
||||||
|
embed.setAuthor("Role taken:", user.user.avatarURL);
|
||||||
|
embed.setDescription(`❯ User: ${user} (${user.user.id})\n❯ Mod: ${message.author} (${message.author.id})\n❯ Role: ${gRole}`)
|
||||||
|
try {
|
||||||
|
channel.send({ embed });
|
||||||
|
} catch (err) {
|
||||||
|
// probably no permissions to send messages/embeds there
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: ["removerole"],
|
||||||
|
permLevel: "Moderator",
|
||||||
|
requiredPerms: ["MANAGE_ROLES"]
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "takerole",
|
||||||
|
category: "Moderation",
|
||||||
|
description: "Takes a role from the specified user.",
|
||||||
|
usage: "takerole [user] [role]"
|
||||||
|
};
|
93
src/commands/unmute.js
Normal file
93
src/commands/unmute.js
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
exports.run = async (client, message, args, level) => {
|
||||||
|
const settings = message.settings;
|
||||||
|
|
||||||
|
if(!args[0]) {
|
||||||
|
return message.channel.send("<:error:466995152976871434> Who am I meant to unmute?")
|
||||||
|
}
|
||||||
|
let user = message.mentions.members.first();
|
||||||
|
let users;
|
||||||
|
if (!user) {
|
||||||
|
users = client.searchForMembers(message.guild, args[0]);
|
||||||
|
if (users.length > 1)
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> Found multiple users! Please be more specific or mention the user instead."
|
||||||
|
);
|
||||||
|
else if (users.length == 0)
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> That user doesn't seem to exist. Try again!"
|
||||||
|
);
|
||||||
|
user = users[0];
|
||||||
|
}
|
||||||
|
if (user.user.id === client.user.id) {
|
||||||
|
return message.channel.send("lol no")
|
||||||
|
}
|
||||||
|
if (user.user.id === message.guild.owner.id) {
|
||||||
|
return message.channel.send("<:error:466995152976871434> You can't unmute the owner!")
|
||||||
|
}
|
||||||
|
|
||||||
|
let moderator = message.guild.member(message.author)
|
||||||
|
if (message.settings.mutedRole.position >= moderator.highestRole.position && level < 2) {
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> The muted role is positioned above the moderator role! Please move the muted role below the moderator role."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (user.highestRole.position >= moderator.highestRole.position && moderator.user.id !== message.guild.ownerID) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> You can't unmute people who have a higher role than you!`
|
||||||
|
);
|
||||||
|
};
|
||||||
|
let bot = message.guild.member(client.user)
|
||||||
|
if (user.highestRole.position >= bot.highestRole.position) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:error:466995152976871434> I can't unmute people who have a higher role than me!`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
let role = message.guild.roles.get(settings.mutedRole)
|
||||||
|
if(!role) {
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> Mute role not found! Please set one using `~settings edit mutedRole <role>`"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!user.roles.has(role.id)) {
|
||||||
|
return message.channel.send("<:error:466995152976871434> They aren't muted!")
|
||||||
|
}
|
||||||
|
|
||||||
|
await user.removeRole(role.id);
|
||||||
|
message.channel.send(`<:success:466995111885144095> Unmuted \`${user.user.tag}\``)
|
||||||
|
|
||||||
|
|
||||||
|
if (settings.modlogsChannel !== "off") {
|
||||||
|
const channel = message.guild.channels.find(
|
||||||
|
channel => channel.name === settings.modlogsChannel
|
||||||
|
);
|
||||||
|
|
||||||
|
if (channel) {
|
||||||
|
let embed = new Discord.RichEmbed();
|
||||||
|
embed.setColor("#7a2f8f");
|
||||||
|
embed.setAuthor("User unmuted!", user.user.avatarURL);
|
||||||
|
embed.setDescription(`❯ User: ${user} (${user.user.id})\n❯ Mod: ${message.author} (${message.author.id})`)
|
||||||
|
try {
|
||||||
|
channel.send({ embed });
|
||||||
|
} catch (err) {
|
||||||
|
// probably no permissions to send messages/embeds there
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "Moderator",
|
||||||
|
requiredPerms: ["MANAGE_ROLES", "MANAGE_CHANNELS"]
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "unmute",
|
||||||
|
category: "Moderation",
|
||||||
|
description: "Allows a muted user to type again.",
|
||||||
|
usage: "unmute [user]"
|
||||||
|
};
|
48
src/commands/urban.js
Normal file
48
src/commands/urban.js
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
Discord = require("discord.js");
|
||||||
|
urban = require("relevant-urban");
|
||||||
|
exports.run = async (client, message, args) => {
|
||||||
|
if (message.channel.nsfw === false) return message.channel.send(
|
||||||
|
"<:error:466995152976871434> This command can only be executed in channels marked as NSFW!"
|
||||||
|
);
|
||||||
|
if (args < 1) return message.channel.send(
|
||||||
|
`<:error:466995152976871434> You did not tell me what to search for! Usage: \`${client.commands.get(`urban`).help.usage}\`
|
||||||
|
`);
|
||||||
|
let phrase = args.join(" ");
|
||||||
|
let output = await urban(args.join(' ')).catch(e => {
|
||||||
|
return message.channel.send("<:error:466995152976871434> No results found for `" + phrase + "`")
|
||||||
|
});
|
||||||
|
|
||||||
|
if(output.definition.length > 2000) return message.channel.send(
|
||||||
|
`<:error:466995152976871434> Definition cannot exceed 2000 characters! Use this link instead: ${output.urbanURL}`
|
||||||
|
);
|
||||||
|
if(output.example.length > 2000) return message.channel.send(
|
||||||
|
"<:error:466995152976871434> Example cannot exceed 2000 characters!"
|
||||||
|
);
|
||||||
|
|
||||||
|
embed = new Discord.RichEmbed()
|
||||||
|
.setTitle(output.word)
|
||||||
|
.setURL(output.urbanURL)
|
||||||
|
.setColor("#EFFF00")
|
||||||
|
.setDescription(output.definition || "None")
|
||||||
|
.addField("Example", output.example || "None")
|
||||||
|
.addField("Upvotes", output.thumbsUp, true)
|
||||||
|
.addField("Downvotes", output.thumbsDown, true)
|
||||||
|
.setFooter(`Submitted by ${output.author}`)
|
||||||
|
message.channel.send(embed);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "urban",
|
||||||
|
category: "Fun",
|
||||||
|
description: "Grabs a definition from the urban dictonary.",
|
||||||
|
usage: "urban [word]"
|
||||||
|
};
|
102
src/commands/userinfo.js
Normal file
102
src/commands/userinfo.js
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
const Discord = require("discord.js");
|
||||||
|
|
||||||
|
exports.run = (client, message, args) => {
|
||||||
|
|
||||||
|
var user;
|
||||||
|
var nickString = "";
|
||||||
|
var guildString = "";
|
||||||
|
var tag;
|
||||||
|
var id;
|
||||||
|
var createdAt;
|
||||||
|
var colour;
|
||||||
|
var avatarURL;
|
||||||
|
|
||||||
|
if(message.guild) {
|
||||||
|
|
||||||
|
user = message.mentions.members.first();
|
||||||
|
|
||||||
|
if(!args[0]) {
|
||||||
|
user = message.guild.members.get(message.author.id)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!user) {
|
||||||
|
var users;
|
||||||
|
users = client.searchForMembers(message.guild, args[0]);
|
||||||
|
if (users.length > 1)
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> Found multiple users! Please be more specific or mention the user instead."
|
||||||
|
);
|
||||||
|
else if (users.length == 0)
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> That user doesn't seem to exist. Try again!"
|
||||||
|
);
|
||||||
|
user = users[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!user.nickname) {
|
||||||
|
nickString = "";
|
||||||
|
} else {
|
||||||
|
nickString = `**Nickname:** ${user.nickname}\n`;
|
||||||
|
};
|
||||||
|
|
||||||
|
var roleList = "`";
|
||||||
|
let roles = user.roles;
|
||||||
|
roles.forEach((role) => { roleList = roleList + role.name + "`, `"; });
|
||||||
|
roleList = roleList.substring(0, roleList.length - 4);
|
||||||
|
roleList += "`";
|
||||||
|
|
||||||
|
guildString = `\n **Roles:** ${roleList}\n**Guild Join Date:** ${user.joinedAt}`
|
||||||
|
|
||||||
|
tag = user.user.tag;
|
||||||
|
id = user.user.id;
|
||||||
|
createdAt = user.user.createdAt;
|
||||||
|
colour = user.displayHexColor
|
||||||
|
avatarURL = user.user.avatarURL
|
||||||
|
} else {
|
||||||
|
user = message.author;
|
||||||
|
|
||||||
|
tag = user.tag;
|
||||||
|
id = user.id;
|
||||||
|
createdAt = user.createdAt;
|
||||||
|
colour = ["#ff9d68", "#ff97cb", "#d789ff", "#74FFFF"].random();
|
||||||
|
avatarURL = user.avatarURL;
|
||||||
|
};
|
||||||
|
|
||||||
|
let isBot = user.bot;
|
||||||
|
|
||||||
|
if (isBot === true) {
|
||||||
|
isBot = "Yes";
|
||||||
|
} else {
|
||||||
|
isBot = "No";
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!user.presence.game) {
|
||||||
|
gameString = "";
|
||||||
|
} else {
|
||||||
|
gameString = `\n**Playing:** ${user.presence.game}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
embed = new (require("discord.js")).RichEmbed();
|
||||||
|
embed.setTitle(tag)
|
||||||
|
embed.setDescription(
|
||||||
|
`${nickString}**ID:** ${id}\n**Bot:** ${isBot}\n**Status:** ${user.presence.status}${gameString}${guildString}\n**Discord Join Date:** ${createdAt}`
|
||||||
|
);
|
||||||
|
embed.setColor(colour);
|
||||||
|
embed.setThumbnail(avatarURL);
|
||||||
|
message.channel.send(embed);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: ["uinfo", "user"],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: ["EMBED_LINKS"]
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "userinfo",
|
||||||
|
category: "Utility",
|
||||||
|
description: "Displays some useful information about the specified user.",
|
||||||
|
usage: "userinfo <user>"
|
||||||
|
};
|
59
src/commands/weather.js
Normal file
59
src/commands/weather.js
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
const weather = require("weather-js");
|
||||||
|
exports.run = async (client, message, args, error) => {
|
||||||
|
if(!args[0]) {
|
||||||
|
message.channel.send(
|
||||||
|
`<:error:466995152976871434> You didn't give me a location. Usage: \`${client.commands.get(`weather`).help.usage}\``
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
if(args.join(" ").toLowerCase() == "antarctica") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
weather.find({search: args.join(" "), degreeType: 'C'}, function(err, result) {
|
||||||
|
if(err) client.logger.log(`weather.js error: ${JSON.stringify(error)}`, "error")
|
||||||
|
if(result.length < 2 || !result) {
|
||||||
|
return message.channel.send("<:error:466995152976871434> City not found!");
|
||||||
|
};
|
||||||
|
|
||||||
|
var location = result[0].location;
|
||||||
|
var current = result[0].current;
|
||||||
|
|
||||||
|
var warning = (`${location.alert}` || "No warnings");
|
||||||
|
|
||||||
|
var embedColour;
|
||||||
|
if (current.temperature < 0) {
|
||||||
|
embedColour = "#addeff";
|
||||||
|
}else if (current.temperature < 20) {
|
||||||
|
embedColour = "#4fb8ff";
|
||||||
|
}else if (current.temperature < 26) {
|
||||||
|
embedColour = "#ffea4f";
|
||||||
|
}else if (current.temperature < 31) {
|
||||||
|
embedColour = "#ffa14f"
|
||||||
|
} else {
|
||||||
|
embedColour = "#ff614f"
|
||||||
|
};
|
||||||
|
|
||||||
|
embed = new Discord.RichEmbed();
|
||||||
|
embed.addField(`Weather for ${location.name}:`, `**Condition:** ${current.skytext}\n**Temperature:** ${current.temperature}C°\n**Feels like:** ${current.feelslike}C°\n**Humidity:** ${current.humidity}%\n**Wind:** ${current.winddisplay}\n**Warnings:** ${warning}`)
|
||||||
|
embed.setThumbnail(current.imageUrl)
|
||||||
|
embed.setFooter(`Last updated at ${current.observationtime} ${current.date}`)
|
||||||
|
embed.setColor(embedColour)
|
||||||
|
message.channel.send(embed)
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: ["EMBED_LINKS"]
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "weather",
|
||||||
|
category: "Utility",
|
||||||
|
description: "Tells you the weather",
|
||||||
|
usage: "weather [location]"
|
||||||
|
};
|
45
src/commands/welcome.js
Normal file
45
src/commands/welcome.js
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
const Discord = require("discord.js")
|
||||||
|
exports.run = async (client, message, args, level) => {
|
||||||
|
|
||||||
|
const settings = message.settings;
|
||||||
|
const defaults = client.config.defaultSettings;
|
||||||
|
const overrides = client.settings.get(message.guild.id);
|
||||||
|
if (!client.settings.has(message.guild.id)) client.settings.set(message.guild.id, {});
|
||||||
|
|
||||||
|
if (args[0]) {
|
||||||
|
const joinedValue = args.join(" ");
|
||||||
|
if (joinedValue === settings.welcomeMessage) return message.channel.send(
|
||||||
|
"<:error:466995152976871434> The welcome message is already set to that!"
|
||||||
|
);
|
||||||
|
if (!client.settings.has(message.guild.id)) client.settings.set(message.guild.id, {});
|
||||||
|
if (joinedValue === "off") {
|
||||||
|
if (!client.settings.has(message.guild.id)) client.settings.set(message.guild.id, {});
|
||||||
|
client.settings.set(message.guild.id, "off", "welcomeMessage");
|
||||||
|
return message.channel.send(`<:success:466995111885144095> Welcome messages have been disabled.`);
|
||||||
|
}
|
||||||
|
client.settings.set(message.guild.id, joinedValue, "welcomeMessage");
|
||||||
|
client.settings.set(message.guild.id, message.channel.id, "welcomeChannel")
|
||||||
|
message.channel.send(`<:success:466995111885144095> Set the welcome message to \`${joinedValue}\``);
|
||||||
|
} else {
|
||||||
|
if (settings.welcomeMessage === "off") {
|
||||||
|
message.channel.send(`Welcome messages are off.`)
|
||||||
|
} else {
|
||||||
|
message.channel.send(`The current welcome message is: \`${settings.welcomeMessage}\``)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: true,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "Administrator",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "welcome",
|
||||||
|
category: "Configure",
|
||||||
|
description: "Sets the welcome message for this server. try using [[server]], [[user]] and [[members]] in your message!",
|
||||||
|
usage: "welcome [message] **OR** welcome off"
|
||||||
|
};
|
32
src/commands/woomy.js
Normal file
32
src/commands/woomy.js
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
const Discord = require("discord.js")
|
||||||
|
exports.run = async (client, message) =>{
|
||||||
|
message.channel.send("Woomy!")
|
||||||
|
|
||||||
|
const voiceChannel = message.member.voiceChannel;
|
||||||
|
if (!voiceChannel) return;
|
||||||
|
const permissions = voiceChannel.permissionsFor(message.client.user);
|
||||||
|
if (!permissions.has('CONNECT')) return;
|
||||||
|
if (!permissions.has('SPEAK')) return;
|
||||||
|
if (client.music.getGuild(message.guild.id).playing == true) return;
|
||||||
|
|
||||||
|
voiceChannel.join()
|
||||||
|
.then(connection => {
|
||||||
|
const dispatcher = connection.playFile(`/home/container/media/sounds/WOOMY.MP3`);
|
||||||
|
dispatcher.on("end", end => {voiceChannel.leave()});
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.conf = {
|
||||||
|
enabled: true,
|
||||||
|
guildOnly: false,
|
||||||
|
aliases: [],
|
||||||
|
permLevel: "User",
|
||||||
|
requiredPerms: []
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.help = {
|
||||||
|
name: "woomy",
|
||||||
|
category: "Fun",
|
||||||
|
description: "Woomy!",
|
||||||
|
usage: "woomy"
|
||||||
|
};
|
3
src/events/error.js
Normal file
3
src/events/error.js
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
module.exports = async (client, error) => {
|
||||||
|
client.logger.log(`Discord.js error: \n${JSON.stringify(error)}`, "error");
|
||||||
|
};
|
17
src/events/guildCreate.js
Normal file
17
src/events/guildCreate.js
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
const Discord = require("discord.js");
|
||||||
|
const chalk = require("chalk");
|
||||||
|
module.exports = (client, guild) => {
|
||||||
|
|
||||||
|
client.settings.ensure(guild.id, client.config.defaultSettings);
|
||||||
|
|
||||||
|
if(client.devmode === true) return;
|
||||||
|
channel = client.channels.get("458896120639127552");
|
||||||
|
|
||||||
|
let embed = new Discord.RichEmbed();
|
||||||
|
embed.setColor("#F38159");
|
||||||
|
embed.setAuthor("Joined a new server:")
|
||||||
|
embed.setDescription(`❯ Name: \`${guild.name}\`\n❯ Size: \`${guild.members.size}\``)
|
||||||
|
embed.setFooter(`I'm now in ${client.guilds.size} servers!`)
|
||||||
|
channel.send(embed);
|
||||||
|
};
|
||||||
|
|
24
src/events/guildDelete.js
Normal file
24
src/events/guildDelete.js
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
const Discord = require("discord.js");
|
||||||
|
const chalk = require('chalk');
|
||||||
|
module.exports = (client, guild) => {
|
||||||
|
client.logger.log(chalk.redBright(`Guild left.`), "cmd");
|
||||||
|
|
||||||
|
if(client.devmode === true) return;
|
||||||
|
|
||||||
|
if(!guild) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
channel = client.channels.get("458896120639127552");
|
||||||
|
|
||||||
|
let embed = new Discord.RichEmbed();
|
||||||
|
embed.setColor("#9494FF");
|
||||||
|
embed.setAuthor("Left a server:")
|
||||||
|
embed.setDescription(`❯ Name: \`${guild.name}\``)
|
||||||
|
embed.setFooter(`I'm now in ${client.guilds.size} servers.`)
|
||||||
|
channel.send(embed);
|
||||||
|
|
||||||
|
if (client.settings.has(guild.id)) {
|
||||||
|
client.settings.delete(guild.id);
|
||||||
|
}
|
||||||
|
};
|
94
src/events/guildMemberAdd.js
Normal file
94
src/events/guildMemberAdd.js
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
module.exports = async (client, member) => {
|
||||||
|
const settings = client.getSettings(member.guild.id);
|
||||||
|
|
||||||
|
if (settings.welcomeMessage !== "off") {
|
||||||
|
let chanExists = member.guild.channels.get(settings.welcomeChannel)
|
||||||
|
if (!chanExists) {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
welcomeMessage = settings.welcomeMessage.replace("[[user]]", member.user);
|
||||||
|
welcomeMessage = welcomeMessage.replace("[[server]]", member.guild.name);
|
||||||
|
welcomeMessage = welcomeMessage.replace("[[members]]", member.guild.memberCount);
|
||||||
|
|
||||||
|
member.guild.channels
|
||||||
|
.get(settings.welcomeChannel)
|
||||||
|
.send(welcomeMessage)
|
||||||
|
.catch(console.error);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.autorole !== "off") {
|
||||||
|
let aRole = member.guild.roles.get(settings.autorole)
|
||||||
|
if (!aRole) {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
await member.addRole(aRole.id).catch(console.error);
|
||||||
|
};
|
||||||
|
|
||||||
|
if(settings.raidMode !== "off") {
|
||||||
|
if(settings.raidModeStrict == "on") {
|
||||||
|
member.kick("User bounced.")
|
||||||
|
|
||||||
|
if (settings.chatlogsChannel !== "off") {
|
||||||
|
const channel = member.guild.channels.find(
|
||||||
|
channel => channel.name === settings.chatlogsChannel
|
||||||
|
);
|
||||||
|
|
||||||
|
if (channel) {
|
||||||
|
let embed = new Discord.RichEmbed();
|
||||||
|
embed.setColor("#1f1f1f");
|
||||||
|
embed.setAuthor("User bounced:", member.user.avatarURL);
|
||||||
|
embed.setDescription(`❯ User: ${member} (${member.user.id})`, true);
|
||||||
|
embed.setFooter(`New users are being automatically kicked because raidmode is enabled.`)
|
||||||
|
try {
|
||||||
|
channel.send({ embed });
|
||||||
|
} catch (err) {
|
||||||
|
// probably no permissions to send messages/embeds there
|
||||||
|
};
|
||||||
|
};
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let mRole = member.guild.roles.get(settings.mutedRole)
|
||||||
|
if (!mRole) {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
await member.addRole(mRole.id).catch(console.error);
|
||||||
|
if (settings.chatlogsChannel !== "off") {
|
||||||
|
const channel = member.guild.channels.find(
|
||||||
|
channel => channel.name === settings.chatlogsChannel
|
||||||
|
);
|
||||||
|
|
||||||
|
if (channel) {
|
||||||
|
let embed = new Discord.RichEmbed();
|
||||||
|
embed.setColor("#1f1f1f");
|
||||||
|
embed.setAuthor("User automatically muted:", member.user.avatarURL);
|
||||||
|
embed.setDescription(`❯ User: ${member} (${member.user.id})`, true);
|
||||||
|
embed.setFooter(`New users are being automatically muted because raidmode is enabled.`)
|
||||||
|
try {
|
||||||
|
channel.send({ embed });
|
||||||
|
} catch (err) {
|
||||||
|
// probably no permissions to send messages/embeds there
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (settings.chatlogsChannel !== "off") {
|
||||||
|
const channel = member.guild.channels.find(
|
||||||
|
channel => channel.name === settings.chatlogsChannel
|
||||||
|
);
|
||||||
|
|
||||||
|
if (channel) {
|
||||||
|
let embed = new Discord.RichEmbed();
|
||||||
|
embed.setColor("#0099e1");
|
||||||
|
embed.setAuthor("User joined:", member.user.avatarURL);
|
||||||
|
embed.setDescription(`❯ User: ${member} (${member.user.id})`, true);
|
||||||
|
try {
|
||||||
|
channel.send({ embed });
|
||||||
|
} catch (err) {
|
||||||
|
// probably no permissions to send messages/embeds there
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
36
src/events/guildMemberRemove.js
Normal file
36
src/events/guildMemberRemove.js
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
module.exports = async (client, member) => {
|
||||||
|
const settings = client.getSettings(member.guild.id);
|
||||||
|
|
||||||
|
if (settings.leaveMessage !== "off") {
|
||||||
|
let chanExists = member.guild.channels.get(settings.welcomeChannel)
|
||||||
|
if (!chanExists) {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
leaveMessage = settings.leaveMessage.replace("[[user]]", member.user);
|
||||||
|
leaveMessage = leaveMessage.replace("[[server]]", member.guild.name);
|
||||||
|
leaveMessage = leaveMessage.replace("[[members]]", member.guild.memberCount);
|
||||||
|
|
||||||
|
member.guild.channels
|
||||||
|
.get(settings.welcomeChannel)
|
||||||
|
.send(leaveMessage)
|
||||||
|
.catch(console.error);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (settings.chatlogsChannel !== "off") {
|
||||||
|
const channel = member.guild.channels.find(
|
||||||
|
channel => channel.name === settings.chatlogsChannel
|
||||||
|
);
|
||||||
|
|
||||||
|
if (channel) {
|
||||||
|
let embed = new Discord.RichEmbed();
|
||||||
|
embed.setColor("#006798");
|
||||||
|
embed.setAuthor("User left:", member.user.avatarURL);
|
||||||
|
embed.setDescription(`❯ ${member.user.tag} (${member.user.id})`, true);
|
||||||
|
try {
|
||||||
|
channel.send({ embed });
|
||||||
|
} catch (err) {
|
||||||
|
// probably no permissions to send messages/embeds there
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
226
src/events/message.js
Normal file
226
src/events/message.js
Normal file
|
@ -0,0 +1,226 @@
|
||||||
|
const commandRanRecently = new Set();
|
||||||
|
module.exports = async (client, message) => {
|
||||||
|
if (message.author.bot) return;
|
||||||
|
|
||||||
|
var settings;
|
||||||
|
|
||||||
|
if(message.guild) {
|
||||||
|
settings = message.settings = client.getSettings(message.guild.id) || client.defaultSettings;
|
||||||
|
} else {
|
||||||
|
settings= client.config.defaultSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
var prefix = settings.prefix;
|
||||||
|
|
||||||
|
if(client.devmode == true) {
|
||||||
|
prefix = settings.devprefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(message.guild) {
|
||||||
|
|
||||||
|
perms = message.channel.permissionsFor(client.user);
|
||||||
|
|
||||||
|
var modRole = message.guild.roles.get(settings.modRole);
|
||||||
|
var adminRole = message.guild.roles.get(settings.adminRole);
|
||||||
|
var autorole = message.guild.roles.get(settings.autorole);
|
||||||
|
var mutedRole = message.guild.roles.get(settings.mutedRole);
|
||||||
|
var welcomeChannel = message.guild.channels.get(settings.welcomeChannel)
|
||||||
|
|
||||||
|
if(!welcomeChannel && settings.welcomeChannel != "off" || !adminRole && settings.adminRole != "None set" || !modRole && settings.modRole != "None set" || !mutedRole && settings.mutedRole != "None set" || !autorole && settings.autorole != "off") {
|
||||||
|
|
||||||
|
var adminReset = false;
|
||||||
|
var modReset = false;
|
||||||
|
var mutedReset = false;
|
||||||
|
var autoReset = false;
|
||||||
|
var welcomeReset = false;
|
||||||
|
|
||||||
|
if(!adminRole && settings.adminRole != "None set") {
|
||||||
|
var role = message.guild.roles.find(r => r.name === settings.adminRole);
|
||||||
|
if(!role) {
|
||||||
|
adminReset = true;
|
||||||
|
client.settings.set(message.guild.id, client.config.defaultSettings.adminRole, "adminRole");
|
||||||
|
} else {
|
||||||
|
client.settings.set(message.guild.id, role.id, "adminRole");
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if(!mutedRole && settings.mutedRole != "None set") {
|
||||||
|
var role = message.guild.roles.find(r => r.name === settings.mutedRole);
|
||||||
|
if(!role) {
|
||||||
|
mutedReset = true;
|
||||||
|
client.settings.set(message.guild.id, client.config.defaultSettings.mutedRole, "mutedRole");
|
||||||
|
} else {
|
||||||
|
client.settings.set(message.guild.id, role.id, "mutedRole");
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if(!modRole && settings.modRole != "None set") {
|
||||||
|
var role = message.guild.roles.find(r => r.name === settings.modRole);
|
||||||
|
if(!role) {
|
||||||
|
modReset = true;
|
||||||
|
client.settings.set(message.guild.id, client.config.defaultSettings.modRole, "modRole");
|
||||||
|
} else {
|
||||||
|
client.settings.set(message.guild.id, role.id, "modRole");
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if(!autorole && settings.autorole != "off") {
|
||||||
|
var role = message.guild.roles.find(r => r.name === settings.autorole);
|
||||||
|
if(!role) {
|
||||||
|
autoReset = true;
|
||||||
|
client.settings.set(message.guild.id, client.config.defaultSettings.autorole, "autorole");
|
||||||
|
} else {
|
||||||
|
client.settings.set(message.guild.id, role.id, "autorole");
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if(!welcomeChannel && settings.welcomeChannel != "off") {
|
||||||
|
var channel = message.guild.channels.find(c => c.name === settings.welcomeChannel);
|
||||||
|
if(!channel) {
|
||||||
|
welcomeReset = true;
|
||||||
|
client.settings.set(message.guild.id, client.config.defaultSettings.welcomeChannel, "welcomeChannel");
|
||||||
|
} else {
|
||||||
|
client.settings.set(message.guild.id, channel.id, "welcomeChannel");
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
var errors = "";
|
||||||
|
if(adminReset == true) {
|
||||||
|
adminReset = false;
|
||||||
|
errors += ", `admin role`";
|
||||||
|
};
|
||||||
|
|
||||||
|
if(modReset == true) {
|
||||||
|
modReset = false;
|
||||||
|
errors += ", `mod role`";
|
||||||
|
};
|
||||||
|
|
||||||
|
if(mutedReset == true) {
|
||||||
|
mutedReset = false;
|
||||||
|
errors += ", `muted role`";
|
||||||
|
};
|
||||||
|
|
||||||
|
if(autoReset == true) {
|
||||||
|
autoReset = false;
|
||||||
|
errors += ", `autorole`";
|
||||||
|
};
|
||||||
|
|
||||||
|
if(welcomeReset == true) {
|
||||||
|
welcomeReset = false;;
|
||||||
|
errors += ", `join/leave channel`";
|
||||||
|
};
|
||||||
|
|
||||||
|
if(errors.length > 1) {
|
||||||
|
var errors = errors.substr(2);
|
||||||
|
message.channel.send(`<:error:466995152976871434> A role or channel was deleted, and the following settings have been restored to their default values: ${errors}`);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!message.member) {
|
||||||
|
await message.guild.fetchMember(message.author);
|
||||||
|
};
|
||||||
|
|
||||||
|
if(message.settings.blacklisted != "ARRAY" && settings.blacklisted.length > 0) {
|
||||||
|
let blacklisted = false;
|
||||||
|
|
||||||
|
settings.blacklisted.forEach(function(ID) {
|
||||||
|
if(ID == message.author.id) {
|
||||||
|
blacklisted = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if(blacklisted == true) {
|
||||||
|
try {
|
||||||
|
return message.author.send(
|
||||||
|
`<:denied:466995195150336020> You have been blacklisted from using commands in \`${message.guild.name}\``
|
||||||
|
);
|
||||||
|
} catch(err) {
|
||||||
|
client.logger.log(err, "error")
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!perms.has('SEND_MESSAGES')) {
|
||||||
|
return message.author.send(`<:error:466995152976871434> I don't have permission to speak in **#${message.channel.name}**, Please ask a moderator to give me the send messages permission!`);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (commandRanRecently.has(message.author.id)) {
|
||||||
|
return message.channel.send(
|
||||||
|
`<:wait:467115775849922570> You are being ratelimited. Please try again in 2 seconds.`
|
||||||
|
)
|
||||||
|
.then(m => m.delete(2000));
|
||||||
|
};
|
||||||
|
|
||||||
|
const prefixMention = new RegExp(`^<@!?${client.user.id}>( |)$`);
|
||||||
|
|
||||||
|
if (message.content.match(prefixMention)) {
|
||||||
|
return message.channel.send(`Current prefix: \`${prefix}\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (message.content.indexOf(prefix) !== 0) return;
|
||||||
|
|
||||||
|
const args = message.content.slice(prefix.length).trim().split(/ +/g);
|
||||||
|
const command = args.shift().toLowerCase();
|
||||||
|
const cmd = client.commands.get(command) || client.commands.get(client.aliases.get(command));
|
||||||
|
|
||||||
|
if (!cmd) return;
|
||||||
|
|
||||||
|
if (cmd && !message.guild && cmd.conf.guildOnly)
|
||||||
|
return message.channel.send("<:denied:466995195150336020> This command is unavailable in DM's. Try running it in a server I'm in!");
|
||||||
|
|
||||||
|
if (message.guild) {
|
||||||
|
var missing = cmd.conf.requiredPerms.filter(p => !perms.has(p))
|
||||||
|
if(missing.length > 0) {
|
||||||
|
missing = "`" + (missing.join("`, `")) + "`";
|
||||||
|
return message.channel.send(`<:error:466995152976871434> Missing permissions: ${missing}`)
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const level = client.permlevel(message);
|
||||||
|
|
||||||
|
if(cmd.conf.permLevel == "Developer") {
|
||||||
|
var isDeveloper;
|
||||||
|
if(message.client.config.owners.includes(message.author.id)) {
|
||||||
|
isDeveloper = true;
|
||||||
|
}
|
||||||
|
if(isDeveloper != true) {
|
||||||
|
return message.channel.send("<:denied:466995195150336020> This command can only be used by my developers!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (level < client.levelCache[cmd.conf.permLevel]) {
|
||||||
|
var usrlvl = client.levelCache[cmd.conf.permLevel];
|
||||||
|
if (usrlvl === 1) var displevel = "Moderator";
|
||||||
|
if (usrlvl === 2) var displevel = "Administrator";
|
||||||
|
if (usrlvl === 3) var displevel = "Server Owner";
|
||||||
|
|
||||||
|
if (!modRole && usrlvl < 2 && cmd.conf.permLevel == "Moderator" && message.guild) {
|
||||||
|
return message.channel.send("<:error:466995152976871434> No moderator role set! Please ask the server owner to set one with `" + message.settings.prefix + "modrole <role>`")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!adminRole && usrlvl < 3 && cmd.conf.permLevel == "Administrator" && message.guild) {
|
||||||
|
return message.channel.send("<:error:466995152976871434> No administrator role set! Please ask the server owner to set one with `" + message.settings.prefix + "adminrole <role>`")
|
||||||
|
}
|
||||||
|
|
||||||
|
var englesh = "a";
|
||||||
|
if (displevel === "Administrator") englesh = "an";
|
||||||
|
if (displevel === "Server Owner") englesh = "the";
|
||||||
|
return message.channel.send(`<:denied:466995195150336020> You need to be ${englesh} ${displevel} to run this command!`);
|
||||||
|
}
|
||||||
|
|
||||||
|
message.author.permLevel = level;
|
||||||
|
|
||||||
|
message.flags = [];
|
||||||
|
while (args[0] && args[0][0] === "-") {
|
||||||
|
message.flags.push(args.shift().slice(1));
|
||||||
|
};
|
||||||
|
|
||||||
|
commandRanRecently.add(message.author.id);
|
||||||
|
setTimeout(() => {
|
||||||
|
commandRanRecently.delete(message.author.id);
|
||||||
|
}, 2000);
|
||||||
|
|
||||||
|
client.logger.cmd(`${client.config.permLevels.find(l => l.level === level).name} ${message.author.username} (${message.author.id}) ran command ${cmd.help.name}`);
|
||||||
|
|
||||||
|
cmd.run(client, message, args, level);
|
||||||
|
};
|
40
src/events/messageDelete.js
Normal file
40
src/events/messageDelete.js
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
const Discord = require("discord.js");
|
||||||
|
|
||||||
|
module.exports = (client, message) => {
|
||||||
|
if (message.author.bot) return;
|
||||||
|
|
||||||
|
const settings = (message.settings = client.getSettings(message.guild.id));
|
||||||
|
|
||||||
|
if (settings.chatlogsChannel !== "off") {
|
||||||
|
const channel = message.guild.channels.find(
|
||||||
|
channel => channel.name === settings.chatlogsChannel
|
||||||
|
)
|
||||||
|
|
||||||
|
var msg = message.content;
|
||||||
|
|
||||||
|
if(!message.member) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(msg.length + message.member.user.username.length + message.member.user.id.length + message.channel.name.length + 2 > 2048) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (channel) {
|
||||||
|
let embed = new Discord.RichEmbed();
|
||||||
|
embed.setColor("#f93a2f");
|
||||||
|
embed.setAuthor("Message deleted!", message.member.user.avatarURL);
|
||||||
|
if (msg == "") {
|
||||||
|
msg = "**An image was deleted, but is not shown for privacy reasons.**"
|
||||||
|
} else {
|
||||||
|
msg = `\`${msg}\``
|
||||||
|
}// image-only; maybe we can add image logging too but depends privacy (if someone sends like personal stuff accidentally)
|
||||||
|
embed.setDescription(`❯ Author: ${message.member} (${message.member.user.id})\n❯ Channel: ${message.channel}\n❯ Message: ${msg}`)
|
||||||
|
try {
|
||||||
|
channel.send({ embed });
|
||||||
|
} catch (err) {
|
||||||
|
// probably no permissions to send messages/embeds there
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
40
src/events/messageUpdate.js
Normal file
40
src/events/messageUpdate.js
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
const Discord = require("discord.js");
|
||||||
|
|
||||||
|
module.exports = (client, omsg, nmsg) => {
|
||||||
|
if (nmsg.content === omsg.content) return;
|
||||||
|
|
||||||
|
const settings = (omsg.settings = nmsg.settings = client.getSettings(
|
||||||
|
nmsg.guild.id
|
||||||
|
));
|
||||||
|
|
||||||
|
if (settings.chatlogsChannel !== "off") {
|
||||||
|
const channel = nmsg.guild.channels.find(
|
||||||
|
channel => channel.name === settings.chatlogsChannel
|
||||||
|
);
|
||||||
|
|
||||||
|
if (channel) {
|
||||||
|
let embed = new Discord.RichEmbed();
|
||||||
|
embed.setColor("#fff937");
|
||||||
|
embed.setAuthor("Message Edited!", nmsg.member.user.avatarURL);
|
||||||
|
if (omsg.content == "") {
|
||||||
|
omsg.content = "**[IMAGE]**"
|
||||||
|
} else if (nmsg.content == "") {
|
||||||
|
nmsg.content = `**[IMAGE]**`
|
||||||
|
} else {
|
||||||
|
omsg.content = `\`${omsg.content}\``
|
||||||
|
nmsg.content = `\`${nmsg.content}\``
|
||||||
|
}
|
||||||
|
|
||||||
|
if(omsg.content.length + nmsg.content.length + nmsg.member.user.username.length + nmsg.member.user.id.length + nmsg.channel.name.length + 2 > 2048) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
embed.setDescription(`❯ Author: ${nmsg.member} (${nmsg.member.user.id})\n❯ Channel: ${nmsg.channel}\n❯ Old message: ${omsg.content}\n❯ New message: ${nmsg.content}`)
|
||||||
|
try {
|
||||||
|
channel.send({ embed });
|
||||||
|
} catch (err) {
|
||||||
|
// probably no permissions to send messages/embeds there
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
32
src/events/ready.js
Normal file
32
src/events/ready.js
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
const moment = require("moment");
|
||||||
|
module.exports = client => {
|
||||||
|
|
||||||
|
const timestamp = `${moment().format("YYYY-MM-DD HH:mm:ss")}`;
|
||||||
|
const activityArray = client.commands.keyArray();
|
||||||
|
|
||||||
|
client.lockActivity = false;
|
||||||
|
|
||||||
|
client.logger.log(`Connected to Discord as ${client.user.tag} | v${client.update.version}`, "ready");
|
||||||
|
|
||||||
|
let channel;
|
||||||
|
let channel1;
|
||||||
|
|
||||||
|
try { channel = client.guilds.get('410990517841690625').channels.get('570963998342643732'); } catch(err) {};
|
||||||
|
try { channel1 = client.guilds.get('410990517841690625').channels.get('570963481189154822'); } catch(err) {};
|
||||||
|
|
||||||
|
if(client.devmode == true) {
|
||||||
|
client.logger.warn("Running in development mode.")
|
||||||
|
prefix = client.config.defaultSettings.devprefix;
|
||||||
|
} else {
|
||||||
|
prefix = client.config.defaultSettings.prefix;
|
||||||
|
channel.send(`\`${timestamp}\`: Ready event fired! Connected to ${client.users.size} users in ${client.guilds.size} guilds.`);
|
||||||
|
channel1.send(`\`${timestamp}\`: **Ready event fired**`);
|
||||||
|
}
|
||||||
|
|
||||||
|
let randomActivity = activityArray.random();
|
||||||
|
|
||||||
|
client.user.setActivity(`${prefix + randomActivity} | v${client.update.version}`, {type: "PLAYING"});
|
||||||
|
setInterval(() => {
|
||||||
|
randomActivity = activityArray.random();
|
||||||
|
if(client.lockActivity == false) client.user.setActivity(`${prefix + randomActivity} | v${client.update.version}`, {type: "PLAYING"})}, 30000);
|
||||||
|
};
|
66
src/modules/Logger.js
Normal file
66
src/modules/Logger.js
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
const chalk = require("chalk");
|
||||||
|
const moment = require("moment");
|
||||||
|
|
||||||
|
exports.log = (content, type = "log") => {
|
||||||
|
const timestamp = `[${moment().format("YYYY-MM-DD HH:mm:ss")}]`;
|
||||||
|
const timestamp1 = `\`${moment().format("YYYY-MM-DD HH:mm:ss")}\`:`;
|
||||||
|
|
||||||
|
let channel;
|
||||||
|
|
||||||
|
try { channel = client.guilds.get('410990517841690625').channels.get('570963481189154822'); } catch(err) {}
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case "log": {
|
||||||
|
try { if (client.user.id === "435961704145485835") {
|
||||||
|
channel.send(`${timestamp1} ` + content);
|
||||||
|
};
|
||||||
|
} catch(err) {};
|
||||||
|
return console.log(`${timestamp} ${chalk.cyanBright(`[${type.toUpperCase()}] -`)} ${content} `);
|
||||||
|
};
|
||||||
|
case "warn": {
|
||||||
|
try { if (client.user.id === "435961704145485835") {
|
||||||
|
channel.send(`${timestamp1} ` + content);
|
||||||
|
};
|
||||||
|
} catch(err) {};
|
||||||
|
return console.log(`${timestamp} ${chalk.yellowBright(`[${type.toUpperCase()}]`)} ${content} `);
|
||||||
|
};
|
||||||
|
case "error": {
|
||||||
|
try { if (client.user.id === "439594675230212096") {
|
||||||
|
channel.send(`${timestamp1} ` + content);
|
||||||
|
};
|
||||||
|
} catch(err) {}
|
||||||
|
return console.log(`${timestamp} ${chalk.redBright(`[${type.toUpperCase()}]`)} ${content} `);
|
||||||
|
};
|
||||||
|
case "debug": {
|
||||||
|
try { if (client.user.id === "435961704145485835") {
|
||||||
|
channel.send(`${timestamp1} ` + content);
|
||||||
|
};
|
||||||
|
} catch(err) {};
|
||||||
|
return console.log(`${timestamp} ${chalk.magentaBright(`[${type.toUpperCase()}]`)} ${content} `);
|
||||||
|
};
|
||||||
|
case "cmd": {
|
||||||
|
try { if (client.user.id === "435961704145485835") {
|
||||||
|
channel.send(`${timestamp1} ` + content);
|
||||||
|
};
|
||||||
|
} catch(err) {};
|
||||||
|
return console.log(`${timestamp} ${chalk.whiteBright(`[${type.toUpperCase()}]`)} ${content}`);
|
||||||
|
};
|
||||||
|
case "ready": {
|
||||||
|
return console.log(`${timestamp} ${chalk.greenBright (`[${type.toUpperCase()}]`)} ${content}`);
|
||||||
|
};
|
||||||
|
default: throw new TypeError("Logger type must be either warn, debug, log, ready, cmd or error.");
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.error = (...args) => this.log(...args, "error");
|
||||||
|
|
||||||
|
exports.warn = (...args) => this.log(...args, "warn");
|
||||||
|
|
||||||
|
exports.debug = (...args) => this.log(...args, "debug");
|
||||||
|
|
||||||
|
exports.cmd = (...args) => this.log(...args, "cmd");
|
||||||
|
|
||||||
|
exports.setClient = function(c)
|
||||||
|
{
|
||||||
|
client = c;
|
||||||
|
};
|
345
src/modules/functions.js
Normal file
345
src/modules/functions.js
Normal file
|
@ -0,0 +1,345 @@
|
||||||
|
const ytdl = require('ytdl-core-discord');
|
||||||
|
const youtubeInfo = require('youtube-info');
|
||||||
|
const getYoutubeId = require('get-youtube-id');
|
||||||
|
const request = require('request');
|
||||||
|
|
||||||
|
module.exports = client => {
|
||||||
|
// Permission level function
|
||||||
|
client.permlevel = message => {
|
||||||
|
let permlvl = 0;
|
||||||
|
|
||||||
|
const permOrder = client.config.permLevels
|
||||||
|
.slice(0)
|
||||||
|
.sort((p, c) => (p.level < c.level ? 1 : -1));
|
||||||
|
|
||||||
|
while (permOrder.length) {
|
||||||
|
const currentLevel = permOrder.shift();
|
||||||
|
if (message.guild && currentLevel.guildOnly) continue;
|
||||||
|
if (currentLevel.check(message)) {
|
||||||
|
permlvl = currentLevel.level;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return permlvl;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Guild settings function
|
||||||
|
client.getSettings = guild => {
|
||||||
|
const defaults = client.config.defaultSettings || {};
|
||||||
|
if (!guild) return defaults;
|
||||||
|
const guildData = client.settings.get(guild) || {};
|
||||||
|
const returnObject = {};
|
||||||
|
Object.keys(defaults).forEach(key => {
|
||||||
|
returnObject[key] = guildData[key] ? guildData[key] : defaults[key];
|
||||||
|
});
|
||||||
|
return returnObject;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Single line await messages
|
||||||
|
client.awaitReply = async (msg, question, limit = 60000) => {
|
||||||
|
const filter = m => m.author.id === msg.author.id;
|
||||||
|
await msg.channel.send(question);
|
||||||
|
try {
|
||||||
|
const collected = await msg.channel.awaitMessages(filter, {
|
||||||
|
max: 1,
|
||||||
|
time: limit,
|
||||||
|
errors: ["time"]
|
||||||
|
});
|
||||||
|
return collected.first().content;
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Message clean function
|
||||||
|
client.clean = async (client, text) => {
|
||||||
|
if (text && text.constructor.name == "Promise") text = await text;
|
||||||
|
if (typeof evaled !== "string")
|
||||||
|
text = require("util").inspect(text, { depth: 1 });
|
||||||
|
|
||||||
|
text = text
|
||||||
|
.replace(/`/g, "`" + String.fromCharCode(8203))
|
||||||
|
.replace(/@/g, "@" + String.fromCharCode(8203))
|
||||||
|
.replace(
|
||||||
|
client.token,
|
||||||
|
"NaKzDzgwNDef1Nitl3YmDAy.tHEvdg.r34L.whl7sTok3N.18n4Ryj094p"
|
||||||
|
);
|
||||||
|
|
||||||
|
return text;
|
||||||
|
};
|
||||||
|
|
||||||
|
client.loadCommand = commandName => {
|
||||||
|
try {
|
||||||
|
client.logger.log(`Loading command: ${commandName}`);
|
||||||
|
const props = require(`../commands/${commandName}`);
|
||||||
|
if (props.init) {
|
||||||
|
props.init(client);
|
||||||
|
}
|
||||||
|
client.commands.set(props.help.name, props);
|
||||||
|
props.conf.aliases.forEach(alias => {
|
||||||
|
client.aliases.set(alias, props.help.name);
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
} catch (e) {
|
||||||
|
return `Failed to load command ${commandName}: ${e}`;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
client.unloadCommand = async commandName => {
|
||||||
|
let command;
|
||||||
|
if (client.commands.has(commandName)) {
|
||||||
|
command = client.commands.get(commandName);
|
||||||
|
} else if (client.aliases.has(commandName)) {
|
||||||
|
command = client.commands.get(client.aliases.get(commandName));
|
||||||
|
};
|
||||||
|
if (!command)
|
||||||
|
return `<:error:466995152976871434> The command \`${commandName}\` could not be found.`;
|
||||||
|
|
||||||
|
if (command.shutdown) {
|
||||||
|
await command.shutdown(client);
|
||||||
|
};
|
||||||
|
const mod = require.cache[require.resolve(`../commands/${commandName}`)];
|
||||||
|
delete require.cache[require.resolve(`../commands/${commandName}.js`)];
|
||||||
|
for (let i = 0; i < mod.parent.children.length; i++) {
|
||||||
|
if (mod.parent.children[i] === mod) {
|
||||||
|
mod.parent.children.splice(i, 1);
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
// EMBED COLOUR CONTROL
|
||||||
|
client.embedColour = function(msg) {
|
||||||
|
if(!msg.guild) {
|
||||||
|
return ["#ff9d68", "#ff97cb", "#d789ff", "#74FFFF"].random();
|
||||||
|
} else {
|
||||||
|
return msg.guild.member(client.user).displayHexColor;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// MEMBER SEARCH
|
||||||
|
client.searchForMembers = function(guild, query) {
|
||||||
|
if (!query) return;
|
||||||
|
query = query.toLowerCase();
|
||||||
|
|
||||||
|
var a = [];
|
||||||
|
var b;
|
||||||
|
|
||||||
|
try {
|
||||||
|
b = guild.members.find(x => x.displayName.toLowerCase() == query);
|
||||||
|
if (!b) guild.members.find(x => x.user.username.toLowerCase() == query);
|
||||||
|
} catch (err) {};
|
||||||
|
if (b) a.push(b);
|
||||||
|
guild.members.forEach(member => {
|
||||||
|
if (
|
||||||
|
(member.displayName.toLowerCase().startsWith(query) ||
|
||||||
|
member.user.username.toLowerCase().startsWith(query)) &&
|
||||||
|
member.id != (b && b.id)
|
||||||
|
) {
|
||||||
|
a.push(member);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
return a;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Music stuff
|
||||||
|
client.music = {guilds: {}};
|
||||||
|
|
||||||
|
client.music.isYoutubeLink = function(input) {
|
||||||
|
return input.startsWith('https://www.youtube.com/') || input.startsWith('http://www.youtube.com/') || input.startsWith('https://youtube.com/') || input.startsWith('http://youtube.com/') || input.startsWith('https://youtu.be/') || input.startsWith('http://youtu.be/') || input.startsWith('http://m.youtube.com/') || input.startsWith('https://m.youtube.com/');
|
||||||
|
}
|
||||||
|
|
||||||
|
client.music.search = async function(query)
|
||||||
|
{
|
||||||
|
return new Promise(function(resolve, reject)
|
||||||
|
{
|
||||||
|
request("https://www.googleapis.com/youtube/v3/search?part=id&type=video&q=" + encodeURIComponent(query) + "&key=" + client.config.ytkey, function(error, response, body)
|
||||||
|
{
|
||||||
|
if(error) throw error;
|
||||||
|
|
||||||
|
var json = JSON.parse(body);
|
||||||
|
if(!json.items) { reject(); return; }
|
||||||
|
resolve(json.items[0]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
client.music.getGuild = function(id)
|
||||||
|
{
|
||||||
|
if(client.music.guilds[id]) return client.music.guilds[id];
|
||||||
|
|
||||||
|
return client.music.guilds[id] =
|
||||||
|
{
|
||||||
|
queue: [],
|
||||||
|
playing: false,
|
||||||
|
paused: false,
|
||||||
|
dispatcher: null,
|
||||||
|
skippers: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
client.music.getMeta = async function(id)
|
||||||
|
{
|
||||||
|
return new Promise(function(resolve, reject)
|
||||||
|
{
|
||||||
|
youtubeInfo(id, function(err, videoInfo)
|
||||||
|
{
|
||||||
|
if(err) throw err;
|
||||||
|
|
||||||
|
resolve(videoInfo);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
client.music.play = async function(message, input, bypassQueue)
|
||||||
|
{
|
||||||
|
let voiceChannel = message.member.voiceChannel;
|
||||||
|
if(!voiceChannel) return message.channel.send('<:error:466995152976871434> You need to be in a voice channel to use this command!');
|
||||||
|
|
||||||
|
let permissions = voiceChannel.permissionsFor(client.user);
|
||||||
|
if (!permissions.has('CONNECT')) {
|
||||||
|
return message.channel.send('<:error:466995152976871434> I do not have permission to join your voice channel.');
|
||||||
|
}
|
||||||
|
if (!permissions.has('SPEAK')) {
|
||||||
|
return message.channel.send('<:error:466995152976871434> I do not have permission to join your voice channel.');
|
||||||
|
}
|
||||||
|
if (message.member.voiceChannel.joinable != true) {
|
||||||
|
return message.channel.send("<:error:466995152976871434> I do not have permission to join your voice channel.")
|
||||||
|
}
|
||||||
|
|
||||||
|
let id = undefined;
|
||||||
|
|
||||||
|
if(client.music.isYoutubeLink(input))
|
||||||
|
{
|
||||||
|
id = await getYoutubeId(input)
|
||||||
|
} else {
|
||||||
|
let item = await client.music.search(input);
|
||||||
|
if(!item) {
|
||||||
|
return message.channel.send(`<:error:466995152976871434> No results found.`);
|
||||||
|
};
|
||||||
|
id = item.id.videoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(client.music.getGuild(message.guild.id).queue.length == 0 || bypassQueue)
|
||||||
|
{
|
||||||
|
let meta = await client.music.getMeta(id);
|
||||||
|
|
||||||
|
if(!bypassQueue) client.music.getGuild(message.guild.id).queue.push({input: input, id: id, requestedBy: message.author, title: meta.title, author: meta.owner, thumbnail: meta.thumbnailUrl, duration: meta.duration});
|
||||||
|
|
||||||
|
let connection = await new Promise((resolve, reject) =>
|
||||||
|
{
|
||||||
|
voiceChannel.join().then((connection) =>
|
||||||
|
{
|
||||||
|
resolve(connection);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function end(silent)
|
||||||
|
{
|
||||||
|
client.music.getGuild(message.guild.id).queue.shift();
|
||||||
|
client.music.getGuild(message.guild.id).dispatcher = null;
|
||||||
|
|
||||||
|
if(client.music.getGuild(message.guild.id).queue.length > 0)
|
||||||
|
{
|
||||||
|
client.music.play(message, client.music.getGuild(message.guild.id).queue[0].input, true);
|
||||||
|
} else {
|
||||||
|
client.music.getGuild(message.guild.id).playing = false;
|
||||||
|
|
||||||
|
if(!silent) {
|
||||||
|
message.channel.send("<:play:467216788187512832> Queue is empty! Disconnecting from the voice channel.");
|
||||||
|
}
|
||||||
|
|
||||||
|
connection.disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
client.music.getGuild(message.guild.id).playing = true;
|
||||||
|
|
||||||
|
let song = client.music.getGuild(message.guild.id).queue[0];
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
let dispatcher = client.music.getGuild(message.guild.id).dispatcher = connection.playOpusStream(await ytdl("https://www.youtube.com/watch?v=" + id, {highWaterMark: 1024 * 1024 * 32}));
|
||||||
|
|
||||||
|
dispatcher.on('end', (a, b) =>
|
||||||
|
{
|
||||||
|
end(a == "silent");
|
||||||
|
});
|
||||||
|
} catch(err) {
|
||||||
|
message.channel.send('<:error:466995152976871434> Failed to play **' + song.title + '** ' + err);
|
||||||
|
|
||||||
|
end();
|
||||||
|
}
|
||||||
|
|
||||||
|
client.music.getGuild(message.guild.id).skippers = [];
|
||||||
|
message.channel.send(`<:play:467216788187512832> Now playing: **${song.title}**`);
|
||||||
|
} else {
|
||||||
|
let meta = await client.music.getMeta(id);
|
||||||
|
let song = {input: input, id: id, requestedBy: message.author, title: meta.title, author: meta.owner, thumbnail: meta.thumbnailUrl, duration: meta.duration};
|
||||||
|
|
||||||
|
client.music.getGuild(message.guild.id).queue.push(song);
|
||||||
|
|
||||||
|
message.channel.send(`<:success:466995111885144095> Added to queue: **${song.title}**`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// COVNERT SECONDS TO TIMESTAMP
|
||||||
|
client.createTimestamp = function(duration){
|
||||||
|
hrs = ~~(duration / 60 / 60),
|
||||||
|
min = ~~(duration / 60) % 60,
|
||||||
|
sec = ~~(duration - min * 60);
|
||||||
|
|
||||||
|
if(String(hrs).length < 2) {
|
||||||
|
hrs = "0" + String(hrs) + ":";
|
||||||
|
};
|
||||||
|
|
||||||
|
if(String(min).length < 2) {
|
||||||
|
min = "0" + String(min);
|
||||||
|
};
|
||||||
|
|
||||||
|
if(String(sec).length < 2) {
|
||||||
|
sec = "0" + String(sec);
|
||||||
|
};
|
||||||
|
|
||||||
|
if(hrs == "00:") {
|
||||||
|
hrs = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
var time = hrs + min + ":" + sec;
|
||||||
|
return time;
|
||||||
|
};
|
||||||
|
|
||||||
|
// MISCELLANEOUS NON-CRITICAL FUNCTIONS
|
||||||
|
|
||||||
|
// <String>.toPropercase() returns a proper-cased string
|
||||||
|
Object.defineProperty(String.prototype, "toProperCase", {
|
||||||
|
value: function() {
|
||||||
|
return this.replace(
|
||||||
|
/([^\W_]+[^\s-]*) */g,
|
||||||
|
txt => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// <Array>.random() returns a single random element from an array
|
||||||
|
Object.defineProperty(Array.prototype, "random", {
|
||||||
|
value: function() {
|
||||||
|
return this[Math.floor(Math.random() * this.length)];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// `await client.wait(1000);` to "pause" for 1 second.
|
||||||
|
client.wait = require("util").promisify(setTimeout);
|
||||||
|
|
||||||
|
// These 2 process methods will catch exceptions and give *more details* about the error and stack trace.
|
||||||
|
process.on("uncaughtException", err => {
|
||||||
|
const errorMsg = err.stack.replace(new RegExp(`${__dirname}/`, "g"), "./");
|
||||||
|
client.logger.error(`Uncaught Exception: ${errorMsg}`);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
process.on("unhandledRejection", err => {
|
||||||
|
client.logger.error(`Unhandled rejection: ${err}`);
|
||||||
|
});
|
||||||
|
};
|
4
update.json
Normal file
4
update.json
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"version": "1.0",
|
||||||
|
"changelog": "**Updated to 1.0:**\n> - Music commands have been competely reworked. They're now less buggy and more feature rich!\n> - Added `nowplaying` command\n> - Added `blacklist` command, which lets you stop users from using commands in your server\n> - Woomy works in DM's again\n> - Renamed `calculate` to `math`\n> - The filter has been removed because it sucked\n> - Lots of minor changes to lots of commands\n> - Woomy now lists the permissions she needs to run specific commands in `help`\n> - Invite now lets you choose what permissions Woomy gets\n**Notes:**\n> - Woomy skipped from 0.7.0 to 1.0 so she could have a better way to name her updates. For example, the X in (X.Y.Z) will change only if there is a huge update like a rewrite, Y will change when new features are added to Woomy and Z will change when minor updates are made, like bug fixes.\n> - Woomy is now open source! You can view her code at https://github.com/mudkipscience/woomy"
|
||||||
|
}
|
63
woomy.js
Normal file
63
woomy.js
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
const Discord = require("discord.js");
|
||||||
|
const { promisify } = require("util");
|
||||||
|
const readdir = promisify(require("fs").readdir);
|
||||||
|
const Enmap = require("enmap");
|
||||||
|
const chalk = require("chalk");
|
||||||
|
const client = new Discord.Client();
|
||||||
|
|
||||||
|
client.config = require("./config");
|
||||||
|
client.update = require("./update.json");
|
||||||
|
client.logger = require("./src/modules/Logger");
|
||||||
|
client.logger.setClient(client);
|
||||||
|
|
||||||
|
require("./src/modules/functions.js")(client);
|
||||||
|
|
||||||
|
if(process.env['USER'] != 'container') {
|
||||||
|
client.devmode = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
if(client.devmode === false) {
|
||||||
|
const DBL = require("dblapi.js");
|
||||||
|
const dbl = new DBL(client.config.dblkey, client);
|
||||||
|
};
|
||||||
|
|
||||||
|
client.commands = new Enmap();
|
||||||
|
client.aliases = new Enmap();
|
||||||
|
client.settings = new Enmap({name: "settings"});
|
||||||
|
client.warnings = new Enmap({name: "warnings"});
|
||||||
|
client.blacklist = new Enmap({name: "blacklist"});
|
||||||
|
//client.points = new Enmap({name: "points"});
|
||||||
|
|
||||||
|
const init = async () => {
|
||||||
|
|
||||||
|
const cmdFiles = await readdir("./src/commands/");
|
||||||
|
client.logger.log(chalk.greenBright(`Loading ${cmdFiles.length} commands.`));
|
||||||
|
cmdFiles.forEach(f => {
|
||||||
|
if (!f.endsWith(".js")) return;
|
||||||
|
const response = client.loadCommand(f);
|
||||||
|
if (response) console.log(response);
|
||||||
|
});
|
||||||
|
|
||||||
|
const evtFiles = await readdir("./src/events/");
|
||||||
|
client.logger.log(chalk.greenBright(`Loading ${evtFiles.length} events.`));
|
||||||
|
evtFiles.forEach(file => {
|
||||||
|
const eventName = file.split(".")[0];
|
||||||
|
client.logger.log(`Loading Event: ${eventName}`);
|
||||||
|
const event = require(`./src/events/${file}`);
|
||||||
|
client.on(eventName, event.bind(null, client));
|
||||||
|
});
|
||||||
|
|
||||||
|
client.levelCache = {};
|
||||||
|
for (let i = 0; i < client.config.permLevels.length; i++) {
|
||||||
|
const thisLevel = client.config.permLevels[i];
|
||||||
|
client.levelCache[thisLevel.name] = thisLevel.level;
|
||||||
|
}
|
||||||
|
if(client.devmode === true) {
|
||||||
|
client.login(client.config.devtoken);
|
||||||
|
}
|
||||||
|
if(client.devmode !== true) {
|
||||||
|
client.login(client.config.token);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
init();
|
Loading…
Reference in a new issue