diff --git a/changes.txt b/changes.txt index 2648987..f121500 100644 --- a/changes.txt +++ b/changes.txt @@ -3,11 +3,15 @@ Links to avatars now lead to the original file size Bots now get a bot badge in the userinfo command Added dogfact and catfact command (terry) index.js now has better logging of when things fail to load/initialize (terry) -added `dice`, rolls a 6 sided die (terry) +added `dice`, rolls a sided die (terry) Help command changed, the amount of commands in each category and overall is now displayed and formatting changed added `inspire` as an alias for inspirobot ship command added find by mention to functions you can now @mention the bot to run commands added identity command, has definitions of gender identities and stuff +added pronouns command, tells you how to use pronouns +added sexuality command, has definitions of sexualities renamed math calculate +fixed woomy in dms +roleinfo now displays what permissions a role has and also the role colour in the thumbnail diff --git a/src/commands/creeper.js b/src/commands/dice.js similarity index 100% rename from src/commands/creeper.js rename to src/commands/dice.js diff --git a/src/commands/diceroll.js b/src/commands/diceroll.js index b307d4e..65900c8 100644 --- a/src/commands/diceroll.js +++ b/src/commands/diceroll.js @@ -22,6 +22,6 @@ exports.run = async (bot, message, args) => { name: "dice", category: "Fun", description: "Rolls a dice.", - usage: "dice" + usage: "dice **OR** dice " }; diff --git a/src/commands/roleinfo.js b/src/commands/roleinfo.js index f6fd0e0..e6c95a4 100644 --- a/src/commands/roleinfo.js +++ b/src/commands/roleinfo.js @@ -15,17 +15,48 @@ exports.run = async (client, message, args, level) => { return message.channel.send(`<:error:466995152976871434> Role not found.`) } - if(role.hoist === true) { - var hoist = `Yes` - } else { - var hoist = `No` - } + var permissions = "```"; + if(role.permissions.has("ADMINISTRATOR")) permissions += "ADMINISTRATOR, "; + if(role.permissions.has("CREATE_INSTANT_INVITE")) permissions += "CREATE_INSTANT_INVITE, "; + if(role.permissions.has("KICK_MEMBERS")) permissions += "KICK_MEMBERS, "; + if(role.permissions.has("BAN_MEMBERS")) permissions += "BAN_MEMBERS, "; + if(role.permissions.has("MANAGE_CHANNELS")) permissions += "MANAGE_CHANNELS, "; + if(role.permissions.has("MANAGE_GUILD")) permissions += "MANAGE_GUILD, "; + if(role.permissions.has("ADD_REACTIONS")) permissions += "ADD_REACTIONS, "; + if(role.permissions.has("VIEW_AUDIT_LOG")) permissions += "VIEW_AUDIT_LOG, "; + if(role.permissions.has("PRIORITY_SPEAKER")) permissions += "PRIORITY_SPEAKER, "; + if(role.permissions.has("STREAM")) permissions += "STREAM, "; + if(role.permissions.has("VIEW_CHANNEL")) permissions += "VIEW_CHANNEL, "; + if(role.permissions.has("SEND_MESSAGES")) permissions += "SEND_MESSAGES, "; + if(role.permissions.has("SEND_TTS_MESSAGES")) permissions += "SEND_TTS_MESSAGES, "; + if(role.permissions.has("MANAGE_MESSAGES")) permissions += "MANAGE_MESSAGES, "; + if(role.permissions.has("EMBED_LINKS")) permissions += "EMBED_LINKS, "; + if(role.permissions.has("ATTACH_FILES")) permissions += "ATTACH_FILES, "; + if(role.permissions.has("READ_MESSAGE_HISTORY")) permissions += "READ_MESSAGE_HISTORY, "; + if(role.permissions.has("MENTION_EVERYONE")) permissions += "MENTION_EVERYONE, "; + if(role.permissions.has("USE_EXTERNAL_EMOJIS")) permissions += "USE_EXTERNAL_EMOJIS, "; + if(role.permissions.has("CONNECT")) permissions += "CONNECT, "; + if(role.permissions.has("SPEAK")) permissions += "SPEAK, "; + if(role.permissions.has("MUTE_MEMBERS")) permissions += "MUTE_MEMBERS, "; + if(role.permissions.has("DEAFEN_MEMBERS")) permissions += "DEAFEN_MEMBERS, "; + if(role.permissions.has("MOVE_MEMBERS")) permissions += "MOVE_MEMBERS, "; + if(role.permissions.has("USE_VAD")) permissions += "USE_VAD, "; + if(role.permissions.has("CHANGE_NICKNAME")) permissions += "CHANGE_NICKNAME, "; + if(role.permissions.has("MANAGE_NICKNAMES")) permissions += "MANAGE_NICKNAMES, "; + if(role.permissions.has("MANAGE_ROLES")) permissions += "MANAGE_ROLES, "; + if(role.permissions.has("MANAGE_WEBHOOKS")) permissions += "MANAGE_WEBHOOKS, "; + if(role.permissions.has("MANAGE_EMOJIS")) permissions += "MANAGE_EMOJIS, "; + permissions = permissions.slice(0, -2); + permissions += "```"; var embed = new Discord.MessageEmbed(); - embed.setColor(role.color) + embed.setColor(role.color); + embed.setTitle(role.name); + embed.setThumbnail("https://api.alexflipnote.xyz/colour/image/" + role.hexColor.replace("#", "")); 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}` + `• **ID:** ${role.id}\n• **Hex:** ${role.hexColor}\n• **Members:** ${role.members.size}\n• **Position:** ${role.position}\n• **Hoisted:** ${role.hoist}` ); + embed.addField(`**Permissions:**`, permissions) message.channel.send(embed) }; diff --git a/src/commands/ship.js b/src/commands/ship.js index 8d8fef3..7a68e00 100644 --- a/src/commands/ship.js +++ b/src/commands/ship.js @@ -1,5 +1,7 @@ exports.run = async (client, message, args) => { + var name, name1; + var rating = Math.floor(Math.random() * 100) + 1; var hearts = [ "❤️", "🧡", @@ -9,53 +11,34 @@ exports.run = async (client, message, args) => { "💜" ]; - if(!args[0] || !args[1]) { - return message.channel.send(`<:error:466995152976871434> Please include at least two names.`) + if(args.length < 2) { + return message.channel.send(`<:error:466995152976871434> Please include two names/users.`) } - let names = []; - let totalLength = 0; - - for(let i = 0; i < args.length; i++) { - let arg = args[i]; - let name = client.getUserFromMention(arg).username; - if(!name) { - name = arg; - }; - names.push(name); - totalLength += arg.length; - } - - let lengthPerName = Math.floor(totalLength / names.length); - - let finalName = ''; - - let last = -1; - - for(let i = 0; i < names.length; i++) { - let name = names[i]; - let l = Math.min(lengthPerName, name.length); - - let p = name.substr(last + 1, last + l); - - console.log(p); - - finalName = finalName + p; - - last = last + l; + if(message.guild && message.mentions.members && message.mentions.members.size > 0) { + name = message.mentions.members.first().displayName; }; - console.log(totalLength); - console.log(names.length); - console.log(lengthPerName); - console.log(finalName); + if(message.guild && message.mentions.members && message.mentions.members.size > 1) { + name1 = message.mentions.members.last().displayName; + }; - message.channel.send(`**Ship generator:**\n${hearts.random()} Ship name: \`${finalName}\`\n${hearts.random()} Compatibility rating:`) + if(!name) { + name = args[0]; + }; + + if(!name1) { + name1 = args[1]; + }; + + shipName = name.substring(0, client.intBetween(1,name.length))+name1.substring(client.intBetween(0,name1.length)); + + message.channel.send(`__**Ship Generator:**__\n${hearts.random()} Ship Name: \`${shipName}\`\n${hearts.random()} Compatibility rating: \`${rating}%\``) }; exports.conf = { enabled: true, - guildOnly: true, + guildOnly: false, aliases: [], permLevel: "User", requiredPerms: [] diff --git a/src/events/message.js b/src/events/message.js index 457706b..0dfc019 100644 --- a/src/events/message.js +++ b/src/events/message.js @@ -158,7 +158,7 @@ module.exports = async (client, message) => { .then(m => m.delete(2000)); }; - if (!perms.has('SEND_MESSAGES')) { + if (message.guild && !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!`); }; diff --git a/src/modules/functions.js b/src/modules/functions.js index bd30579..f51a34d 100644 --- a/src/modules/functions.js +++ b/src/modules/functions.js @@ -340,6 +340,12 @@ module.exports = client => { }; }; + // FIND RANDOM INT BETWEEN TWO INTEGERS + client.intBetween = function(min, max){ + return Math.round((Math.random() * (max - min))+min); + }; + + // .toPropercase() returns a proper-cased string Object.defineProperty(String.prototype, "toProperCase", { value: function() {