Split commands into subdirectories
* Move command files into directories * Edit relative paths * Update gitignore * Finish support for commands in subdir * Split up getCommandFiles into own function * Add support for subdirs on help command
This commit is contained in:
parent
8993eeaf7a
commit
e7cdd425d1
21 changed files with 55 additions and 35 deletions
17
commands/admin/reload.js
Normal file
17
commands/admin/reload.js
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
const calculateReloaded = require("../../util/calculateReloaded.js");
|
||||
const reloadNetModules = require("../../util/reloadNetModules.js");
|
||||
|
||||
module.exports = {
|
||||
name: 'reload',
|
||||
description: 'Reloads modules.',
|
||||
admin: true,
|
||||
execute({message, client}) {
|
||||
|
||||
let reloadCommands = require("../../util/reloadCommands.js")
|
||||
let beforeSize = client.commands.size;
|
||||
reloadNetModules(client)
|
||||
reloadCommands(client)
|
||||
let sendText = calculateReloaded(beforeSize, client)
|
||||
message.channel.send(sendText)
|
||||
}
|
||||
};
|
||||
32
commands/admin/setPresence.js
Normal file
32
commands/admin/setPresence.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
const setPresence = require("../../util/setPresence");
|
||||
|
||||
module.exports = {
|
||||
name: 'setpresence',
|
||||
description: 'Set the presence for the bot',
|
||||
moreHelp: ["Presence types you can use:","PLAY, LISTEN, WATCH","Presence type have to be the first argument"],
|
||||
admin: true,
|
||||
execute({message, client, args, globalPrefix}) {
|
||||
const savePresence = require("../util/savePresence");
|
||||
let presenceType = args[0].toLocaleUpperCase();
|
||||
if(presenceType == "PLAY" || presenceType == "LISTEN" || presenceType == "WATCH"){
|
||||
|
||||
switch (presenceType) {
|
||||
case "PLAY":
|
||||
presenceType = "PLAYING";
|
||||
break;
|
||||
case "LISTEN":
|
||||
presenceType = "LISTENING";
|
||||
break;
|
||||
case "WATCH":
|
||||
presenceType = "WATCHING";
|
||||
}
|
||||
const firstArg = args[0].length + 1;
|
||||
let temp = args.join(" ");
|
||||
let presenceText = temp.slice(firstArg, temp.length)
|
||||
setPresence({presenceText: presenceText,presenceType: presenceType, client: client, globalPrefix: globalPrefix});
|
||||
savePresence(presenceType, presenceText);
|
||||
message.channel.send("Updated presence.")
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
41
commands/admin/update.js
Normal file
41
commands/admin/update.js
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
const calculateReloaded = require("../../util/calculateReloaded");
|
||||
const reloadCommands = require("../../util/reloadCommands");
|
||||
|
||||
module.exports = {
|
||||
name: 'update',
|
||||
description: 'pull changes from remote and reload commands with git',
|
||||
admin: true,
|
||||
execute({message, client}) {
|
||||
let cmd = "git pull --ff-only";
|
||||
const exec = require("child_process").exec;
|
||||
exec(cmd, (err, stdout, stderr) => {
|
||||
process.stdout.write(stdout);
|
||||
if(stdout.startsWith("Already up to date.")){
|
||||
message.channel.send("Already up to date.\nNo updating needed.")
|
||||
}else{
|
||||
let beforeSize = client.commands.size;
|
||||
reloadCommands(client)
|
||||
let sendText = `${stdout}\nBot updated, and\n${calculateReloaded(beforeSize, client)}`
|
||||
if(stdout.includes("server.js") || stdout.includes("server/")){
|
||||
sendText = sendText + "\nServer.js OR a file the server/ directory has been updated.\nThis requires the bot to be restarted."
|
||||
}
|
||||
message.channel.send(sendText).then(function(msg){
|
||||
let regex = /([^\s]+)\.\.([^\s]+)/
|
||||
let commits = stdout.match(regex)[0]
|
||||
cmd = `git log --oneline ${commits}`;
|
||||
exec(cmd, (err, stdout, stderr) =>{
|
||||
process.stdout.write(stdout)
|
||||
let commitCount = stdout.split(/\r\n|\r|\n/).length - 1
|
||||
msg.edit(`${sendText}\n\nLatest commits (${commitCount}):\n${stdout}`)
|
||||
if (err) console.log(stderr)
|
||||
})
|
||||
})
|
||||
}
|
||||
if (err) {
|
||||
message.channel.send("Something went wrong...");
|
||||
console.log(stderr);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
24
commands/info/botinfo.js
Normal file
24
commands/info/botinfo.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
const Discord = require('discord.js');
|
||||
const getCreationDate = require('../../util/getCreationDate');
|
||||
const getGuildCount = require('../../util/getGuildCount');
|
||||
|
||||
|
||||
|
||||
module.exports = {
|
||||
name: 'botinfo',
|
||||
description: 'Shows information about the bot',
|
||||
execute({message, client, prefix}) {
|
||||
let guildCount = getGuildCount(client)
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setColor(15780145)
|
||||
.setTitle("Information about bot")
|
||||
.setTimestamp()
|
||||
.setAuthor(client.user.username, client.user.avatarURL({ dynamic: true, size: 4096 }))
|
||||
.addFields({
|
||||
name: "General info", value: `Name: ${client.user.username}\nPrefix: ${prefix}\nTotal Servers: ${guildCount}\nCreation Date: ${getCreationDate(client)}\nSource: [Click Here](https://github.com/SileNce5k/discord_bot)`,
|
||||
},)
|
||||
|
||||
message.channel.send(embed)
|
||||
|
||||
}
|
||||
};
|
||||
12
commands/info/guilds.js
Normal file
12
commands/info/guilds.js
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
module.exports = {
|
||||
name: 'guilds',
|
||||
description: 'Returns guild names',
|
||||
admin: true,
|
||||
execute({message, client}) {
|
||||
let guildNames = "";
|
||||
client.guilds.cache.each(guild => {
|
||||
guildNames = guildNames + guild.name + "\n";
|
||||
});
|
||||
message.channel.send(guildNames)
|
||||
}
|
||||
};
|
||||
71
commands/info/help.js
Normal file
71
commands/info/help.js
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
const fs = require('fs');
|
||||
const Discord = require('discord.js');
|
||||
const getCommandFiles = require('../../util/getCommandFiles');
|
||||
|
||||
|
||||
module.exports = {
|
||||
name: 'help',
|
||||
description: 'List all available commands.',
|
||||
moreHelp: ["Examples:","`<prefix>help` will return help with a small description for each command",
|
||||
"`<prefix>help <another_command>` will return help with a more descriptive description",
|
||||
"The descriptive description isn't available on all commands",
|
||||
"`<prefix>help netmodules` to display help for netmodules"
|
||||
],
|
||||
execute({ message, args, prefix, client }) {
|
||||
let commands = ""
|
||||
let commandFiles = getCommandFiles('../../commands')
|
||||
let x = 0
|
||||
if (args[0] == "netmodules") {
|
||||
commandFiles = fs.readdirSync('../../netload').filter(file => file.endsWith('.js'));
|
||||
if (commandFiles.length == 0) {
|
||||
message.channel.send("There are no netmodules currently loaded.")
|
||||
x = 1;
|
||||
}
|
||||
|
||||
}
|
||||
if (x == 1) return;
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setColor(15780145)
|
||||
.setTitle("Commands")
|
||||
.setTimestamp()
|
||||
.setAuthor(client.user.username, client.user.avatarURL({ dynamic: true, size: 4096 }))
|
||||
|
||||
let noHelp = 0;
|
||||
for (const file of commandFiles) {
|
||||
const command = require(`./${file}`);
|
||||
if(command.disabled) continue;
|
||||
|
||||
if (args[0] == "admin") {
|
||||
if (command.admin)
|
||||
commands = commands + `${prefix}${command.name} | ${command.description}\n`
|
||||
}else if(!args[0]){
|
||||
if (!command.admin)
|
||||
commands = commands + `${prefix}${command.name} | ${command.description}\n`
|
||||
}else if(args[0] === command.name){
|
||||
commands = commands + `${prefix}${command.name}\n`
|
||||
embed.setTitle(command.name.charAt(0).toUpperCase() + command.name.slice(1))
|
||||
if(command.moreHelp){
|
||||
command.moreHelp.forEach(element => {
|
||||
commands = commands + `${element}\n`
|
||||
});
|
||||
} else {
|
||||
noHelp = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
let regex = /<prefix>/g
|
||||
if(commands === ""){
|
||||
noHelp = 1;
|
||||
}
|
||||
commands = commands.replace(regex, prefix)
|
||||
embed.addFields(
|
||||
{ name: "General", value: commands },
|
||||
)
|
||||
if(noHelp == 0)
|
||||
message.channel.send(embed);
|
||||
else
|
||||
message.channel.send("Either there is no command with that name, or there is no specific help for it.")
|
||||
},
|
||||
};
|
||||
19
commands/info/pfp.js
Normal file
19
commands/info/pfp.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
const parseMention = require("../../util/parseMention.js")
|
||||
|
||||
module.exports = {
|
||||
name: 'pfp',
|
||||
description: 'Returns profile picture',
|
||||
moreHelp: ["Returns your profile picture if no arguments are provided",
|
||||
"Argument can be username, nickname, userid, and mention"],
|
||||
execute({message, args}) {
|
||||
let info;
|
||||
if (!args[0]) {
|
||||
info = message.author.id;
|
||||
} else {
|
||||
info = parseMention(args[0], message.guild);
|
||||
}
|
||||
let user = message.guild.members.cache.get(info);
|
||||
|
||||
message.channel.send(user.user.avatarURL({ format: 'png', dynamic: true, size: 4096 }))
|
||||
}
|
||||
};
|
||||
23
commands/info/serverinfo.js
Normal file
23
commands/info/serverinfo.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
const Discord = require('discord.js')
|
||||
|
||||
module.exports = {
|
||||
name: 'serverinfo',
|
||||
description: 'Displays information about the server',
|
||||
execute({message}) {
|
||||
console.log(message.guild.emojis.cache)
|
||||
const embed = new Discord.MessageEmbed()
|
||||
|
||||
.setThumbnail(message.guild.iconURL({ format: 'png', dynamic: true, size: 4096 }))
|
||||
.setColor("#ee7939")
|
||||
.setTimestamp()
|
||||
.addField("Server Owner: ", `<@${message.guild.ownerID}>`)
|
||||
.addField("Server Name: ", message.guild.name)
|
||||
.addField("Created", message.guild.createdAt.toUTCString())
|
||||
.addField("Members: ", message.guild.memberCount)
|
||||
//.addField("Emojis: ", message.guild.emojis.cache.array().length)
|
||||
|
||||
message.channel.send(embed);
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
31
commands/info/uptime.js
Normal file
31
commands/info/uptime.js
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
const parseMS = require('parse-ms')
|
||||
|
||||
module.exports = {
|
||||
name: 'uptime',
|
||||
description: 'Returns uptime',
|
||||
execute({message, client}) {
|
||||
|
||||
let days = "";
|
||||
let hours = "";
|
||||
let minutes = "";
|
||||
let seconds = "";
|
||||
let milliseconds = "";
|
||||
|
||||
let uptime = parseMS(client.uptime)
|
||||
|
||||
if (uptime.days != 0)
|
||||
days = `${uptime.days} days, `
|
||||
if (uptime.hours != 0)
|
||||
hours = `${uptime.hours} hours, `
|
||||
if (uptime.minutes != 0)
|
||||
minutes = `${uptime.minutes} minutes, `
|
||||
if (uptime.seconds != 0)
|
||||
seconds = `${uptime.seconds} seconds `
|
||||
if (uptime.milliseconds != 0)
|
||||
milliseconds = `and ${uptime.milliseconds} milliseconds`
|
||||
|
||||
let fullUptime = `This bot has an uptime of ${days}${hours}${minutes}${seconds}${milliseconds}`
|
||||
|
||||
message.channel.send(fullUptime)
|
||||
}
|
||||
};
|
||||
62
commands/info/userinfo.js
Normal file
62
commands/info/userinfo.js
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
const Discord = require('discord.js');
|
||||
const getCreationDate = require('../../util/getCreationDate.js');
|
||||
const getJoinDate = require('../../util/getJoinDate.js');
|
||||
const getNickname = require('../../util/getNickname.js');
|
||||
const morePresence = require('../../util/morePresence.js');
|
||||
const parseMention = require("../../util/parseMention.js")
|
||||
|
||||
module.exports = {
|
||||
name: 'userinfo',
|
||||
description: 'Displays information about the user',
|
||||
moreHelp: ["Example: <prefix>userinfo <some_username>","It works with username, nickname, userid, and mention"],
|
||||
execute({message, args}) {
|
||||
let info;
|
||||
if (!args[0]) {
|
||||
info = message.author.id;
|
||||
} else {
|
||||
info = parseMention(args[0], message.guild);
|
||||
}
|
||||
let user = message.guild.members.cache.get(info);
|
||||
|
||||
let nickname = ""
|
||||
let _nick = getNickname(user, message.guild)
|
||||
if (_nick != null) {
|
||||
nickname = ` <:aka:572089580925485058>${nickname}`;
|
||||
}
|
||||
|
||||
let roleColor = 15788778;
|
||||
if (user.roles.color) {
|
||||
roleColor = user.roles.color.color;
|
||||
}
|
||||
let presenceDetails = 0;
|
||||
let isPresence = false;
|
||||
|
||||
if(user.user.presence.activities.length != 0){
|
||||
presenceDetails = morePresence(user);
|
||||
isPresence = true;
|
||||
}
|
||||
let roles = "";
|
||||
user.roles.cache.each(role => {
|
||||
if (role.name != "@everyone")
|
||||
roles = roles+"<@&"+role.id+">\n";
|
||||
});
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setThumbnail(user.user.avatarURL({ format: 'png', dynamic: true, size: 2048 }))
|
||||
.setColor(roleColor)
|
||||
.setTimestamp()
|
||||
.setAuthor(user.user.username, user.user.avatarURL({ format: 'png', dynamic: true, size: 2048 }))
|
||||
.addField("Username", `**${user.user.username}#${user.user.discriminator}**${nickname}`)
|
||||
.addField("Status", user.user.presence.status.charAt(0).toUpperCase()+user.user.presence.status.slice(1), true)
|
||||
if(isPresence)
|
||||
embed.addField("Presence", user.user.presence.activities[0].name, true)
|
||||
if(presenceDetails != 0)
|
||||
embed.addField("Details", presenceDetails, false)
|
||||
embed.addField("Creation date", getCreationDate(user), true)
|
||||
embed.addField("Join date", getJoinDate(user, message.guild), true)
|
||||
if(roles != ""){
|
||||
embed.addField("Roles", roles)
|
||||
}
|
||||
|
||||
message.channel.send(embed);
|
||||
}
|
||||
};
|
||||
89
commands/misc/custom.js
Normal file
89
commands/misc/custom.js
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
const addCustomCommand = require("../../util/addCustomCommand");
|
||||
const deleteCustomCommand = require("../../util/deleteCustomCommand");
|
||||
const getAllCustomCommands = require("../../util/getAllCustomCommands");
|
||||
const getOwnerOfCustomCommand = require("../../util/getOwnerOfCustomCommand");
|
||||
const Discord = require('discord.js');
|
||||
const fs = require('fs');
|
||||
const editCustomCommand = require("../../util/editCustomCommand");
|
||||
|
||||
module.exports = {
|
||||
name: 'custom',
|
||||
description: "Manage custom commands, see <prefix>help custom for more",
|
||||
moreHelp: ["<prefix>custom add - Add new custom commands",
|
||||
"<prefix>custom edit - Edit an existing command that you own",
|
||||
"<prefix>custom show - Show custom message unformatted.",
|
||||
"<prefix>custom remove - Delete your custom commands.",
|
||||
"<prefix>custom owner - check owner of custom command",
|
||||
"<prefix>custom list - list all custom commands",
|
||||
"<prefix>custom variables - list all variables you can use"
|
||||
],
|
||||
execute({message, args, client, prefix, owners}) {
|
||||
const customPath = '../../data/customCommands.json';
|
||||
if(!fs.existsSync(customPath)){
|
||||
fs.writeFileSync(customPath,"[]")
|
||||
}
|
||||
let sendText;
|
||||
if (args){
|
||||
let customName = args[1];
|
||||
let customMessage = args.slice(2, args.length).join(" ");
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "add":
|
||||
if(!customMessage) {
|
||||
message.channel.send("Message can't be empty");
|
||||
return;
|
||||
}
|
||||
sendText = addCustomCommand(customName, customMessage, message.author.id);
|
||||
break;
|
||||
case "remove":
|
||||
case "delete":
|
||||
sendText = deleteCustomCommand(customName, message.author.id, owners);
|
||||
break;
|
||||
case "owner":
|
||||
let author = getOwnerOfCustomCommand(customName);
|
||||
let user;
|
||||
if(!author)
|
||||
sendText = `${customName} does not exist`
|
||||
else{
|
||||
client.guilds.cache.each(guild => {
|
||||
user = guild.members.cache.get(author);
|
||||
});
|
||||
sendText = `The owner of ${customName} is ${user.user.username} (id: ${user.user.id}).`
|
||||
}
|
||||
|
||||
break;
|
||||
case "list":
|
||||
const embed = new Discord.MessageEmbed();
|
||||
sendText = getAllCustomCommands();
|
||||
if(sendText != ""){
|
||||
embed.setColor(15780145)
|
||||
embed.addFields(
|
||||
{ name: "Custom commands", value: sendText },
|
||||
)
|
||||
sendText = embed
|
||||
}else sendText = "NO CUSTOM COMMANDS"
|
||||
break;
|
||||
case "variables":
|
||||
sendText = "The variables you can use are:\n<prefix>\n<globalPrefix>\n<username>\n<nickname>\n<user_id>\n<discriminator>\n<guild_name>\n<guild_id>"
|
||||
break;
|
||||
case "edit":
|
||||
sendText = editCustomCommand(customName, message.author.id, customMessage)
|
||||
break;
|
||||
case "show":
|
||||
let json = fs.readFileSync(customPath, 'utf8');
|
||||
let customCommands = JSON.parse(json)
|
||||
sendText = "Command not found."
|
||||
customCommands.forEach(function (customCommand) {
|
||||
if (customCommand.customName === customName) {
|
||||
sendText = `\`\`\`\n${customCommand.customMessage}\n\`\`\``
|
||||
}
|
||||
});
|
||||
break;
|
||||
default:
|
||||
sendText = `Argument not recognized.\n"${prefix}help custom" to see all arguments you can use.`
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
message.channel.send(sendText);
|
||||
}
|
||||
};
|
||||
27
commands/misc/emoji.js
Normal file
27
commands/misc/emoji.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
module.exports = {
|
||||
name: 'e',
|
||||
description: 'Returns emoji url',
|
||||
moreHelp: ["Works with both animated and static emojis"],
|
||||
execute({ message, args }) {
|
||||
let emoji = args.join(` `);
|
||||
|
||||
if (!emoji) {
|
||||
message.channel.send("no emoji");
|
||||
return;
|
||||
}
|
||||
let extension = ".png"
|
||||
if (args[0].charAt(1) == "a") {
|
||||
extension = ".gif";
|
||||
}
|
||||
|
||||
|
||||
let num = emoji.split(":")[2];
|
||||
try {
|
||||
num = num.slice(0, -1);
|
||||
} catch (e) {
|
||||
message.channel.send("There was an error.");
|
||||
return;
|
||||
}
|
||||
message.channel.send("https://cdn.discordapp.com/emojis/" + num + extension);
|
||||
}
|
||||
};
|
||||
74
commands/misc/netload.js
Normal file
74
commands/misc/netload.js
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
const https = require('https');
|
||||
const fs = require('fs')
|
||||
const netloadDir = "../../netload"
|
||||
const validUrl = require('valid-url');
|
||||
|
||||
module.exports = {
|
||||
name: 'netload',
|
||||
description: 'Load a module from the internet',
|
||||
moreHelp: ["Examples:",
|
||||
"Either provide a link to the module, or upload it",
|
||||
"To get an example of how your module should look like, do:",
|
||||
"<prefix>netload example",
|
||||
"You have to be whitelisted to use this command.",
|
||||
"The bot operator also has to have this enabled in the config."
|
||||
],
|
||||
execute({ message, args, prefix, client, owners }) {
|
||||
let json = fs.readFileSync('../../data/netmoduleWhitelist.json', 'utf8');
|
||||
let whitelist = JSON.parse(json)
|
||||
if (json.indexOf(message.author.id.toString()) == -1) {
|
||||
message.channel.send("You do not have permissions to use this command.");
|
||||
return;
|
||||
}
|
||||
if (args[0] == "whitelist" && owners.indexOf(message.author.id.toString()) >= 0) {
|
||||
whitelist.push(args[1])
|
||||
fs.writeFileSync("./data/netmoduleWhitelist.json", JSON.stringify(whitelist, null, 4))
|
||||
return;
|
||||
}
|
||||
if (!args[0] && message.attachments.size == 0) {
|
||||
message.channel.send(`You have to either specify a url or upload a file via the command.\nTo get an example file, execute \`${prefix}netload example\``)
|
||||
return;
|
||||
|
||||
} if (args[0] == "example") {
|
||||
|
||||
let example = fs.readFileSync("../.example")
|
||||
|
||||
message.channel.send(`\`\`\`js\n${example}\n\`\`\``)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
let url, fileName;
|
||||
if (message.attachments.size > 0) {
|
||||
url = message.attachments.first().url
|
||||
fileName = message.attachments.first().name
|
||||
} else {
|
||||
url = args[0]
|
||||
if (!validUrl.isUri(url)) {
|
||||
message.channel.send("This does not look like a valid url")
|
||||
return;
|
||||
}
|
||||
fileName = args[0].split("/")[args[0].split("/").length - 1]
|
||||
}
|
||||
if (fs.existsSync(`${netloadDir}/${fileName}`)) {
|
||||
message.channel.send(`A module with this filename(${fileName}) already exists.`)
|
||||
return;
|
||||
}
|
||||
https.get(url, (res) => {
|
||||
res.on('data', (d) => {
|
||||
fs.writeFileSync(`${netloadDir}/${fileName}`, d);
|
||||
reloadNetModules(client);
|
||||
});
|
||||
|
||||
}).on('error', (e) => {
|
||||
message.channel.send("Error download file.");
|
||||
console.log(e)
|
||||
});
|
||||
|
||||
let reloadNetModules = require('../util/reloadNetModules');
|
||||
reloadNetModules(client)
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
9
commands/misc/owo.js
Normal file
9
commands/misc/owo.js
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
const owo = require('@zuzak/owo')
|
||||
module.exports = {
|
||||
name: 'owo',
|
||||
description: 'Translate to furry/weeb language',
|
||||
execute({message, args}) {
|
||||
let msg = args.join(" ")
|
||||
message.channel.send(owo.translate(msg));
|
||||
}
|
||||
};
|
||||
29
commands/misc/penissize.js
Normal file
29
commands/misc/penissize.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
let seedrandom = require('seedrandom');
|
||||
const parseMention = require('../../util/parseMention')
|
||||
module.exports = {
|
||||
name: 'penissize',
|
||||
description: 'Get penis size',
|
||||
execute({message, args}) {
|
||||
let info;
|
||||
let isSelf = true;
|
||||
if (!args[0]) {
|
||||
info = message.author.id;
|
||||
} else {
|
||||
info = parseMention(args[0], message.guild);
|
||||
isSelf = false
|
||||
}
|
||||
let rng = seedrandom(info.toString())
|
||||
let max = 45;
|
||||
let min = 1;
|
||||
let rnd = rng() * (max - min + 1) + min;
|
||||
let penisSize = rnd.toFixed(2)
|
||||
let penisSizeInches = (penisSize * 0.3937008).toFixed(2);
|
||||
let name = "Your";
|
||||
if(!isSelf){
|
||||
let user = message.guild.members.cache.get(info);
|
||||
name = user.user.username+"'s"
|
||||
}
|
||||
|
||||
message.channel.send(`${name} penis size is ${penisSize} cm, or ${penisSizeInches} inches`);
|
||||
}
|
||||
};
|
||||
7
commands/misc/ping.js
Normal file
7
commands/misc/ping.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
module.exports = {
|
||||
name: 'ping',
|
||||
description: 'Just ping.',
|
||||
execute({message, client}) {
|
||||
message.channel.send(`Pong.\n${client.ws.ping}ms`)
|
||||
}
|
||||
};
|
||||
20
commands/misc/prefix.js
Normal file
20
commands/misc/prefix.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
const parseMention = require("../../util/parseMention");
|
||||
const setServerPrefix = require("../../util/setServerPrefix");
|
||||
|
||||
module.exports = {
|
||||
name: 'prefix',
|
||||
description: 'Change the prefix of the bot in this server.',
|
||||
execute({ message, client, args, prefix }) {
|
||||
if (!message.member.hasPermission('MANAGE_GUILD')) {
|
||||
message.channel.send("You do not have sufficient permissions(MANAGE_GUILD) to change the prefix of this server.")
|
||||
return;
|
||||
}
|
||||
if (!args[0]) {
|
||||
message.channel.send(`To change the prefix, execute \`${prefix}prefix <newPrefix>\``);
|
||||
return;
|
||||
}else{
|
||||
setServerPrefix(client, args[0], message.guild.id)
|
||||
message.channel.send(`The prefix for this server is now set to ${args[0]}`)
|
||||
}
|
||||
}
|
||||
};
|
||||
16
commands/misc/random.js
Normal file
16
commands/misc/random.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
const randomNumber = require('../../util/randomNumber')
|
||||
|
||||
module.exports = {
|
||||
name: 'random',
|
||||
description: 'Returns a value between two numbers (default = 1-10)',
|
||||
execute({ message, args }) {
|
||||
let min = 1
|
||||
let max = 10
|
||||
if (args[0] && args[1]) {
|
||||
min = parseInt(args[0])
|
||||
max = parseInt(args[1])
|
||||
}
|
||||
let randNumber= randomNumber(min,max)
|
||||
message.channel.send(randNumber)
|
||||
}
|
||||
};
|
||||
14
commands/misc/say.js
Normal file
14
commands/misc/say.js
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
module.exports = {
|
||||
name: 'say',
|
||||
description: 'Repeats arguments',
|
||||
execute({message, args}) {
|
||||
|
||||
if(args.length == 0)
|
||||
message.channel.send("Can't send empty message");
|
||||
else{
|
||||
message.channel.send(args.join(" "))
|
||||
message.delete()
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
16
util/getCommandFiles.js
Normal file
16
util/getCommandFiles.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
const fs = require('fs')
|
||||
|
||||
module.exports = function (commandPath) {
|
||||
let subdir = fs.readdirSync(commandPath)
|
||||
let commandFiles = [];
|
||||
subdir.forEach(item => {
|
||||
if(fs.statSync(commandPath+item).isDirectory()){
|
||||
let subdirFiles = fs.readdirSync(commandPath+item).filter(file => file.endsWith('.js'))
|
||||
subdirFiles.forEach(file => {
|
||||
commandFiles.push(commandPath+item+"/"+file)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return commandFiles
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue