diff --git a/.vscode/Snippets.code-snippets b/.vscode/Snippets.code-snippets index 200c573..3d8fb46 100755 --- a/.vscode/Snippets.code-snippets +++ b/.vscode/Snippets.code-snippets @@ -29,13 +29,14 @@ "module: '$5',", "cooldown: $6,", "guildOnly: $7,", - "developerOnly: $8", + "developerOnly: $8,", + "nsfw: $9", "});", "}", "\n", "async command(ctx) {", - "$9", - "}", + "$10", + "}", "}"] } } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 942c739..c96b22b 100755 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,5 @@ { - "editor.lineNumbers": "off" + "editor.lineNumbers": "on", + "editor.defaultFormatter": "remimarsal.prettier-now", + "editor.formatOnSave": true } \ No newline at end of file diff --git a/Dashboard/assets/css/main.css b/Dashboard/assets/css/main.css new file mode 100644 index 0000000..e950196 --- /dev/null +++ b/Dashboard/assets/css/main.css @@ -0,0 +1,121 @@ +@import url("https://fonts.googleapis.com/css?family=Montserrat&display=swap"); +.center { + position: absolute; + top: 40%; + left: 50%; + -webkit-transform: translate(-50%, -50%); + transform: translate(-50%, -50%); +} + +body { + font-family: 'Montserrat', sans-serif; + background: #131313; + color: white; +} + +ul { + list-style: none; +} + +a { + text-decoration: none; +} + +.title { + font-size: 6vh; +} + +.subtitle { + font-size: 5vh; + padding: 1vh; +} + +.Stats { + font-size: 3vh; + white-space: nowrap; +} + +.rainbow { + text-align: center; + text-decoration: underline; + font-size: 32px; + font-family: monospace; + letter-spacing: 5px; +} + +.rainbow_text_animated { + background: -webkit-gradient(linear, left top, right top, from(#6666ff), color-stop(#0099ff), color-stop(#00ff00), color-stop(#ff3399), to(#6666ff)); + background: linear-gradient(to right, #6666ff, #0099ff, #00ff00, #ff3399, #6666ff); + -webkit-background-clip: text; + background-clip: text; + color: transparent; + -webkit-animation: rainbow_animation 6s ease-in-out infinite; + animation: rainbow_animation 6s ease-in-out infinite; + background-size: 400% 100%; +} + +@-webkit-keyframes rainbow_animation { + 0%, + 100% { + background-position: 0 0; + } + 50% { + background-position: 100% 0; + } +} + +@keyframes rainbow_animation { + 0%, + 100% { + background-position: 0 0; + } + 50% { + background-position: 100% 0; + } +} + +.source, +.invite, +.support { + font-family: 'Montserrat', sans-serif; + background-color: #ffffff; + /* Green */ + border: none; + /* border-radius: 1vh; */ + padding: 1vh; + margin: 1vh; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 2vh; + font-weight: bold; + text-transform: uppercase; +} + +.source a, +.invite a, +.support a { + color: black; +} + +.icon { + display: inline-block; + vertical-align: left; + width: auto; + height: 10vh; + border-radius: 50%; +} + +::-webkit-scrollbar { + display: none; +} + +divide { + display: block; + height: 1px; + border: 0; + border-top: 0px solid rgba(204, 204, 204, 0); + margin: 1em 0; + padding: 1em; +} +/*# sourceMappingURL=main.css.map */ \ No newline at end of file diff --git a/Dashboard/assets/css/main.css.map b/Dashboard/assets/css/main.css.map new file mode 100644 index 0000000..ab03b30 --- /dev/null +++ b/Dashboard/assets/css/main.css.map @@ -0,0 +1,9 @@ +{ + "version": 3, + "mappings": "AAkCA,OAAO,CAAC,sEAAI;AACZ,AAAA,OAAO,CAAC;EAlCP,QAAQ,EAAE,QAAQ;EAGjB,GAAG,EAAE,GAAG;EACR,IAAI,EAAE,GAAG;EACT,SAAS,EAAE,qBAAqB;CA+BjC;;AACD,AAAA,IAAI,CAAC;EACJ,WAAW,EAAE,wBAAwB;EACrC,UAAU,EAAE,OAAO;EACnB,KAAK,EAAE,KAAK;CACZ;;AACD,AAAA,EAAE,CAAC;EACF,UAAU,EAAE,IAAI;CAChB;;AACD,AAAA,CAAC,CAAC;EACD,eAAe,EAAE,IAAI;CACrB;;AAED,AAAA,MAAM,CAAC;EACN,SAAS,EAAE,GAAG;CACd;;AAED,AAAA,SAAS,CAAC;EACT,SAAS,EAAE,GAAG;EACd,OAAO,EAAE,GAAG;CACZ;;AAED,AAAA,MAAM,CAAC;EACN,SAAS,EAAE,GAAG;EACd,WAAW,EAAE,MAAM;CACnB;;AAED,AAAA,QAAQ,CAAC;EACR,UAAU,EAAE,MAAM;EAClB,eAAe,EAAE,SAAS;EAC1B,SAAS,EAAE,IAAI;EACf,WAAW,EAAE,SAAS;EACtB,cAAc,EAAE,GAAG;CACnB;;AACD,AAAA,sBAAsB,CAAC;EACtB,UAAU,EAAE,sEAAsE;EAClF,uBAAuB,EAAE,IAAI;EAC7B,eAAe,EAAE,IAAI;EACrB,KAAK,EAAE,WAAW;EAClB,SAAS,EAAE,yCAAyC;EACpD,eAAe,EAAE,SAAS;CAC1B;;AAED,UAAU,CAAV,iBAAU;EACT,EAAE;EACF,IAAI;IACH,mBAAmB,EAAE,GAAG;;EAGzB,GAAG;IACF,mBAAmB,EAAE,MAAM;;;;AAI7B,AAAA,OAAO;AACP,OAAO;AACP,QAAQ,CAAC;EA5ER,WAAW,EAAE,wBAAwB;EACrC,gBAAgB,EAAE,OAAO;EAAE,WAAW;EACtC,MAAM,EAAE,IAAI;EACZ,yBAAyB;EACzB,OAAO,EAAE,GAAG;EACZ,MAAM,EAAE,GAAG;EACX,UAAU,EAAE,MAAM;EAClB,eAAe,EAAE,IAAI;EACrB,OAAO,EAAE,YAAY;EACrB,SAAS,EAAE,GAAG;EACd,WAAW,EAAE,IAAI;EACjB,cAAc,EAAE,SAAS;CAmEzB;;AAJD,AA9DC,OA8DM,CA9DN,CAAC;AA+DF,OAAO,CA/DN,CAAC;AAgEF,QAAQ,CAhEP,CAAC,CAAC;EACD,KAAK,EAAE,KAAY;CACnB;;AAiEF,AAAA,KAAK,CAAC;EACL,OAAO,EAAE,YAAY;EACrB,cAAc,EAAE,IAAI;EACpB,KAAK,EAAE,IAAI;EACX,MAAM,EAAE,IAAI;EACZ,aAAa,EAAE,GAAG;CAClB;;AAED,AAAA,mBAAmB,CAAC;EACnB,OAAO,EAAE,IAAI;CACb;;AAED,AAAA,MAAM,CAAC;EACN,OAAO,EAAE,KAAK;EACd,MAAM,EAAE,GAAG;EACX,MAAM,EAAE,CAAC;EACT,UAAU,EAAE,GAAG,CAAC,KAAK,CAAC,sBAAsB;EAC5C,MAAM,EAAE,KAAK;EACb,OAAO,EAAE,GAAG;CACZ", + "sources": [ + "main.scss" + ], + "names": [], + "file": "main.css" +} \ No newline at end of file diff --git a/Dashboard/assets/css/main.scss b/Dashboard/assets/css/main.scss new file mode 100644 index 0000000..2bc644b --- /dev/null +++ b/Dashboard/assets/css/main.scss @@ -0,0 +1,116 @@ +@mixin centerer($horizontal: true, $vertical: true) { + position: absolute; + + @if ($horizontal and $vertical) { + top: 40%; + left: 50%; + transform: translate(-50%, -50%); + } @else if ($horizontal) { + left: 50%; + transform: translate(-50%, 0); + } @else if ($vertical) { + top: 50%; + transform: translate(0, -50%); + } +} + +@mixin Buttons { + font-family: 'Montserrat', sans-serif; + background-color: #ffffff; /* Green */ + border: none; + /* border-radius: 1vh; */ + padding: 1vh; + margin: 1vh; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 2vh; + font-weight: bold; + text-transform: uppercase; + a { + color: rgb(0, 0, 0); + } +} + +@import url('https://fonts.googleapis.com/css?family=Montserrat&display=swap'); +.center { + @include centerer; +} +body { + font-family: 'Montserrat', sans-serif; + background: #131313; + color: white; +} +ul { + list-style: none; +} +a { + text-decoration: none; +} + +.title { + font-size: 6vh; +} + +.subtitle { + font-size: 5vh; + padding: 1vh; +} + +.Stats { + font-size: 3vh; + white-space: nowrap; +} + +.rainbow { + text-align: center; + text-decoration: underline; + font-size: 32px; + font-family: monospace; + letter-spacing: 5px; +} +.rainbow_text_animated { + background: linear-gradient(to right, #6666ff, #0099ff, #00ff00, #ff3399, #6666ff); + -webkit-background-clip: text; + background-clip: text; + color: transparent; + animation: rainbow_animation 6s ease-in-out infinite; + background-size: 400% 100%; +} + +@keyframes rainbow_animation { + 0%, + 100% { + background-position: 0 0; + } + + 50% { + background-position: 100% 0; + } +} + +.source, +.invite, +.support { + @include Buttons(); +} +.icon { + display: inline-block; + vertical-align: left; + width: auto; + height: 10vh; + border-radius: 50%; +} + +::-webkit-scrollbar { + display: none; +} + +divide { + display: block; + height: 1px; + border: 0; + border-top: 0px solid rgba(204, 204, 204, 0); + margin: 1em 0; + padding: 1em; +} diff --git a/Dashboard/assets/images/icon.png b/Dashboard/assets/images/icon.png new file mode 100644 index 0000000..0a9f0c6 Binary files /dev/null and b/Dashboard/assets/images/icon.png differ diff --git a/Dashboard/server.js b/Dashboard/server.js new file mode 100755 index 0000000..3f9d6b1 --- /dev/null +++ b/Dashboard/server.js @@ -0,0 +1,97 @@ +const express = require('express'); +const { hostname, port, authorization, source, invite, type } = require('../config'); +const db = require('quick.db'); +const Backend = new db.table('backend'); +const chalk = require('chalk'); +const helmet = require('helmet'); +const compression = require('compression'); +const cors = require('cors'); +const morgan = require('morgan'); +var hbs = require('express-handlebars'); + +const app = express(); + +app.set('view engine', 'hbs'); +app.engine( + 'hbs', + hbs({ + extname: 'hbs', + defaultView: 'default' + }) +); +app.set('json spaces', 4); +app.use('/assets', express.static(__dirname + '/assets')); +app.set('view options', { + layout: false +}); + +app.use(express.json()); +app.use(express.urlencoded({ extended: true })); +app.use(helmet()); +app.use(compression()); +app.use(cors()); +// Logging +app.use( + morgan((tokens, req, res) => { + return [ + chalk.hex('#34ace0').bold(tokens.method(req, res)), + chalk.hex('#ffb142').bold(tokens.status(req, res)), + chalk.hex('#ff5252').bold(req.hostname + tokens.url(req, res)), + chalk.hex('#2ed573').bold(tokens['response-time'](req, res) + 'ms'), + chalk.hex('#f78fb3').bold('@ ' + tokens.date(req, res)) + ].join(' '); + }) +); +let support = 'https://discord.gg/' + Backend.get('Info.invite'); +module.exports = (client) => { + app.get('/', async (req, res) => { + res.status(200).render('index', { + layout: 'main', + title: 'Thaldrin', + subtitle: 'A Random Image and Utility Bot', + bot: { + users: client.users.size, + guilds: client.guilds.size, + channels: client.channels.size, + commands: client.commands.size, + invite: `https://${req.hostname}${type.beta ? ':8080' : ''}/invite`, + source: `https://${req.hostname}${type.beta ? ':8080' : ''}/source`, + support: `https://${req.hostname}${type.beta ? ':8080' : ''}/discord` + } + }); + }); + + app.get('/discord', async (req, res) => { + res.redirect(support); + }); + app.get('/source', async (req, res) => { + res.redirect(source); + }); + app.get('/invite', async (req, res) => { + res.redirect(invite); + }); + /* app.get('/this', async (req, res) => { + res.json(client); + }); */ + + /* app.post('/vote', async (req, res) => { + const body = req.body; + const auth = req.header('Authorization'); + + if (auth != authorization) return res.status(403), console.warn(`Vote rejected with authorization '${auth}'`); + // if (body.bot != client.user.id) return res.status(403), console.warn(`Vote rejected with ID '${body.bot}'`); + + if (body.type == 'test') { + console.log(`Test succeeded, is weekend:`, body.isWeekend); + } else { + console.log(`Vote`) + client.vote(body.user); + } + }); */ + + app.listen(port, hostname, () => { + setTimeout(() => { + console.log(`Listening on ${hostname}:${port}`); + }, 1000 * 3); + }); +}; diff --git a/DiscordEvents/message.js b/DiscordEvents/message.js index 47d8c99..67a1b28 100755 --- a/DiscordEvents/message.js +++ b/DiscordEvents/message.js @@ -1,92 +1,83 @@ -const { Collection } = require("discord.js"); -const { ShortLinks, SourceFynnder } = require("../utils"); -let ShortLinksEnabled = true; -let SourceFynnderEnabled = true; -const { table } = require("quick.db"); -const Servers = new table("servers"); -const Users = new table("users"); -const Backend = new table("backend"); +const { Collection } = require('discord.js'); +const { table } = require('quick.db'); +const Servers = new table('servers'); +const Users = new table('users'); +const Backend = new table('backend'); module.exports = { - name: "message", - run: async (client, msg) => { - const prefix = client.config.prefixes.find(p => - msg.content.toLowerCase().startsWith(p) - ); + name: 'message', + run: async (client, msg) => { + //if (msg.author.id !== '318044130796109825') return; + if (msg.author.bot) return; + const DefaultPrefix = client.config.prefixes; + const CustomPrefix = Servers.get(msg.guild.id); + if (!CustomPrefix) { + PrefixArray = [ DefaultPrefix /* , CustomPrefix */ ].flat(Infinity); + } else { + PrefixArray = [ DefaultPrefix, CustomPrefix.prefix ].flat(Infinity); + } + let PREFIX; + let EXISTS; + for (p in PrefixArray) { + if (msg.content.startsWith(PrefixArray[p])) { + EXISTS = true; + PREFIX = p; + } + } + if (!EXISTS) return; + const args = msg.content.slice(PrefixArray[PREFIX].length).trim().split(/ +/g); + const command = args.shift().toLowerCase(); + const cmd = client.commands.find((c) => c.name == command || (c.aliases && c.aliases.includes(command))); - if (msg.author.bot) return; - if (msg.author.id !== "318044130796109825") return; - let Server = Servers.get(msg.guild.id); - let enabled; - if (Server === null) { - enabled = require("../utils").db.defaults.server; - } else { - enabled = Server; - } + const ctx = { + send: msg.channel.send.bind(msg.channel), + client, + msg, + args, + command: cmd, + me: msg.guild.me, + guild: msg.guild, + channel: msg.channel, + author: msg.author, + member: msg.member, + db: { users: Users, servers: Servers, backend: Backend }, + utils: require('../utils'), + config: require('../config'), + isDeveloper: client.config.developers.find((dev) => msg.author.id == dev.id) + }; + if (!cmd) return; - ShortLinks(enabled.Shortlinks, msg); - if (!prefix) return; - const args = msg.content.slice(prefix.length).split(/ +/g); - const command = args.shift().toLowerCase(); - const cmd = client.commands.find( - c => c.name == command || (c.aliases && c.aliases.includes(command)) - ); + if (!client.cooldowns.has(cmd.name)) { + client.cooldowns.set(cmd.name, new Collection()); + } - const ctx = { - send: msg.channel.send.bind(msg.channel), - client, - msg, - args, - command: cmd, - me: msg.guild.me, - guild: msg.guild, - channel: msg.channel, - author: msg.author, - member: msg.member, - db: { users: Users, servers: Servers, backend: Backend }, - utils: require("../utils"), - isDeveloper: client.config.developers.find(id => msg.author.id == id) - }; - if (!cmd) return; + if (cmd.guildOnly && !msg.guild) return; + if (cmd.nsfw && !ctx.channel.nsfw) + return ctx.send('This channel is not marked as NSFW, please mark it as such and rerun this command.'); + if (cmd.developerOnly && !client.config.developers.find((dev) => msg.author.id == dev.id)) return; + if (cmd.AuthorPermissions !== 'NONE' && !ctx.member.permissions.has(cmd.AuthorPermissions)) + return ctx.send(`You need \`${cmd.AuthorPermissions}\` Permission(s) to run this Command`); + const now = Date.now(); + const timestamps = client.cooldowns.get(cmd.name); + const cooldownAmount = (cmd.cooldown || 1) * 1000; - if (!client.cooldowns.has(cmd.name)) { - client.cooldowns.set(cmd.name, new Collection()); - } + if (timestamps.has(msg.author.id)) { + const expirationTime = timestamps.get(msg.author.id) + cooldownAmount; - if (cmd.guildOnly && !msg.guild) return; - if ( - cmd.developerOnly && - !client.config.developers.find(devs => msg.author.id == devs.id) - ) - return; + if (now < expirationTime) { + const timeLeft = (expirationTime - now) / 1000; + return ctx.send( + `\`${cmd.name}\` has a cooldown of \`${cmd.cooldown} second${cmd.cooldown > 1 + ? 's' + : ''}\`, wait \`${`${Math.round(timeLeft)} second${Math.round(timeLeft) > 1 + ? 's' + : ''}`.replace('0 second', 'just a second longer')}\` before trying to use it again.` + ); + } + } else { + timestamps.set(msg.author.id, now); + setTimeout(() => timestamps.delete(msg.author.id), cooldownAmount); - const now = Date.now(); - const timestamps = client.cooldowns.get(cmd.name); - const cooldownAmount = (cmd.cooldown || 1) * 1000; - - if (timestamps.has(msg.author.id)) { - const expirationTime = timestamps.get(msg.author.id) + cooldownAmount; - - if (now < expirationTime) { - const timeLeft = (expirationTime - now) / 1000; - return ctx.send( - `\`${cmd.name}\` has a cooldown of \`${cmd.cooldown} second${ - cmd.cooldown > 1 ? "s" : "" - }\`, wait \`${`${Math.round(timeLeft)} second${ - Math.round(timeLeft) > 1 ? "s" : "" - }`.replace( - "0 second", - "just a second longer" - )}\` before trying to use it again.` - ); - } - } else { - timestamps.set(msg.author.id, now); - setTimeout(() => timestamps.delete(msg.author.id), cooldownAmount); - - cmd - .command(ctx) - .then(() => {}) - .catch(console.error); - } - } + cmd.command(ctx).then(() => {}).catch(console.error); + } + } }; diff --git a/DiscordEvents/messageReactionAdd.js b/DiscordEvents/messageReactionAdd.js index 171ac1a..e9d2e26 100755 --- a/DiscordEvents/messageReactionAdd.js +++ b/DiscordEvents/messageReactionAdd.js @@ -1,36 +1,39 @@ const p = require('phin').defaults({ - method: 'POST', - parse: 'json' + method: 'POST', + parse: 'json' }); - +const hastebin = require('hastebin-gen'); module.exports = { - name: 'messageReactionAdd', - run: async (client, reaction, user) => { - if (user.bot) return; - - if (!client.config.developers.find(id => id == user.id)) return; + name: 'messageReactionAdd', + run: async (client, reaction, user) => { + if (user.bot) return; + if (user.id !== '318044130796109825') return; + if (reaction.emoji.name == '📥') { + let haste; + try { + if (!client.lastEval) { + await reaction.message.edit(`\`Unable to upload uncached eval results\``); + await reaction.message.reactions.removeAll(); + } else { + hastebin(`${client.lastEval || `Last eval resuts weren't cached`}`, { extension: 'js' }) + .then(async (h) => { + await reaction.message.edit(`<${h}>`); + await reaction.message.reactions.removeAll(); + }) + .catch((error) => { + // Handle error + console.error(error); + }); + } + } catch (err) { + console.error(err); + } + } - if (reaction.emoji.name == '📥') { - try { - if (!client.cache.lastEval) { - await reaction.message.edit(`\`Unable to upload uncached eval results\``); - await reaction.message.reactions.removeAll(); - } else { - const { body } = await p({ - url: `https://hasteb.in/documents`, - data: `${client.cache.lastEval || `Last eval resuts weren't cached`}` - }); - - await reaction.message.edit(``); - await reaction.message.reactions.removeAll(); - } - } catch(err) {} - } - - if (reaction.emoji.name == '🗑') { - try { - await reaction.message.delete(); - } catch(err) {} - } - } -} \ No newline at end of file + if (reaction.emoji.name == '🗑') { + try { + await reaction.message.delete(); + } catch (err) {} + } + } +}; diff --git a/DiscordEvents/ready.js b/DiscordEvents/ready.js index 05b8afe..925610b 100755 --- a/DiscordEvents/ready.js +++ b/DiscordEvents/ready.js @@ -1,9 +1,9 @@ -const { log } = require("../utils/index"); +const { log } = require('../utils/index'); module.exports = { - name: "ready", - run: async client => { - log.hasStarted(); - client.user.setActivity(`@${client.user.username} help to get started`); - } + name: 'ready', + run: async (client) => { + log.hasStarted(); + client.user.setActivity(`nyeh`, { type: 2 }); + } }; diff --git a/DiscordModules/Developers/eval.js b/DiscordModules/Developers/eval.js index 4f2dc53..a1223e4 100755 --- a/DiscordModules/Developers/eval.js +++ b/DiscordModules/Developers/eval.js @@ -1,90 +1,80 @@ -const Command = require("../../src/structures/Command"); -const { table } = require("quick.db"); -const Servers = new table("servers"); -const Users = new table("users"); +const Command = require('../../src/structures/Command'); +const { table } = require('quick.db'); +const Servers = new table('servers'); +const Users = new table('users'); +const Bot = new table('bot'); -const clean = text => { - if (typeof text == "string") - return text - .replace(/`/g, "`" + String.fromCharCode(8203)) - .replace(/@/g, "@" + String.fromCharCode(8203)); - else return text; +const clean = (text) => { + if (typeof text == 'string') + return text.replace(/`/g, '`' + String.fromCharCode(8203)).replace(/@/g, '@' + String.fromCharCode(8203)); + else return text; }; module.exports = class Eval extends Command { - constructor() { - super({ - name: "eval", - description: "Run JavaScript code directly from the process.", - aliases: ["ev", "e"], - module: "Developers", - cooldown: 0, - guildOnly: false, - developerOnly: true - }); - } + constructor() { + super({ + name: 'eval', + description: 'Run JavaScript code directly from the process.', + aliases: [ 'ev', 'e' ], + module: 'Developers', + cooldown: 0, + guildOnly: false, + developerOnly: true + }); + } - async command(ctx) { - if (!ctx.args.length) return; + async command(ctx) { + if (!ctx.args.length) return; - const client = ctx.client; + const client = ctx.client; - let code = ctx.args.join(" "); - let silent = false; + let code = ctx.args.join(' '); + let silent = false; - if (code.endsWith("-s")) (code = code.split("-s")[0]), (silent = true); - if (code.endsWith("--silent")) - (code = code.split("--silent")[0]), (silent = true); + if (code.endsWith('-s')) (code = code.split('-s')[0]), (silent = true); + if (code.endsWith('--silent')) (code = code.split('--silent')[0]), (silent = true); - try { - let evaled = await eval(code); + try { + let evaled = await eval(code); - if (typeof evaled != "string") evaled = require("util").inspect(evaled); + if (typeof evaled != 'string') + evaled = require('util').inspect(evaled, false, await ctx.db.backend.get('eval')); - evaled.replace( - new RegExp(client.token.replace(/\./g, "\\.", "g")), - "uwu" - ); + evaled.replace(new RegExp(client.token.replace(/\./g, '\\.', 'g')), 'uwu'); - if (!silent) { - ctx - .send(`\`\`\`js\n${clean(evaled)}\n\`\`\``) - .then(async m => { - await m.react("📥"); - await m.react("🗑"); - }) - .catch(err => { - ctx - .send( - `\`Content is over 2,000 characters: react to upload to Hastebin\`` - ) - .then(async m => { - client.lastEval = clean(evaled); + if (!silent) { + ctx + .send(`\`\`\`js\n${clean(evaled)}\n\`\`\``) + .then(async (m) => { + await m.react('📥'); + await m.react('🗑'); + }) + .catch((err) => { + ctx + .send(`\`Content is over 2,000 characters: react to upload to Hastebin\``) + .then(async (m) => { + client.lastEval = clean(evaled); - await m.react("📥"); - await m.react("🗑"); - }); - }); - } - } catch (error) { - ctx - .send(`\`\`\`js\n${clean(error)}\n\`\`\``) - .then(async m => { - await m.react("📥"); - await m.react("🗑"); - }) - .catch(err => { - ctx - .send( - `\`Content is over 2,000 characters: react to upload to Hastebin\`` - ) - .then(async m => { - client.lastEval = clean(error); + await m.react('📥'); + await m.react('🗑'); + }); + }); + } + } catch (error) { + ctx + .send(`\`\`\`js\n${clean(error)}\n\`\`\``) + .then(async (m) => { + await m.react('📥'); + await m.react('🗑'); + }) + .catch((err) => { + ctx.send(`\`Content is over 2,000 characters: react to upload to Hastebin\``).then(async (m) => { + client.lastEval = clean(error); - await m.react("📥"); - await m.react("🗑"); - }); - }); - } - } + await m.react('📥'); + await m.react('🗑'); + }); + }); + } + } }; diff --git a/DiscordModules/Developers/reload.js b/DiscordModules/Developers/reload.js index 7d4d6da..b293e72 100755 --- a/DiscordModules/Developers/reload.js +++ b/DiscordModules/Developers/reload.js @@ -1,39 +1,38 @@ const Command = require('../../src/structures/Command'); module.exports = class Reload extends Command { - constructor() { - super({ - name: 'reload', - description: 'Reload a command without restarting the process.', - aliases: ['re'], - module: 'Developers', - cooldown: 0, - guildOnly: false, - developerOnly: true - }); - } + constructor() { + super({ + name: 'reload', + description: 'Reload a command without restarting the process.', + aliases: [ 're' ], + module: 'Developers', + cooldown: 0, + guildOnly: false, + developerOnly: true + }); + } - async command(ctx) { - if (!ctx.args.length) return; - const date = Date.now(); + async command(ctx) { + if (!ctx.args.length) return; + const date = Date.now(); - const data = ctx.args[0]; - const [module,command] = data.split('/'); + const data = ctx.args[0]; + const [ module, command ] = data.split('/'); - if (!module || !command) return; + if (!module || !command) return; - try { - delete require.cache[require.resolve(`../${module}/${command}`)]; - delete ctx.client.commands.get(command); + try { + delete require.cache[require.resolve(`../${module}/${command}`)]; + delete ctx.client.commands.get(command); - const cmd = require(`../${module}/${command}`); - const Command = new cmd(); - ctx.client.commands.set(Command.name, Command); + const cmd = require(`../${module}/${command}`); + const Command = new cmd(); + ctx.client.commands.set(Command.name, Command); - console.log(`Reloaded \`${Command.name}\` in ${(Date.now() - date) / 1000}s.`) - return ctx.send(`Reloaded \`${Command.name}\` in ${(Date.now() - date) / 1000}s.`); - } catch(err) { - return ctx.send(`Failed to reload the command.\n\`${err}\``); - } - } -} \ No newline at end of file + return ctx.send(`Reloaded \`${Command.name}\` in ${(Date.now() - date) / 1000}s.`); + } catch (err) { + return ctx.send(`Failed to reload the command.\n\`${err}\``); + } + } +}; diff --git a/DiscordModules/Developers/setup.js b/DiscordModules/Developers/setup.js deleted file mode 100755 index 901055a..0000000 --- a/DiscordModules/Developers/setup.js +++ /dev/null @@ -1,21 +0,0 @@ -const Command = require("../../src/structures/Command"); -module.exports = class Setup extends Command { - constructor() { - super({ - name: "setup", - description: "x", - aliases: ["s"], - module: "Developers", - cooldown: 0, - guildOnly: false, - developerOnly: true - }); - } - - async command(ctx) { - let x = await ctx.utils.db.prefix - .remove(ctx) - .catch(err => console.error(err)); - //' console.log(x); - } -}; diff --git a/DiscordModules/Developers/stop.js b/DiscordModules/Developers/stop.js index 0393e9c..9ef0893 100755 --- a/DiscordModules/Developers/stop.js +++ b/DiscordModules/Developers/stop.js @@ -1,18 +1,19 @@ -const Command = require("../../src/structures/Command"); +const Command = require('../../src/structures/Command'); module.exports = class Stop extends Command { - constructor() { - super({ - name: "stop", - description: "Stops the bot", - aliases: [], - module: "Developers", - cooldown: 0, - guildOnly: false, - developerOnly: true - }); - } + constructor() { + super({ + name: 'stop', + description: 'Stops the bot', + aliases: [], + module: 'Developers', + cooldown: 0, + guildOnly: false, + developerOnly: true + }); + } - async command(ctx) { - process.exit(); - } + async command(ctx) { + await ctx.send('Restarting.'); + process.exit(); + } }; diff --git a/DiscordModules/General/help.js b/DiscordModules/General/help.js index dda3fc0..e9ce4d7 100755 --- a/DiscordModules/General/help.js +++ b/DiscordModules/General/help.js @@ -1,104 +1,126 @@ -const Command = require("../../src/structures/Command"); -const { MessageEmbed } = require("discord.js"); +const Command = require('../../src/structures/Command'); +const { MessageEmbed } = require('discord.js'); module.exports = class Help extends Command { - constructor() { - super({ - name: "help", - description: - "View a list of available commands, or view information on a specific command.", - aliases: ["h"], - module: "General", - cooldown: 0, - guildOnly: false, - developerOnly: false - }); - } + constructor() { + super({ + name: 'help', + description: 'View a list of available commands or information on a specific command.', + aliases: [ 'h' ], + module: 'General', + cooldown: 0, + guildOnly: false, + developerOnly: false + }); + } - async command(ctx) { - if (!ctx.args.length) { - const commands = [ - [ - "General", - ctx.client.commands - .filter(command => command.module == "General") - .map(command => `**${command.name}** - ${command.description}`) - .join("\n") - ] - ]; + async command(ctx) { + if (!ctx.args.length) { + const commands = [ + [ + 'General', + ctx.client.commands + .filter((command) => command.module == 'General') + .map((command) => `${command.name}`) + .join(' | ') + ], + /* [ + 'Images', + ctx.client.commands + .filter((command) => command.module == 'Images') + .map((command) => `${command.name}`) + .join(' | ') + ], */ + [ + 'Images', + ctx.client.commands + .filter((command) => command.module == 'Images') + .map((command) => `${command.name}`) + .join(' | ') + ], + [ + 'Roleplay', + ctx.client.commands + .filter((command) => command.module == 'Roleplay') + .map((command) => `${command.name}`) + .join(' | ') + ], + [ + 'Settings', + ctx.client.commands + .filter((command) => command.module == 'Settings') + .map((command) => `${command.name}`) + .join(' | ') + ] + ]; - if (ctx.isDeveloper) - commands.push([ - "Developers", - ctx.client.commands - .filter(command => command.module == "Developers") - .map(command => command.name) - .join(", ") - ]); + if (ctx.isDeveloper) + commands.push([ + 'Developers', + ctx.client.commands + .filter((command) => command.module == 'Developers') + .map((command) => `${command.name}`) + .join(' | ') + ]); - return ctx.send({ - embed: { - fields: commands.map(group => { - return new Object({ - name: group[0], - value: group[1] - }); - }), - color: 0xff873f - } - }); - } else { - const command = ctx.client.commands.find( - c => - c.name == ctx.args[0].toLowerCase() || - (c.aliases && c.aliases.includes(ctx.args[0].toLowerCase())) - ); + return ctx.send({ + embed: { + description: `Use \`'help command\` to get help on a specific command`, + fields: commands.map((group) => { + return new Object({ + name: group[0], + value: group[1] + }); + }), + color: 0xff873f + } + }); + } else { + const command = ctx.client.commands.find( + (c) => + c.name == ctx.args[0].toLowerCase() || (c.aliases && c.aliases.includes(ctx.args[0].toLowerCase())) + ); - let fields = [ - { - name: "Module", - value: command.module, - inline: true - }, - { - name: "Aliases", - value: - command.aliases.length == 0 - ? "No aliases" - : command.aliases.join(", "), - inline: true - }, - { - name: "Cooldown", - value: command.cooldown == 0 ? "No cooldown" : `${command.cooldown}s`, - inline: true - }, - { - name: "Server only?", - value: command.guildOnly ? "Yes" : "No", - inline: true - }, - { - name: "Developers only?", - value: command.developerOnly ? "Yes" : "No", - inline: true - } - ]; + let fields = [ + { + name: 'Module', + value: command.module, + inline: true + }, + { + name: 'Aliases', + value: command.aliases.length == 0 ? 'No aliases' : command.aliases.join(', '), + inline: true + }, + { + name: 'Cooldown', + value: command.cooldown == 0 ? 'No cooldown' : `${command.cooldown}s`, + inline: true + }, + { + name: 'Server only?', + value: command.guildOnly ? 'Yes' : 'No', + inline: true + }, + { + name: 'Developers only?', + value: command.developerOnly ? 'Yes' : 'No', + inline: true + } + ]; - if (!command) - return ctx.send( - `That command couldn't be found. See the \`help\` command for valid commands.` - ); + if (!command) + return ctx.send(`That command couldn't be found. See the \`help\` command for valid commands.`); - let embed = new MessageEmbed() - .setTitle(command.name) - .setDescription(command.description) - .setColor(0xff873f); - fields.forEach(i => { - embed.addField(i.name, i.value, i.inline); - }); + let embed = new MessageEmbed() + .setTitle(command.name) + .setDescription(command.description) + .setColor(0xff873f); + fields.forEach((i) => { + embed.addField(i.name, i.value, i.inline); + }); - return ctx.send(embed); - } - } + return ctx.send(embed); + } + } }; diff --git a/DiscordModules/General/info.js b/DiscordModules/General/info.js index 8ee33b1..cc4095c 100755 --- a/DiscordModules/General/info.js +++ b/DiscordModules/General/info.js @@ -1,42 +1,53 @@ -const Command = require("../../src/structures/Command"); -const { MessageEmbed } = require("discord.js"); -const { developers, contributors, source } = require("../../config"); -const { version: DiscordVersion } = require("discord.js"); - +const Command = require('../../src/structures/Command'); +const { MessageEmbed, version: DiscordVersion } = require('discord.js'); +const { developers, contributors, source, color } = require('../../config'); +const db = require('quick.db'); +const Backend = new db.table('backend'); module.exports = class Info extends Command { - constructor() { - super({ - name: "info", - description: "Show the Makers and Contributors of the Bot", - aliases: ["about"], - module: "General", - cooldown: 0, - guildOnly: false, - developerOnly: false - }); - } + constructor() { + super({ + name: 'info', + description: 'Show the Makers and Contributors of the Bot', + aliases: [ 'about' ], + module: 'General', + cooldown: 0, + guildOnly: false, + developerOnly: false + }); + } - async command(ctx) { - let result; - const contribs = []; - for (const { id, nick, reason } of contributors) { - const user = await ctx.client.users.fetch(id); - contribs.push(`${user} (${nick}) - ${reason}`); - } - const Contributors = contribs.join("\n"); - let CreditEmbed = new MessageEmbed() - .setTitle(`Thaldrin, a Random Image and Utility Bot`) - .setDescription( - `Made by ${ctx.utils.format.bold( - ctx.client.users.find(user => user.id === "318044130796109825").tag - )}` - ) - .addField("Language", "Javascript", true) - .addField("Library", `d.js - v${DiscordVersion}`, true) - .addField("Node", `${process.version}`, true) - .addField("Contributors", Contributors) - .addField("Source", `[gitdab.com/r/thaldrin](${source})`); + async command(ctx) { + let result; + const contribs = []; + for (const { id, nick, reason } of contributors) { + const user = await ctx.client.users.fetch(id); + contribs.push(`${user} (${nick}) - ${reason}`); + } + const Contributors = contribs.join('\n'); + let CreditEmbed = new MessageEmbed() + .setTitle(`${ctx.client.user.username}, a Random Image and Utility Bot`) + .setColor(color) + .setDescription( + `Made by ${ctx.utils.format.bold( + ctx.client.users.find((user) => user.id === '318044130796109825').tag + )}` + ) + /* .addField('Language', 'Javascript', true) + .addField('Library', `d.js - v${DiscordVersion}`, true) + .addField('Node', `${process.version}`, true) + .addField('Servers', ctx.client.guilds.size, true) + .addField('Users', ctx.client.users.size, true) */ + .addField('Contributors', Contributors) + .addField('Source', `[gd/r/thaldrin](${source})`, true) + .addField( + 'Support Server', + `[${ctx.client.guilds.get('438316852347666432').name}](https://discord.gg/${ctx.db.backend.get( + 'Info.invite' + )})`, + true + ) + .addField('Website', `[thaldr.in](https://thaldr.in)`, true); - ctx.send(CreditEmbed); - } + ctx.send(CreditEmbed); + } }; diff --git a/DiscordModules/General/serverinfo.js b/DiscordModules/General/serverinfo.js new file mode 100644 index 0000000..b720b72 --- /dev/null +++ b/DiscordModules/General/serverinfo.js @@ -0,0 +1,70 @@ +const Command = require('../../src/structures/Command'); + +module.exports = class ServerInfo extends Command { + constructor() { + super({ + name: 'serverinfo', + description: 'Shows Information about your Server!', + aliases: [ 'server', 'sinfo', 'si' ], + module: 'General', + cooldown: 0, + guildOnly: true, + developerOnly: false + }); + } + + async command(ctx) { + const total = ctx.guild.members.size; + const users = ctx.guild.members.filter((m) => !m.user.bot).size; + const bots = ctx.guild.members.filter((m) => m.user.bot).size; + const Features = ctx.guild.features; + let OnlineUsers = + ctx.utils.emotes.MemberStatus['online'] + + ctx.guild.members.filter((m) => m.presence.status === 'online').size; + let DNDUsers = + ctx.utils.emotes.MemberStatus['dnd'] + ctx.guild.members.filter((m) => m.presence.status === 'dnd').size; + let IdleUsers = + ctx.utils.emotes.MemberStatus['idle'] + ctx.guild.members.filter((m) => m.presence.status === 'idle').size; + let OfflineUsers = + ctx.utils.emotes.MemberStatus['offline'] + + ctx.guild.members.filter((m) => m.presence.status === 'offline').size; + + let features = []; + Features.forEach((f) => features.push(ctx.utils.emotes.features[f.toLowerCase()] || f)); + + let Embed = new ctx.utils.discord.MessageEmbed(); + Embed.setTitle(ctx.guild.name) + .setColor(ctx.config.color) + .setThumbnail(ctx.guild.iconURL()) + .addField( + 'Members', + `${ctx.utils.format.bold(`Total:`)} ${ctx.utils.format.code(total)}\n${ctx.utils.format.bold( + `Users:` + )} ${ctx.utils.format.code(users)}\n${ctx.utils.format.bold(`Bots:`)} ${ctx.utils.format.code(bots)} + + ${OnlineUsers} + ${DNDUsers} + ${IdleUsers} + ${OfflineUsers}` + ) + .addField('Owner', ctx.guild.owner, true) + .addField('Large?', ctx.guild.large ? ctx.utils.emotes.settings.on : ctx.utils.emotes.settings.off, true) + .addField( + 'Boost Level / Boosters', + `${ctx.guild.premiumTier} / ${ctx.guild.premiumSubscriptionCount}`, + true + ) + .addField('Region', ctx.utils.emotes.regions[ctx.guild.region] || ctx.guild.region, true) + .addField('Features', features.join(' **|** ')); + if (ctx.guild.vanityURLCode) { + Embed.addField( + 'Vanity URL', + `[discord.gg/${ctx.guild.vanityURLCode}](https://discord.gg/${ctx.guild.vanityURLCode})` + ); + } + /* .addField('Large?') + .addField('Large?'); */ + + ctx.send(Embed); + } +}; diff --git a/DiscordModules/General/system.js b/DiscordModules/General/system.js new file mode 100644 index 0000000..07b0c5d --- /dev/null +++ b/DiscordModules/General/system.js @@ -0,0 +1,50 @@ +const Command = require('../../src/structures/Command'); +const { MessageEmbed, version: DiscordVersion } = require('discord.js'); +const os = require('os'); +const { developers, contributors, source, color } = require('../../config'); +const db = require('quick.db'); +const Backend = new db.table('backend'); +function format(seconds) { + function pad(s) { + return (s < 10 ? '0' : '') + s; + } + var hours = Math.floor(seconds / (60 * 60)); + var minutes = Math.floor((seconds % (60 * 60)) / 60); + var seconds = Math.floor(seconds % 60); + + return pad(hours) + 'h ' + pad(minutes) + 'm ' + pad(seconds) + 's'; +} + +module.exports = class Info extends Command { + constructor() { + super({ + name: 'system', + description: 'Show System Info', + aliases: [ 'sys', 'sysinfo' ], + module: 'General', + cooldown: 0, + guildOnly: false, + developerOnly: false + }); + } + + async command(ctx) { + let SystemEmbed = new MessageEmbed() + .setTitle(`${ctx.client.user.username} | v${ctx.config.version}`) + .setColor(color) + .setDescription( + `Made by ${ctx.utils.format.bold( + ctx.client.users.find((user) => user.id === '318044130796109825').tag + )}` + ) + .addField('Language', 'Javascript', true) + .addField('Library', `d.js - v${DiscordVersion}`, true) + .addField('Uptime', `${format(process.uptime())}`, true) + .addField('Node', `${process.version}`, true) + .addField('Servers', ctx.client.guilds.size, true) + .addField('Users', ctx.client.users.size, true) + .addField('Total sauce found', ctx.db.backend.get('SourceFynnder.found'), true); + + ctx.send(SystemEmbed); + } +}; diff --git a/DiscordModules/General/userinfo.js b/DiscordModules/General/userinfo.js new file mode 100644 index 0000000..11837e4 --- /dev/null +++ b/DiscordModules/General/userinfo.js @@ -0,0 +1,59 @@ +const Command = require('../../src/structures/Command'); +module.exports = class Userinfo extends Command { + constructor() { + super({ + name: 'userinfo', + description: 'Shows User Information', + aliases: [ 'user', 'ui', 'uinfo' ], + module: 'General', + cooldown: 2, + guildOnly: true, + developerOnly: false, + nsfw: false + }); + } + + async command(ctx) { + let User; + let Game; + let Embed = new ctx.utils.discord.MessageEmbed(); + User = ctx.msg.mentions.members.first() || /* ctx.args[0] || */ ctx.member; + + if (User.presence.activity === null) { + Game = 'Playing Nothing'; + } else { + if (User.presence.activity.name === 'Custom Status') { + Game = `• ${User.presence.activity.state || 'Error'}`; + } else { + if (User.presence.activity.details === null) { + User.presence.activity.details = '*_ _*'; + User.presence.activity.state = '*_ _*'; + } else { + Game = ` + ${User.presence.activity.name} + ${User.presence.activity.details} + ${User.presence.activity.state}`; + } + } + } + let Roles = []; + let x = 0; + for (const role of User.roles) { + Roles.push(`<@&${role[0]}>`); + } + + Embed.setTitle(`Info on ${User.nickname}`) + .setColor(ctx.config.color) + .addField('Username', User.user.tag, true) + .addField('ID', User.user.id, true) + .addField(`Status | ${ctx.utils.emotes.status[User.presence.status]}`, Game); + if (Roles.length > 15) { + Embed.addField(`Roles [${Roles.length}]`, 'Too many to list' || 'Error'); + } else { + Embed.addField(`Roles [${Roles.length}]`, Roles.join(' **|** ')); + } + Embed.setThumbnail(User.user.avatarURL()); + + ctx.send(Embed).catch((err) => ctx.send('```js\n' + err + '```')); + } +}; diff --git a/DiscordModules/Images/birb.js b/DiscordModules/Images/birb.js new file mode 100644 index 0000000..9de25dc --- /dev/null +++ b/DiscordModules/Images/birb.js @@ -0,0 +1,41 @@ +const Command = require('../../src/structures/Command'); +const yiff = require('yiff'); +const { MessageEmbed } = require('discord.js'); + +module.exports = class Birb extends Command { + constructor() { + super({ + name: 'bird', + description: 'Get a random birb', + aliases: [ 'birb' ], + module: 'Images', + cooldown: 2, + guildOnly: false, + developerOnly: false, + nsfw: false + }); + } + + async command(ctx) { + const Server = await ctx.db.servers.get(ctx.guild.id); + let Settings; + if (Server === null) { + Settings = ctx.utils.db.defaults.server; + } else { + Settings = Server; + } + + let req; + let Message; + await yiff.shibe.birds().then((E) => (req = E)); + if (Settings.embeds) { + Message = new MessageEmbed() + .setColor(ctx.config.color) + .setImage(req) + .setFooter(`${ctx.client.user.username} - Provided by shibe.online`, ctx.client.user.avatarURL()); + } else { + Message = `${req}`; + } + ctx.send(Message); + } +}; diff --git a/DiscordModules/Images/cat.js b/DiscordModules/Images/cat.js new file mode 100644 index 0000000..7dcc5b8 --- /dev/null +++ b/DiscordModules/Images/cat.js @@ -0,0 +1,41 @@ +const Command = require('../../src/structures/Command'); +const yiff = require('yiff'); +const { MessageEmbed } = require('discord.js'); + +module.exports = class Cat extends Command { + constructor() { + super({ + name: 'cat', + description: 'Get a random cat', + aliases: [ 'meow' ], + module: 'Images', + cooldown: 2, + guildOnly: false, + developerOnly: false, + nsfw: false + }); + } + + async command(ctx) { + const Server = await ctx.db.servers.get(ctx.guild.id); + let Settings; + if (Server === null) { + Settings = ctx.utils.db.defaults.server; + } else { + Settings = Server; + } + + let req; + let Message; + await yiff.shibe.cats().then((E) => (req = E)); + if (Settings.embeds) { + Message = new MessageEmbed() + .setColor(ctx.config.color) + .setImage(req) + .setFooter(`${ctx.client.user.username} - Provided by shibe.online`, ctx.client.user.avatarURL()); + } else { + Message = `${req}`; + } + ctx.send(Message); + } +}; diff --git a/DiscordModules/Images/e621.js b/DiscordModules/Images/e621.js index cb30c1f..69a680e 100755 --- a/DiscordModules/Images/e621.js +++ b/DiscordModules/Images/e621.js @@ -1,58 +1,46 @@ -const Command = require("../../src/structures/Command"); -const yiff = require("yiff"); -const { MessageEmbed } = require("discord.js"); -let Icon = - "https://cdn6.aptoide.com/imgs/0/7/f/07f23fe390d6d20f47839932ea23c678_icon.png?w=240"; +const Command = require('../../src/structures/Command'); +const yiff = require('yiff'); +const { MessageEmbed } = require('discord.js'); +let Icon = 'https://werewoof.tech/e621.png'; module.exports = class E621 extends Command { - constructor() { - super({ - name: "e621", - description: "Get Images from e621", - aliases: ["e6"], - module: "Images", - cooldown: 5, - guildOnly: false, - developerOnly: false - }); - } - - async command(ctx) { - let Embed = new MessageEmbed().setColor("RED"); - if (!ctx.channel.nsfw) { - Embed.setTitle("NSFW").setDescription( - `This channel is not marked as NSFW, please mark it as such and rerun this command.` - ); - return ctx.send(Embed); - } - if (ctx.args < 1) { - Embed.setTitle("Search Terms").setDescription( - "I need more tags than that to search for an Image." - ); - return ctx.send(Embed); - } - - const Server = await ctx.db.servers.get(ctx.guild.id); - let Settings; - if (Server === null) { - Settings = ctx.utils.db.defaults.server; - } else { - Settings = Server; - } - - let message = await ctx.send(`Searching...`); - - let req; - let Message; - await yiff.e621.CubFilter(ctx.args.join(" ")).then(E => (req = E)); - if (Settings.embeds) { - Message = new MessageEmbed().setImage(req.image); - - message.delete(); - } else { - Message = `${req.image}`; - message.delete(); - } - ctx.send(Message); - } + constructor() { + super({ + name: 'e621', + description: 'Get Images from e621', + aliases: [ 'e6' ], + module: 'Images', + cooldown: 5, + guildOnly: false, + developerOnly: false, + nsfw: true + }); + } + async command(ctx) { + let Embed = new MessageEmbed().setColor('RED'); + if (ctx.args < 1) { + Embed.setTitle('Search Terms').setDescription('I need more tags than that to search for an Image.'); + return ctx.send(Embed); + } + const Server = await ctx.db.servers.get(ctx.guild.id); + let Settings; + if (Server === null) { + Settings = ctx.utils.db.defaults.server; + } else { + Settings = Server; + } + let req; + let Message; + await yiff.e621.CubFilter(ctx.args.join(' ')).then((E) => (req = E)); + if (Settings.embeds) { + Message = new MessageEmbed() + .setImage(req.image) + .setColor(ctx.config.color) + .setAuthor('e621.net', Icon, `https://e621.net/post/show/${req.postID}`) + .setFooter(`${ctx.client.user.username} - e621.net`, ctx.client.user.avatarURL()); + } else { + Message = `\n${req.image}`; + } + ctx.send(Message); + } }; diff --git a/DiscordModules/Images/e926.js b/DiscordModules/Images/e926.js new file mode 100644 index 0000000..1e10643 --- /dev/null +++ b/DiscordModules/Images/e926.js @@ -0,0 +1,46 @@ +const Command = require('../../src/structures/Command'); +const yiff = require('yiff'); +const { MessageEmbed } = require('discord.js'); +let Icon = 'https://werewoof.tech/e621.png'; + +module.exports = class E621 extends Command { + constructor() { + super({ + name: 'e926', + description: 'Get Images from e621', + aliases: [ 'e9' ], + module: 'Images', + cooldown: 5, + guildOnly: false, + developerOnly: false, + nsfw: false + }); + } + async command(ctx) { + let Embed = new MessageEmbed().setColor('RED'); + if (ctx.args < 1) { + Embed.setTitle('Search Terms').setDescription('I need more tags than that to search for an Image.'); + return ctx.send(Embed); + } + const Server = await ctx.db.servers.get(ctx.guild.id); + let Settings; + if (Server === null) { + Settings = ctx.utils.db.defaults.server; + } else { + Settings = Server; + } + let req; + let Message; + await yiff.e926.request(ctx.args.join(' ')).then((E) => (req = E)); + if (Settings.embeds) { + Message = new MessageEmbed() + .setImage(req.image) + .setColor(ctx.config.color) + .setAuthor('e621.net', Icon, `https://e926.net/post/show/${req.postID}`) + .setFooter(`${ctx.client.user.username} - e926.net`, ctx.client.user.avatarURL()); + } else { + Message = `\n${req.image}`; + } + ctx.send(Message); + } +}; diff --git a/DiscordModules/Images/fox.js b/DiscordModules/Images/fox.js new file mode 100644 index 0000000..3007e30 --- /dev/null +++ b/DiscordModules/Images/fox.js @@ -0,0 +1,41 @@ +const Command = require('../../src/structures/Command'); +const yiff = require('yiff'); +const { MessageEmbed } = require('discord.js'); + +module.exports = class Fox extends Command { + constructor() { + super({ + name: 'fox', + description: 'Get a random fox', + aliases: [ 'yip' ], + module: 'Images', + cooldown: 2, + guildOnly: false, + developerOnly: false, + nsfw: false + }); + } + + async command(ctx) { + const Server = await ctx.db.servers.get(ctx.guild.id); + let Settings; + if (Server === null) { + Settings = ctx.utils.db.defaults.server; + } else { + Settings = Server; + } + + let req; + let Message; + await yiff.sheri.animals.fox().then((E) => (req = E)); + if (Settings.embeds) { + Message = new MessageEmbed() + .setColor(ctx.config.color) + .setImage(req.url) + .setFooter(`${ctx.client.user.username} - Provided by sheri.bot`, ctx.client.user.avatarURL()); + } else { + Message = `${req}`; + } + ctx.send(Message); + } +}; diff --git a/DiscordModules/Images/shibe.js b/DiscordModules/Images/shibe.js new file mode 100644 index 0000000..44da723 --- /dev/null +++ b/DiscordModules/Images/shibe.js @@ -0,0 +1,42 @@ +const Command = require('../../src/structures/Command'); +const yiff = require('yiff'); +const { MessageEmbed } = require('discord.js'); + +module.exports = class Shibe extends Command { + constructor() { + super({ + name: 'shiba', + description: 'Get a random shibe', + aliases: [ 'shib', 'shibe' ], + module: 'Images', + cooldown: 2, + guildOnly: false, + developerOnly: false, + nsfw: false + }); + } + + async command(ctx) { + const Server = await ctx.db.servers.get(ctx.guild.id); + let Settings; + if (Server === null) { + Settings = ctx.utils.db.defaults.server; + } else { + Settings = Server; + } + + let req; + let Message; + await yiff.shibe.shibes().then((E) => (req = E)); + console.log(req); + if (Settings.embeds) { + Message = new MessageEmbed() + .setColor(ctx.config.color) + .setImage(req) + .setFooter(`${ctx.client.user.username} - Provided by shibe.online`, ctx.client.user.avatarURL()); + } else { + Message = `${req}`; + } + ctx.send(Message); + } +}; diff --git a/DiscordModules/Images/wolf.js b/DiscordModules/Images/wolf.js new file mode 100644 index 0000000..074774b --- /dev/null +++ b/DiscordModules/Images/wolf.js @@ -0,0 +1,41 @@ +const Command = require('../../src/structures/Command'); +const yiff = require('yiff'); +const { MessageEmbed } = require('discord.js'); + +module.exports = class Wolf extends Command { + constructor() { + super({ + name: 'wolf', + description: 'Get a random wolf', + aliases: [ 'woof', 'wolves', 'awoo' ], + module: 'Images', + cooldown: 2, + guildOnly: false, + developerOnly: false, + nsfw: false + }); + } + + async command(ctx) { + const Server = await ctx.db.servers.get(ctx.guild.id); + let Settings; + if (Server === null) { + Settings = ctx.utils.db.defaults.server; + } else { + Settings = Server; + } + + let req; + let Message; + await yiff.sheri.animals.wolf().then((E) => (req = E)); + if (Settings.embeds) { + Message = new MessageEmbed() + .setImage(req.url) + .setColor(ctx.config.color) + .setFooter(`${ctx.client.user.username} - Provided by sheri.bot`, ctx.client.user.avatarURL()); + } else { + Message = `${req}`; + } + ctx.send(Message); + } +}; diff --git a/DiscordModules/Roleplay/bang.js b/DiscordModules/Roleplay/bang.js new file mode 100644 index 0000000..2fc6773 --- /dev/null +++ b/DiscordModules/Roleplay/bang.js @@ -0,0 +1,65 @@ +const Command = require('../../src/structures/Command'); +const yiff = require('yiff'); +const { MessageEmbed } = require('discord.js'); + +module.exports = class Bang extends Command { + constructor() { + super({ + name: 'bang', + description: 'Cuddle a user', + aliases: [ 'fuck' ], + module: 'Roleplay', + cooldown: 2, + guildOnly: true, + developerOnly: false, + nsfw: true + }); + } + + async command(ctx) { + if (ctx.msg.mentions.members.size === 0) return ctx.send('please mention a user ;w;'); + if (ctx.msg.mentions.members.first().id === ctx.client.user.id) + return ctx.send("Don't bang me! Bang someone else!"); + if (ctx.msg.mentions.members.first().id === ctx.author.id) + return ctx.send(`Don't you want to bang someone other than yourself?`); + + const Server = await ctx.db.servers.get(ctx.guild.id); + let Line; + if (Server.rp_text) { + const LineFromUtils = ctx.utils.int.bang[parseInt(Math.random() * ctx.utils.int.bang.length)]; + Line = LineFromUtils.replace(/0/g, ctx.utils.format.bold(ctx.author.username)).replace( + /1/g, + ctx.utils.format.bold(ctx.msg.mentions.members.first().user.username) + ); + } else { + Line = undefined; + } + + let Settings; + if (Server === null) { + Settings = ctx.utils.db.defaults.server; + } else { + Settings = Server; + } + let req; + let Message; + await yiff.furrybot.nsfw.bang().then((E) => (req = E)); + + if (Settings.embeds) { + Message = new MessageEmbed() + .setColor(ctx.config.color) + .setImage(req) + .setFooter(`${ctx.client.user.username} - Provided by furry.bot`, ctx.client.user.avatarURL()); + if (Line) { + Message.setDescription(Line); + } + } else { + if (Line) { + Message = `${Line}\n${req}`; + } else { + Message = `${req}`; + } + } + ctx.send(Message); + } +}; diff --git a/DiscordModules/Roleplay/boop.js b/DiscordModules/Roleplay/boop.js new file mode 100644 index 0000000..3b7102b --- /dev/null +++ b/DiscordModules/Roleplay/boop.js @@ -0,0 +1,65 @@ +const Command = require('../../src/structures/Command'); +const yiff = require('yiff'); +const { MessageEmbed } = require('discord.js'); + +module.exports = class Boop extends Command { + constructor() { + super({ + name: 'boop', + description: 'Boop a user', + aliases: [], + module: 'Roleplay', + cooldown: 2, + guildOnly: true, + developerOnly: false, + nsfw: false + }); + } + + async command(ctx) { + if (ctx.msg.mentions.members.size === 0) return ctx.send('please mention a user ;w;'); + if (ctx.msg.mentions.members.first().id === ctx.client.user.id) + return ctx.send("Don't boop me! boop someone else!"); + if (ctx.msg.mentions.members.first().id === ctx.author.id) + return ctx.send(`Don't you want to boop someone other than yourself?`); + + const Server = await ctx.db.servers.get(ctx.guild.id); + let Line; + if (Server.rp_text) { + const LineFromUtils = ctx.utils.int.boop[parseInt(Math.random() * ctx.utils.int.boop.length)]; + Line = LineFromUtils.replace(/0/g, ctx.utils.format.bold(ctx.author.username)).replace( + /1/g, + ctx.utils.format.bold(ctx.msg.mentions.members.first().user.username) + ); + } else { + Line = undefined; + } + + let Settings; + if (Server === null) { + Settings = ctx.utils.db.defaults.server; + } else { + Settings = Server; + } + let req; + let Message; + await yiff.furrybot.sfw.boop().then((E) => (req = E)); + + if (Settings.embeds) { + Message = new MessageEmbed() + .setColor(ctx.config.color) + .setImage(req) + .setFooter(`${ctx.client.user.username} - Provided by furry.bot`, ctx.client.user.avatarURL()); + if (Line) { + Message.setDescription(Line); + } + } else { + if (Line) { + Message = `${Line}\n${req}`; + } else { + Message = `${req}`; + } + } + ctx.send(Message); + } +}; diff --git a/DiscordModules/Roleplay/bulge.js b/DiscordModules/Roleplay/bulge.js new file mode 100644 index 0000000..11430b0 --- /dev/null +++ b/DiscordModules/Roleplay/bulge.js @@ -0,0 +1,59 @@ +const Command = require('../../src/structures/Command'); +const yiff = require('yiff'); +const { MessageEmbed } = require('discord.js'); + +module.exports = class Bulge extends Command { + constructor() { + super({ + name: 'bulge', + description: `Look at a User's Bulge`, + aliases: [], + module: 'Roleplay', + cooldown: 2, + guildOnly: false, + developerOnly: false, + nsfw: true + }); + } + + async command(ctx) { + let Line; + const Server = await ctx.db.servers.get(ctx.guild.id); + if (ctx.msg.mentions.members.size > 0 && Server.rp_text) { + const LineFromUtils = ctx.utils.int.bulge[parseInt(Math.random() * ctx.utils.int.bulge.length)]; + Line = LineFromUtils.replace(/0/g, ctx.utils.format.bold(ctx.author.username)).replace( + /1/g, + ctx.utils.format.bold(ctx.msg.mentions.members.first().user.username) + ); + } else { + Line = undefined; + } + + let Settings; + if (Server === null) { + Settings = ctx.utils.db.defaults.server; + } else { + Settings = Server; + } + let req; + let Message; + await yiff.furrybot.nsfw.bulge().then((E) => (req = E)); + + if (Settings.embeds) { + Message = new MessageEmbed() + .setColor(ctx.config.color) + .setImage(req) + .setFooter(`${ctx.client.user.username} - Provided by furry.bot`, ctx.client.user.avatarURL()); + if (Line) { + Message.setDescription(Line); + } + } else { + if (Line) { + Message = `${Line}\n${req}`; + } else { + Message = `${req}`; + } + } + ctx.send(Message); + } +}; diff --git a/DiscordModules/Roleplay/cuddle.js b/DiscordModules/Roleplay/cuddle.js new file mode 100644 index 0000000..ff851b1 --- /dev/null +++ b/DiscordModules/Roleplay/cuddle.js @@ -0,0 +1,66 @@ +const Command = require('../../src/structures/Command'); +const yiff = require('yiff'); +const { MessageEmbed } = require('discord.js'); + +module.exports = class Cuddle extends Command { + constructor() { + super({ + name: 'cuddle', + description: 'Cuddle a user', + aliases: [ 'snug', 'snuggle' ], + module: 'Roleplay', + cooldown: 2, + guildOnly: true, + developerOnly: false, + nsfw: false + }); + } + + async command(ctx) { + if (ctx.msg.mentions.members.size === 0) return ctx.send('please mention a user ;w;'); + if (ctx.msg.mentions.members.first().id === ctx.client.user.id) + return ctx.send("Don't cuddle me! Cuddle someone else!"); + if (ctx.msg.mentions.members.first().id === ctx.author.id) + return ctx.send(`Don't you want to cuddle someone other than yourself?`); + + const Server = await ctx.db.servers.get(ctx.guild.id); + let Line; + if (Server.rp_text) { + const LineFromUtils = ctx.utils.int.cuddle[parseInt(Math.random() * ctx.utils.int.cuddle.length)]; + console.log(LineFromUtils); + Line = LineFromUtils.replace(/0/g, ctx.utils.format.bold(ctx.author.username)).replace( + /1/g, + ctx.utils.format.bold(ctx.msg.mentions.members.first().user.username) + ); + } else { + Line = undefined; + } + + let Settings; + if (Server === null) { + Settings = ctx.utils.db.defaults.server; + } else { + Settings = Server; + } + let req; + let Message; + await yiff.furrybot.sfw.cuddle().then((E) => (req = E)); + + if (Settings.embeds) { + Message = new MessageEmbed() + .setColor(ctx.config.color) + .setImage(req) + .setFooter(`${ctx.client.user.username} - Provided by furry.bot`, ctx.client.user.avatarURL()); + if (Line) { + Message.setDescription(Line); + } + } else { + if (Line) { + Message = `${Line}\n${req}`; + } else { + Message = `${req}`; + } + } + ctx.send(Message); + } +}; diff --git a/DiscordModules/Roleplay/hold.js b/DiscordModules/Roleplay/hold.js new file mode 100644 index 0000000..e38456a --- /dev/null +++ b/DiscordModules/Roleplay/hold.js @@ -0,0 +1,65 @@ +const Command = require('../../src/structures/Command'); +const yiff = require('yiff'); +const { MessageEmbed } = require('discord.js'); + +module.exports = class Hold extends Command { + constructor() { + super({ + name: 'hold', + description: 'Hold a user', + aliases: [], + module: 'Roleplay', + cooldown: 2, + guildOnly: true, + developerOnly: false, + nsfw: false + }); + } + + async command(ctx) { + if (ctx.msg.mentions.members.size === 0) return ctx.send('please mention a user ;w;'); + if (ctx.msg.mentions.members.first().id === ctx.client.user.id) + return ctx.send("Don't hold me! Hold someone else!"); + if (ctx.msg.mentions.members.first().id === ctx.author.id) + return ctx.send(`Don't you want to hold someone other than yourself?`); + + const Server = await ctx.db.servers.get(ctx.guild.id); + let Line; + if (Server.rp_text) { + const LineFromUtils = ctx.utils.int.hold[parseInt(Math.random() * ctx.utils.int.hold.length)]; + Line = LineFromUtils.replace(/0/g, ctx.utils.format.bold(ctx.author.username)).replace( + /1/g, + ctx.utils.format.bold(ctx.msg.mentions.members.first().user.username) + ); + } else { + Line = undefined; + } + + let Settings; + if (Server === null) { + Settings = ctx.utils.db.defaults.server; + } else { + Settings = Server; + } + let req; + let Message; + await yiff.furrybot.sfw.hold().then((E) => (req = E)); + + if (Settings.embeds) { + Message = new MessageEmbed() + .setColor(ctx.config.color) + .setImage(req) + .setFooter(`${ctx.client.user.username} - Provided by furry.bot`, ctx.client.user.avatarURL()); + if (Line) { + Message.setDescription(Line); + } + } else { + if (Line) { + Message = `${Line}\n${req}`; + } else { + Message = `${req}`; + } + } + ctx.send(Message); + } +}; diff --git a/DiscordModules/Roleplay/hug.js b/DiscordModules/Roleplay/hug.js new file mode 100644 index 0000000..7cff9cf --- /dev/null +++ b/DiscordModules/Roleplay/hug.js @@ -0,0 +1,54 @@ +const Command = require('../../src/structures/Command'); +const yiff = require('yiff'); +const { MessageEmbed } = require('discord.js'); + +module.exports = class Hug extends Command { + constructor() { + super({ + name: 'hug', + description: 'Hug a user', + aliases: [], + module: 'Roleplay', + cooldown: 2, + guildOnly: true, + developerOnly: false, + nsfw: false + }); + } + + async command(ctx) { + if (ctx.msg.mentions.members.size === 0) return ctx.send('please mention a user ;w;'); + if (ctx.msg.mentions.members.first().id === ctx.client.user.id) + return ctx.send("Don't hug me! Hug someone else!"); + if (ctx.msg.mentions.members.first().id === ctx.author.id) + return ctx.send(`Don't you want to hug someone other than yourself?`); + + const LineFromUtils = ctx.utils.int.hug[parseInt(Math.random() * ctx.utils.int.hug.length)]; + let Line = LineFromUtils.replace(/0/g, ctx.utils.format.bold(ctx.author.username)).replace( + /1/g, + ctx.utils.format.bold(ctx.msg.mentions.members.first().user.username) + ); + + const Server = await ctx.db.servers.get(ctx.guild.id); + let Settings; + if (Server === null) { + Settings = ctx.utils.db.defaults.server; + } else { + Settings = Server; + } + let req; + let Message; + await yiff.furrybot.sfw.hug().then((E) => (req = E)); + + if (Settings.embeds) { + Message = new MessageEmbed() + .setColor(ctx.config.color) + .setDescription(Line) + .setImage(req) + .setFooter(`${ctx.client.user.username} - Provided by furry.bot`, ctx.client.user.avatarURL()); + } else { + Message = `${req}`; + } + ctx.send(Message); + } +}; diff --git a/DiscordModules/Roleplay/kiss.js b/DiscordModules/Roleplay/kiss.js new file mode 100644 index 0000000..ef22002 --- /dev/null +++ b/DiscordModules/Roleplay/kiss.js @@ -0,0 +1,59 @@ +const Command = require('../../src/structures/Command'); +const yiff = require('yiff'); +const { MessageEmbed } = require('discord.js'); + +module.exports = class Kiss extends Command { + constructor() { + super({ + name: 'kiss', + description: 'Kiss a user', + aliases: [ 'smooch' ], + module: 'Roleplay', + cooldown: 2, + guildOnly: true, + developerOnly: false, + nsfw: false + }); + } + + async command(ctx) { + if (ctx.msg.mentions.members.size === 0) return ctx.send('please mention a user ;w;'); + if (ctx.msg.mentions.members.first().id === ctx.client.user.id) + return ctx.send("Don't kiss me! Kiss someone else!"); + if (ctx.msg.mentions.members.first().id === ctx.author.id) + return ctx.send(`Don't you want to kiss someone other than yourself?`); + + const Server = await ctx.db.servers.get(ctx.guild.id); + let Line; + if (Server.rp_text) { + const LineFromUtils = ctx.utils.int.kiss[parseInt(Math.random() * ctx.utils.int.kiss.length)]; + Line = LineFromUtils.replace(/0/g, ctx.utils.format.bold(ctx.author.username)).replace( + /1/g, + ctx.utils.format.bold(ctx.msg.mentions.members.first().user.username) + ); + } else { + Line = undefined; + } + + let Settings; + if (Server === null) { + Settings = ctx.utils.db.defaults.server; + } else { + Settings = Server; + } + let req; + let Message; + await yiff.furrybot.sfw.kiss().then((E) => (req = E)); + + if (Settings.embeds) { + Message = new MessageEmbed() + .setColor(ctx.config.color) + .setDescription(Line) + .setImage(req) + .setFooter(`${ctx.client.user.username} - Provided by furry.bot`, ctx.client.user.avatarURL()); + } else { + Message = `${req}`; + } + ctx.send(Message); + } +}; diff --git a/DiscordModules/Roleplay/lick.js b/DiscordModules/Roleplay/lick.js new file mode 100644 index 0000000..39df718 --- /dev/null +++ b/DiscordModules/Roleplay/lick.js @@ -0,0 +1,65 @@ +const Command = require('../../src/structures/Command'); +const yiff = require('yiff'); +const { MessageEmbed } = require('discord.js'); + +module.exports = class Lick extends Command { + constructor() { + super({ + name: 'lick', + description: 'lick a user', + aliases: [ 'mlem' ], + module: 'Roleplay', + cooldown: 2, + guildOnly: true, + developerOnly: false, + nsfw: false + }); + } + + async command(ctx) { + if (ctx.msg.mentions.members.size === 0) return ctx.send('please mention a user ;w;'); + if (ctx.msg.mentions.members.first().id === ctx.client.user.id) + return ctx.send("Don't lick me! Lick someone else!"); + if (ctx.msg.mentions.members.first().id === ctx.author.id) + return ctx.send(`Don't you want to Lick someone other than yourself?`); + const Server = await ctx.db.servers.get(ctx.guild.id); + let Line; + if (Server.rp_text) { + const LineFromUtils = ctx.utils.int.lick[parseInt(Math.random() * ctx.utils.int.lick.length)]; + console.log(LineFromUtils); + Line = LineFromUtils.replace(/0/g, ctx.utils.format.bold(ctx.author.username)).replace( + /1/g, + ctx.utils.format.bold(ctx.msg.mentions.members.first().user.username) + ); + } else { + Line = undefined; + } + + let Settings; + if (Server === null) { + Settings = ctx.utils.db.defaults.server; + } else { + Settings = Server; + } + let req; + let Message; + await yiff.furrybot.sfw.lick().then((E) => (req = E)); + + if (Settings.embeds) { + Message = new MessageEmbed() + .setColor(ctx.config.color) + .setImage(req) + .setFooter(`${ctx.client.user.username} - Provided by furry.bot`, ctx.client.user.avatarURL()); + if (Line) { + Message.setDescription(Line); + } + } else { + if (Line) { + Message = `${Line}\n${req}`; + } else { + Message = `${req}`; + } + } + ctx.send(Message); + } +}; diff --git a/DiscordModules/Roleplay/ncuddle.js b/DiscordModules/Roleplay/ncuddle.js new file mode 100644 index 0000000..0a9fcd5 --- /dev/null +++ b/DiscordModules/Roleplay/ncuddle.js @@ -0,0 +1,65 @@ +const Command = require('../../src/structures/Command'); +const yiff = require('yiff'); +const { MessageEmbed } = require('discord.js'); + +module.exports = class nCuddle extends Command { + constructor() { + super({ + name: 'ncuddle', + description: 'Cuddle a user', + aliases: [ 'nsnug', 'nsnuggle' ], + module: 'Roleplay', + cooldown: 2, + guildOnly: true, + developerOnly: false, + nsfw: true + }); + } + + async command(ctx) { + if (ctx.msg.mentions.members.size === 0) return ctx.send('please mention a user ;w;'); + if (ctx.msg.mentions.members.first().id === ctx.client.user.id) + return ctx.send("Don't cuddle me! Cuddle someone else!"); + if (ctx.msg.mentions.members.first().id === ctx.author.id) + return ctx.send(`Don't you want to cuddle someone other than yourself?`); + + const Server = await ctx.db.servers.get(ctx.guild.id); + let Line; + if (Server.rp_text) { + const LineFromUtils = ctx.utils.int.cuddle[parseInt(Math.random() * ctx.utils.int.cuddle.length)]; + Line = LineFromUtils.replace(/0/g, ctx.utils.format.bold(ctx.author.username)).replace( + /1/g, + ctx.utils.format.bold(ctx.msg.mentions.members.first().user.username) + ); + } else { + Line = undefined; + } + + let Settings; + if (Server === null) { + Settings = ctx.utils.db.defaults.server; + } else { + Settings = Server; + } + let req; + let Message; + await yiff.furrybot.nsfw.cuddle().then((E) => (req = E)); + + if (Settings.embeds) { + Message = new MessageEmbed() + .setColor(ctx.config.color) + .setImage(req) + .setFooter(`${ctx.client.user.username} - Provided by furry.bot`, ctx.client.user.avatarURL()); + if (Line) { + Message.setDescription(Line); + } + } else { + if (Line) { + Message = `${Line}\n${req}`; + } else { + Message = `${req}`; + } + } + ctx.send(Message); + } +}; diff --git a/DiscordModules/Roleplay/nhold.js b/DiscordModules/Roleplay/nhold.js new file mode 100644 index 0000000..ae90923 --- /dev/null +++ b/DiscordModules/Roleplay/nhold.js @@ -0,0 +1,65 @@ +const Command = require('../../src/structures/Command'); +const yiff = require('yiff'); +const { MessageEmbed } = require('discord.js'); + +module.exports = class nHold extends Command { + constructor() { + super({ + name: 'nhold', + description: 'Hold a user', + aliases: [], + module: 'Roleplay', + cooldown: 2, + guildOnly: true, + developerOnly: false, + nsfw: true + }); + } + + async command(ctx) { + if (ctx.msg.mentions.members.size === 0) return ctx.send('please mention a user ;w;'); + if (ctx.msg.mentions.members.first().id === ctx.client.user.id) + return ctx.send("Don't hold me! Hold someone else!"); + if (ctx.msg.mentions.members.first().id === ctx.author.id) + return ctx.send(`Don't you want to hold someone other than yourself?`); + + const Server = await ctx.db.servers.get(ctx.guild.id); + let Line; + if (Server.rp_text) { + const LineFromUtils = ctx.utils.int.hold[parseInt(Math.random() * ctx.utils.int.hold.length)]; + Line = LineFromUtils.replace(/0/g, ctx.utils.format.bold(ctx.author.username)).replace( + /1/g, + ctx.utils.format.bold(ctx.msg.mentions.members.first().user.username) + ); + } else { + Line = undefined; + } + + let Settings; + if (Server === null) { + Settings = ctx.utils.db.defaults.server; + } else { + Settings = Server; + } + let req; + let Message; + await yiff.furrybot.nsfw.hold().then((E) => (req = E)); + + if (Settings.embeds) { + Message = new MessageEmbed() + .setColor(ctx.config.color) + .setImage(req) + .setFooter(`${ctx.client.user.username} - Provided by furry.bot`, ctx.client.user.avatarURL()); + if (Line) { + Message.setDescription(Line); + } + } else { + if (Line) { + Message = `${Line}\n${req}`; + } else { + Message = `${req}`; + } + } + ctx.send(Message); + } +}; diff --git a/DiscordModules/Roleplay/nhug.js b/DiscordModules/Roleplay/nhug.js new file mode 100644 index 0000000..80f509a --- /dev/null +++ b/DiscordModules/Roleplay/nhug.js @@ -0,0 +1,64 @@ +const Command = require('../../src/structures/Command'); +const yiff = require('yiff'); +const { MessageEmbed } = require('discord.js'); + +module.exports = class nHug extends Command { + constructor() { + super({ + name: 'nhug', + description: 'Hug a user', + aliases: [], + module: 'Roleplay', + cooldown: 2, + guildOnly: true, + developerOnly: false, + nsfw: true + }); + } + + async command(ctx) { + if (ctx.msg.mentions.members.size === 0) return ctx.send('please mention a user ;w;'); + if (ctx.msg.mentions.members.first().id === ctx.client.user.id) + return ctx.send("Don't hug me! Hug someone else!"); + if (ctx.msg.mentions.members.first().id === ctx.author.id) + return ctx.send(`Don't you want to hug someone other than yourself?`); + let Line; + const Server = await ctx.db.servers.get(ctx.guild.id); + if (Server.rp_text) { + const LineFromUtils = ctx.utils.int.hug[parseInt(Math.random() * ctx.utils.int.hug.length)]; + Line = LineFromUtils.replace(/0/g, ctx.utils.format.bold(ctx.author.username)).replace( + /1/g, + ctx.utils.format.bold(ctx.msg.mentions.members.first().user.username) + ); + } else { + Line = undefined; + } + + let Settings; + if (Server === null) { + Settings = ctx.utils.db.defaults.server; + } else { + Settings = Server; + } + let req; + let Message; + await yiff.furrybot.nsfw.hug().then((E) => (req = E)); + + if (Settings.embeds) { + Message = new MessageEmbed() + .setColor(ctx.config.color) + .setImage(req) + .setFooter(`${ctx.client.user.username} - Provided by furry.bot`, ctx.client.user.avatarURL()); + if (Line) { + Message.setDescription(Line); + } + } else { + if (Line) { + Message = `${Line}\n${req}`; + } else { + Message = `${req}`; + } + } + ctx.send(Message); + } +}; diff --git a/DiscordModules/Roleplay/nkiss.js b/DiscordModules/Roleplay/nkiss.js new file mode 100644 index 0000000..5a5fe19 --- /dev/null +++ b/DiscordModules/Roleplay/nkiss.js @@ -0,0 +1,64 @@ +const Command = require('../../src/structures/Command'); +const yiff = require('yiff'); +const { MessageEmbed } = require('discord.js'); + +module.exports = class nKiss extends Command { + constructor() { + super({ + name: 'nkiss', + description: 'Kiss a user', + aliases: [ 'nsmooch' ], + module: 'Roleplay', + cooldown: 2, + guildOnly: true, + developerOnly: false, + nsfw: true + }); + } + + async command(ctx) { + if (ctx.msg.mentions.members.size === 0) return ctx.send('please mention a user ;w;'); + if (ctx.msg.mentions.members.first().id === ctx.client.user.id) + return ctx.send("Don't kiss me! Kiss someone else!"); + if (ctx.msg.mentions.members.first().id === ctx.author.id) + return ctx.send(`Don't you want to kiss someone other than yourself?`); + + if (Server.rp_text) { + const LineFromUtils = ctx.utils.int.kiss[parseInt(Math.random() * ctx.utils.int.kiss.length)]; + Line = LineFromUtils.replace(/0/g, ctx.utils.format.bold(ctx.author.username)).replace( + /1/g, + ctx.utils.format.bold(ctx.msg.mentions.members.first().user.username) + ); + } else { + Line = undefined; + } + + const Server = await ctx.db.servers.get(ctx.guild.id); + let Settings; + if (Server === null) { + Settings = ctx.utils.db.defaults.server; + } else { + Settings = Server; + } + let req; + let Message; + await yiff.furrybot.nsfw.kiss().then((E) => (req = E)); + + if (Settings.embeds) { + Message = new MessageEmbed() + .setColor(ctx.config.color) + .setImage(req) + .setFooter(`${ctx.client.user.username} - Provided by furry.bot`, ctx.client.user.avatarURL()); + if (Line) { + Message.setDescription(Line); + } + } else { + if (Line) { + Message = `${Line}\n${req}`; + } else { + Message = `${req}`; + } + } + ctx.send(Message); + } +}; diff --git a/DiscordModules/Roleplay/nlick.js b/DiscordModules/Roleplay/nlick.js new file mode 100644 index 0000000..16195b8 --- /dev/null +++ b/DiscordModules/Roleplay/nlick.js @@ -0,0 +1,64 @@ +const Command = require('../../src/structures/Command'); +const yiff = require('yiff'); +const { MessageEmbed } = require('discord.js'); + +module.exports = class nLick extends Command { + constructor() { + super({ + name: 'nlick', + description: 'lick a user', + aliases: [ 'nmlem' ], + module: 'Roleplay', + cooldown: 2, + guildOnly: true, + developerOnly: false, + nsfw: true + }); + } + + async command(ctx) { + if (ctx.msg.mentions.members.size === 0) return ctx.send('please mention a user ;w;'); + if (ctx.msg.mentions.members.first().id === ctx.client.user.id) + return ctx.send("Don't lick me! Lick someone else!"); + if (ctx.msg.mentions.members.first().id === ctx.author.id) + return ctx.send(`Don't you want to Lick someone other than yourself?`); + const Server = await ctx.db.servers.get(ctx.guild.id); + let Line; + if (Server.rp_text) { + const LineFromUtils = ctx.utils.int.lick[parseInt(Math.random() * ctx.utils.int.lick.length)]; + Line = LineFromUtils.replace(/0/g, ctx.utils.format.bold(ctx.author.username)).replace( + /1/g, + ctx.utils.format.bold(ctx.msg.mentions.members.first().user.username) + ); + } else { + Line = undefined; + } + + let Settings; + if (Server === null) { + Settings = ctx.utils.db.defaults.server; + } else { + Settings = Server; + } + let req; + let Message; + await yiff.furrybot.nsfw.lick().then((E) => (req = E)); + + if (Settings.embeds) { + Message = new MessageEmbed() + .setColor(ctx.config.color) + .setImage(req) + .setFooter(`${ctx.client.user.username} - Provided by furry.bot`, ctx.client.user.avatarURL()); + if (Line) { + Message.setDescription(Line); + } + } else { + if (Line) { + Message = `${Line}\n${req}`; + } else { + Message = `${req}`; + } + } + ctx.send(Message); + } +}; diff --git a/DiscordModules/Settings/prefix.js b/DiscordModules/Settings/prefix.js new file mode 100644 index 0000000..82ebb72 --- /dev/null +++ b/DiscordModules/Settings/prefix.js @@ -0,0 +1,59 @@ +const Command = require('../../src/structures/Command'); +module.exports = class Prefix extends Command { + constructor() { + super({ + name: 'prefix', + description: 'Add or Remove a prefix', + aliases: [], + module: 'Settings', + cooldown: 10, + guildOnly: true, + developerOnly: false + }); + } + + async command(ctx) { + const PrefixEmbed = new ctx.utils.discord.MessageEmbed(); + PrefixEmbed.setColor(ctx.config.color); + let ARG = ctx.args[0]; + ctx.args.shift(); + let Prefix = ctx.args.join(' '); + let Server = await ctx.db.servers.get(ctx.guild.id); + Server.prefix.shift(); + Server.prefix.shift(); + Server.prefix.shift(); + switch (ARG) { + case 'a': + case 'add': + if (ctx.args === [] || ctx.args.join(' ').trim() === '') return ctx.send('No Prefix was given'); + + ctx.utils.db.prefix + .add(ctx, Prefix) + .then(async () => { + let NServer = await ctx.db.servers.get(ctx.guild.id); + PrefixEmbed.setTitle(`Prefixes for ${ctx.guild.name}`); + PrefixEmbed.setDescription(`${NServer.prefix.join(', ') || ctx.db.defaults.server.prefix}`); + ctx.send(PrefixEmbed); + }) + .catch((err) => ctx.send(err)); + break; + case 'r': + case 'remove': + if (ctx.args === [] || ctx.args.join(' ').trim() === '') return ctx.send('No Prefix was given'); + ctx.utils.db.prefix + .remove(ctx, Prefix) + .then(async (r) => { + let NServer = await ctx.db.servers.get(ctx.guild.id); + ctx.send('Current Prefixes are:\n' + NServer.prefix.join(', ')); + }) + .catch((err) => ctx.send(err)); + break; + default: + PrefixEmbed.setTitle('Help'); + PrefixEmbed.addField('a / add ', 'Add a Prefix', true); + PrefixEmbed.addField('r / remove ', 'Remove a Prefix', true); + ctx.send(PrefixEmbed); + break; + } + } +}; diff --git a/DiscordModules/Settings/settings.js b/DiscordModules/Settings/settings.js index 68b162c..b4f0510 100755 --- a/DiscordModules/Settings/settings.js +++ b/DiscordModules/Settings/settings.js @@ -1,62 +1,54 @@ -const Command = require("../../src/structures/Command"); +const Command = require('../../src/structures/Command'); module.exports = class Settings extends Command { - constructor() { - super({ - name: "settings", - description: "Show the Settings of this Server", - aliases: ["config"], - module: "Settings", - cooldown: 5, - guildOnly: true, - developerOnly: false - }); - } + constructor() { + super({ + name: 'settings', + description: 'Show the Settings of this Server', + aliases: [ 'config' ], + module: 'Settings', + cooldown: 5, + guildOnly: true, + developerOnly: false + }); + } - async command(ctx) { - const SettingsEmbed = new ctx.utils.discord.MessageEmbed(); - const Server = await ctx.db.servers.get(ctx.guild.id); - // console.log(Server); - if (Server !== null) { - SettingsEmbed.setTitle(`Settings for ${ctx.guild.name}`) - .addField("Prefixes", Server.prefix.join(", "), false) - .addField( - "SourceFynnder", - Server.SourceFynnder - ? ctx.utils.emotes.settings.on - : ctx.utils.emotes.settings.off, - true - ) - .addField( - "Shortlinks", - Server.Shortlinks - ? ctx.utils.emotes.settings.on - : ctx.utils.emotes.settings.off, - true - ) - .addBlankField(true) - .addField( - "Image Embeds", - Server.embeds - ? ctx.utils.emotes.settings.on - : ctx.utils.emotes.settings.off, - true - ) - .addField( - "Image Text", - Server.rp_text - ? ctx.utils.emotes.settings.on - : ctx.utils.emotes.settings.off, - true - ) - .addField("Default Yiff", Server.default_yiff, true); - ctx.send(SettingsEmbed); - } else { - SettingsEmbed.setTitle( - `No Settings for ${ctx.guild.name}` - ).setDescription( - `You shouldn't see this.\n Your Server might not have been set up Properly when you invited me.\n\nPlease [join my support server](https://discord.gg/xNAcF8m) and notify my Developer` - ); - ctx.send(SettingsEmbed); - } - } + async command(ctx) { + const SettingsEmbed = new ctx.utils.discord.MessageEmbed(); + SettingsEmbed.setColor(ctx.config.color); + const Server = await ctx.db.servers.get(ctx.guild.id); + // console.log(Server); + if (Server !== null) { + SettingsEmbed.setTitle(`Settings for ${ctx.guild.name}`) + .addField('Prefixes', Server.prefix.join(', ') || `<@${ctx.client.user.id}> or \`'\``, false) + .addField( + 'SourceFynnder', + Server.SourceFynnder ? ctx.utils.emotes.settings.on : ctx.utils.emotes.settings.off, + true + ) + .addField( + 'Shortlinks', + Server.Shortlinks ? ctx.utils.emotes.settings.on : ctx.utils.emotes.settings.off, + true + ) + .addBlankField(true) + .addField( + 'Image Embeds', + Server.embeds ? ctx.utils.emotes.settings.on : ctx.utils.emotes.settings.off, + true + ) + .addField( + 'Image Text', + Server.rp_text ? ctx.utils.emotes.settings.on : ctx.utils.emotes.settings.off, + true + ); + // .addField('Default Yiff', Server.default_yiff, true); + ctx.send(SettingsEmbed); + } else { + SettingsEmbed.setTitle(`No Settings for ${ctx.guild.name}`).setDescription( + `You shouldn't see this.\n Your Server might not have been set up Properly when you invited me.\n\nPlease [join my support server](https://discord.gg/xNAcF8m) and notify my Developer` + ); + + ctx.send(SettingsEmbed); + } + } }; diff --git a/DiscordModules/Settings/toggle.js b/DiscordModules/Settings/toggle.js new file mode 100644 index 0000000..eea5963 --- /dev/null +++ b/DiscordModules/Settings/toggle.js @@ -0,0 +1,75 @@ +const Command = require('../../src/structures/Command'); +module.exports = class Toggle extends Command { + constructor() { + super({ + name: 'toggle', + description: 'Toggle various Settings', + aliases: [ 't' ], + module: 'Settings', + cooldown: 5, + guildOnly: true, + developerOnly: false, + AuthorPermissions: [ 'MANAGE_GUILD' ] + }); + } + + async command(ctx) { + const Embed = new ctx.utils.discord.MessageEmbed().setColor(ctx.config.color); + let ARG = ctx.args[0]; + switch (ARG) { + case 'source': + case 'sauce': + case 'sf': + case 'sourcefynnder': + await ctx.utils.db.toggle.SourceFynnder(ctx); + Embed.setTitle(`Changed SourceFynnder Setting`).setDescription( + `Now set to ${ctx.db.servers.get(ctx.guild.id).SourceFynnder + ? ctx.utils.emotes.settings.on + : ctx.utils.emotes.settings.off}` + ); + ctx.send(Embed); + break; + case 'shortlinks': + case 'shortlink': + case 'sl': + await ctx.utils.db.toggle.Shortlinks(ctx); + Embed.setTitle(`Changed Shortlink Setting`).setDescription( + `Now set to ${ctx.db.servers.get(ctx.guild.id).Shortlinks + ? ctx.utils.emotes.settings.on + : ctx.utils.emotes.settings.off}` + ); + ctx.send(Embed); + + break; + case 'embed': + case 'embeds': + await ctx.utils.db.toggle.Embeds(ctx); + Embed.setTitle(`Changed Image Embed Setting`).setDescription( + `Now set to ${ctx.db.servers.get(ctx.guild.id).embeds + ? ctx.utils.emotes.settings.on + : ctx.utils.emotes.settings.off}` + ); + ctx.send(Embed); + break; + case 'text': + case 'rp_text': + await ctx.utils.db.toggle.Text(ctx); + Embed.setTitle(`Changed Image Text Setting`).setDescription( + `Now set to ${ctx.db.servers.get(ctx.guild.id).rp_text + ? ctx.utils.emotes.settings.on + : ctx.utils.emotes.settings.off}` + ); + ctx.send(Embed); + break; + default: + Embed.setTitle('Help') + .setDescription(`All settings have their own Toggles, see the list below to know which one's which`) + .addField('SourceFynnder', 'sf sauce source sourcefynnder', true) + .addField('Shortlinks', 'sl shortlink shortlinks', true) + .addField('Image Embeds', 'embed embeds', true) + .addField('Image Text', 'text rp_text', true); + ctx.send(Embed); + break; + } + } +}; diff --git a/index.js b/index.js index 0f7e649..d6f17dc 100755 --- a/index.js +++ b/index.js @@ -1,10 +1,12 @@ -const Client = require("./src/index"); -const config = require("./config"); -const { log } = require("./utils/index"); +const Client = require('./src/index'); +const config = require('./config'); +const { log } = require('./utils/index'); +const yiff = require('yiff'); +yiff.sheri.setToken(config.api.sheri); -const { util } = require("discord.js"); +const { util } = require('discord.js'); -util.fetchRecommendedShards(config.token).then(async count => { - await log.starting(); - new Client(config, count); +util.fetchRecommendedShards(config.token).then(async (count) => { + await log.starting(); + new Client(config, count); }); diff --git a/json.sqlite b/json.sqlite index d0c9819..7dc0a61 100755 Binary files a/json.sqlite and b/json.sqlite differ diff --git a/package-lock.json b/package-lock.json index 6ca25db..3689c58 100755 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "music-bot", + "name": "thaldrin", "version": "1.0.0", "lockfileVersion": 1, "requires": true, @@ -44,6 +44,11 @@ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" }, + "asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=" + }, "async-limiter": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", @@ -63,6 +68,19 @@ "is-buffer": "^2.0.2" } }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "basic-auth": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz", + "integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==", + "requires": { + "safe-buffer": "5.1.2" + } + }, "better-sqlite3": { "version": "5.4.3", "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-5.4.3.tgz", @@ -109,6 +127,15 @@ "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.7.0.tgz", "integrity": "sha512-aIlMvstvu8x+34KEiOHD3AsBgdrzg6sxALYiukOWhFvGMbQI6TRP/iY0LMhUrHs56aD6P1G0Z7h45PUJaa5m9w==" }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "bson": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/bson/-/bson-1.0.9.tgz", @@ -188,6 +215,12 @@ "delayed-stream": "~1.0.0" } }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "optional": true + }, "compressible": { "version": "2.0.17", "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.17.tgz", @@ -210,6 +243,11 @@ "vary": "~1.1.2" } }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, "content-disposition": { "version": "0.5.3", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", @@ -273,6 +311,14 @@ "clone": "^1.0.2" } }, + "define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "requires": { + "object-keys": "^1.0.12" + } + }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -399,6 +445,18 @@ "vary": "~1.1.2" } }, + "express-handlebars": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/express-handlebars/-/express-handlebars-3.1.0.tgz", + "integrity": "sha512-7QlaXnSREMmN5P2o4gmpUZDfJlLtfBka9d6r7/ccXaU7rPp76odw9YYtwZYdIiha2JqwiaG6o2Wu6NZJQ0u7Fg==", + "requires": { + "glob": "^7.1.3", + "graceful-fs": "^4.1.2", + "handlebars": "^4.1.2", + "object.assign": "^4.1.0", + "promise": "^8.0.2" + } + }, "feature-policy": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/feature-policy/-/feature-policy-0.3.0.tgz", @@ -474,11 +532,63 @@ "minipass": "^2.6.0" } }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "glob": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.5.tgz", + "integrity": "sha512-J9dlskqUXK1OeTOYBEn5s8aMukWMwWfs+rPTn/jn50Ux4MNXVhubL1wu/j2t+H4NVI+cXEcCaYellqaPVGXNqQ==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==" + }, + "handlebars": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.1.tgz", + "integrity": "sha512-C29UoFzHe9yM61lOsIlCE5/mQVGrnIOrOq7maQl76L7tYPCgC1og0Ajt6uWnX4ZTxBPnjw+CUvawphwCfJgUnA==", + "requires": { + "neo-async": "^2.6.0", + "optimist": "^0.6.1", + "source-map": "^0.6.1", + "uglify-js": "^3.1.4" + } + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" }, + "has-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", + "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=" + }, + "hastebin-gen": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/hastebin-gen/-/hastebin-gen-2.0.5.tgz", + "integrity": "sha512-At1LaKtcqh2jiP8xfE2sDGT9IshIki6FqsgLwn2y7FzAvlFJRtpUsSPh3yWjWIQIvxi/GPF07IBqSI8WhPL/gQ==", + "requires": { + "node-fetch": "^2.6.0" + } + }, "helmet": { "version": "3.21.1", "resolved": "https://registry.npmjs.org/helmet/-/helmet-3.21.1.tgz", @@ -574,6 +684,15 @@ "resolved": "https://registry.npmjs.org/ienoopen/-/ienoopen-1.1.0.tgz", "integrity": "sha512-MFs36e/ca6ohEKtinTJ5VvAJ6oDRAYFdYXweUnGY9L9vcoqFOU4n2ZhmJ0C4z/cwGZ3YIQRSB3XZ1+ghZkY5NQ==" }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", @@ -670,6 +789,14 @@ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, "minimist": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", @@ -755,6 +882,18 @@ "xtend": "^4.0.1" } }, + "morgan": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.9.1.tgz", + "integrity": "sha512-HQStPIV4y3afTiCYVxirakhlCfGkI161c76kKFca7Fk1JusM//Qeo1ej2XaMniiNeaZklMVrh3vTtIzpzwbpmA==", + "requires": { + "basic-auth": "~2.0.0", + "debug": "2.6.9", + "depd": "~1.1.2", + "on-finished": "~2.3.0", + "on-headers": "~1.0.1" + } + }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -770,6 +909,11 @@ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" }, + "neo-async": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz", + "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==" + }, "nocache": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/nocache/-/nocache-2.1.0.tgz", @@ -793,6 +937,22 @@ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" + }, + "object.assign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", + "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", + "requires": { + "define-properties": "^1.1.2", + "function-bind": "^1.1.1", + "has-symbols": "^1.0.0", + "object-keys": "^1.0.11" + } + }, "on-finished": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", @@ -822,6 +982,15 @@ "mimic-fn": "^2.1.0" } }, + "optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "requires": { + "minimist": "~0.0.1", + "wordwrap": "~0.0.2" + } + }, "ora": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/ora/-/ora-4.0.2.tgz", @@ -851,6 +1020,11 @@ "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, "path-to-regexp": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", @@ -874,6 +1048,14 @@ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" }, + "promise": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/promise/-/promise-8.0.3.tgz", + "integrity": "sha512-HeRDUL1RJiLhyA0/grn+PTShlBAcLuh/1BJGtrvjwbvRDCTLLMEz9rOGCV+R3vHY4MixIuoMEd9Yq/XvsTPcjw==", + "requires": { + "asap": "~2.0.6" + } + }, "proxy-addr": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.5.tgz", @@ -970,6 +1152,29 @@ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz", "integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c=" }, + "restler": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/restler/-/restler-3.4.0.tgz", + "integrity": "sha1-dB7As9FrlJ/uooE9DDxoUp6IjZs=", + "requires": { + "iconv-lite": "0.2.11", + "qs": "1.2.0", + "xml2js": "0.4.0", + "yaml": "0.2.3" + }, + "dependencies": { + "iconv-lite": { + "version": "0.2.11", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.2.11.tgz", + "integrity": "sha1-HOYKOleGSiktEyH/RgnKS7llrcg=" + }, + "qs": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-1.2.0.tgz", + "integrity": "sha1-7Qeb4oaCFH5v2aNMwrDB4OxkU+4=" + } + } + }, "restore-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", @@ -989,6 +1194,11 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "sax": { + "version": "0.5.8", + "resolved": "https://registry.npmjs.org/sax/-/sax-0.5.8.tgz", + "integrity": "sha1-1HLbIo6zMcJQaw6MFVJK25OdEsE=" + }, "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", @@ -1047,6 +1257,11 @@ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + }, "statuses": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", @@ -1119,6 +1334,16 @@ "mime-types": "~2.1.24" } }, + "uglify-js": { + "version": "3.6.8", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.8.tgz", + "integrity": "sha512-XhHJ3S3ZyMwP8kY1Gkugqx3CJh2C3O0y8NPiSxtm1tyD/pktLAkFZsFGpuNfTZddKDQ/bbDBLAd2YyA1pbi8HQ==", + "optional": true, + "requires": { + "commander": "~2.20.3", + "source-map": "~0.6.1" + } + }, "unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", @@ -1156,6 +1381,11 @@ "defaults": "^1.0.3" } }, + "wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=" + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -1174,6 +1404,20 @@ "resolved": "https://registry.npmjs.org/x-xss-protection/-/x-xss-protection-1.3.0.tgz", "integrity": "sha512-kpyBI9TlVipZO4diReZMAHWtS0MMa/7Kgx8hwG/EuZLiA6sg4Ah/4TRdASHhRRN3boobzcYgFRUFSgHRge6Qhg==" }, + "xml2js": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.0.tgz", + "integrity": "sha1-Ek/EEUtBKcgQgA7LKshs8lRiy5o=", + "requires": { + "sax": "0.5.x", + "xmlbuilder": ">=0.4.2" + } + }, + "xmlbuilder": { + "version": "13.0.2", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-13.0.2.tgz", + "integrity": "sha512-Eux0i2QdDYKbdbA6AM6xE4m6ZTZr4G4xF9kahI2ukSEMCzwce2eX9WlTI5J3s+NU7hpasFsr8hWIONae7LluAQ==" + }, "xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", @@ -1184,10 +1428,15 @@ "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" }, + "yaml": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-0.2.3.tgz", + "integrity": "sha1-tUUOkudu82td0k42YAkeuu7z5cc=" + }, "yiff": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/yiff/-/yiff-1.2.1.tgz", - "integrity": "sha512-/5DiQdrCywqxQxX38HO08Wbs8rRzZRN4O217OKq6TEuTmOfmOYG1eC2G7TpmG/fi8Jk0X6fmaQ98wGzoM+KTwA==", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/yiff/-/yiff-1.2.5.tgz", + "integrity": "sha512-W/sRbqLJSfnyEfj8RdMLUpYihc/fipJ/jlUS3MMTTA6SIMfocZKJJS+G1MXVFKbTfOzMVeRKEPV9g7lDL949JA==", "requires": { "axios": "^0.19.0", "chalk": "^2.4.2" diff --git a/package.json b/package.json index d5da96d..1ad8179 100755 --- a/package.json +++ b/package.json @@ -1,27 +1,31 @@ { - "name": "music-bot", - "description": "A music bot", - "version": "1.0.0", - "main": "index.js", - "author": "ThatTonybo", - "license": "MIT", - "private": true, - "dependencies": { - "axios": "^0.19.0", - "chalk": "^2.4.2", - "compression": "*", - "cors": "*", - "discord.js": "discordjs/discord.js", - "endb": "github:chroventer/endb", - "express": "*", - "helmet": "*", - "moment": "*", - "mongojs": "^2.6.0", - "node-emoji": "^1.10.0", - "ora": "^4.0.2", - "phin": "*", - "quick.db": "^7.0.0-b22", - "usage": "^0.7.1", - "yiff": "^1.2.1" - } + "name": "thaldrin", + "description": "A Random Image and Utility Bot", + "version": "1.0.0", + "main": "index.js", + "author": "codepupper", + "license": "MIT", + "private": true, + "dependencies": { + "axios": "^0.19.0", + "chalk": "^2.4.2", + "compression": "*", + "cors": "*", + "discord.js": "discordjs/discord.js", + "endb": "github:chroventer/endb", + "express": "*", + "express-handlebars": "^3.1.0", + "hastebin-gen": "^2.0.5", + "helmet": "*", + "moment": "*", + "mongojs": "^2.6.0", + "morgan": "^1.9.1", + "node-emoji": "^1.10.0", + "ora": "^4.0.2", + "phin": "*", + "quick.db": "^7.0.0-b22", + "restler": "^3.4.0", + "usage": "^0.7.1", + "yiff": "^1.2.5" + } } diff --git a/run.sh b/run.sh index 5979de0..f003cca 100755 --- a/run.sh +++ b/run.sh @@ -1,7 +1,7 @@ -#!/bin/bash +#!/bin/zsh FILE=index -NODE=node +NODE=nodemon while true; do diff --git a/server/server.js b/server/server.js deleted file mode 100755 index c20cf25..0000000 --- a/server/server.js +++ /dev/null @@ -1,39 +0,0 @@ -const express = require('express'); -const { hostname, port, authorization } = require('../config'); - -const helmet = require('helmet'); -const compression = require('compression'); -const cors = require('cors'); - -const app = express(); - -app.use(express.json()); -app.use(express.urlencoded({ extended: true })); -app.use(helmet()); -app.use(compression()); -app.use(cors()); - -module.exports = (client) => { - app.get('/hello', async (req, res) => { - return res.send(`Hello world`); - }); - - app.post('/vote', async (req, res) => { - const body = req.body; - const auth = req.header('Authorization'); - - if (auth != authorization) return res.status(403), console.warn(`Vote rejected with authorization '${auth}'`); - // if (body.bot != client.user.id) return res.status(403), console.warn(`Vote rejected with ID '${body.bot}'`); - - if (body.type == 'test') { - console.log(`Test succeeded, is weekend:`, body.isWeekend); - } else { - console.log(`Vote`) - client.vote(body.user); - } - }); - - app.listen(port, hostname, () => { - setTimeout(() => { console.log(`Listening for votes on 164.68.110.213:${port}`); }, (1000 * 3)); - }); -} \ No newline at end of file diff --git a/src/client/Client.js b/src/client/Client.js index 2427854..5883cc4 100755 --- a/src/client/Client.js +++ b/src/client/Client.js @@ -1,63 +1,57 @@ -const { Client, Collection } = require("discord.js"); -const { readdirSync: read } = require("fs"); +const { Client, Collection } = require('discord.js'); +const { readdirSync: read } = require('fs'); -const server = require("../../server/server"); +const server = require('../../Dashboard/server'); module.exports = class Thaldrin extends Client { - constructor(config, shards) { - super({ - disableEveryone: true, - disabledEvents: ["TYPING_START"], - shardCount: shards, - totalShardCount: shards - }); + constructor(config, shards) { + super({ + disableEveryone: true, + disabledEvents: [ 'TYPING_START' ], + shardCount: shards, + totalShardCount: shards + }); - this.commands = new Collection(); - this.cooldowns = new Collection(); - // this.queues = new Collection(); - this.config = config; + this.commands = new Collection(); + this.cooldowns = new Collection(); + // this.queues = new Collection(); + this.config = config; - this.lastEval = null; + this.lastEval = null; - this.load(); - this.login(config.token); - } + this.login(config.token); + this.load(); + } - async load() { - const events = await read("./DiscordEvents"); - const modules = await read("./DiscordModules"); + async load() { + const events = await read('./DiscordEvents'); + const modules = await read('./DiscordModules'); - // server(this) + server(this); - events - .filter(f => f.endsWith(".js")) - .forEach(file => { - try { - const event = require(`../../DiscordEvents/${file}`); + events.filter((f) => f.endsWith('.js')).forEach((file) => { + try { + const event = require(`../../DiscordEvents/${file}`); - this.on(event.name, event.run.bind(null, this)); - } catch (err) { - console.error(err); - } - }); + this.on(event.name, event.run.bind(null, this)); + } catch (err) { + console.error(err); + } + }); - modules - .filter(f => !f.endsWith(".js")) - .forEach(async module => { - const commands = await read(`./DiscordModules/${module}`); + modules.filter((f) => !f.endsWith('.js')).forEach(async (module) => { + const commands = await read(`./DiscordModules/${module}`); - commands - .filter(f => f.endsWith(".js")) - .forEach(command => { - try { - const file = require(`../../DiscordModules/${module}/${command}`); - const Command = new file(); + commands.filter((f) => f.endsWith('.js')).forEach((command) => { + try { + const file = require(`../../DiscordModules/${module}/${command}`); + const Command = new file(); - this.commands.set(Command.name, Command); - } catch (err) { - console.error(err); - } - }); - }); - } + this.commands.set(Command.name, Command); + } catch (err) { + console.error(err); + } + }); + }); + } }; diff --git a/src/structures/Command.js b/src/structures/Command.js index 0454876..1e357d0 100755 --- a/src/structures/Command.js +++ b/src/structures/Command.js @@ -1,11 +1,13 @@ module.exports = class Command { - constructor(command) { - this.name = command.name || ''; - this.description = command.description || ''; - this.aliases = command.aliases || []; - this.module = command.module || ''; - this.cooldown = command.cooldown || 0; - this.guildOnly = command.guildOnly || false; - this.developerOnly = command.developerOnly || false; - } -} \ No newline at end of file + constructor(command) { + this.name = command.name || ''; + this.description = command.description || ''; + this.aliases = command.aliases || []; + this.module = command.module || ''; + this.cooldown = command.cooldown || 0; + this.guildOnly = command.guildOnly || false; + this.developerOnly = command.developerOnly || false; + this.nsfw = command.nsfw || false; + this.AuthorPermissions = command.AuthorPermissions || 'NONE'; + } +}; diff --git a/utils/index.js b/utils/index.js index f50b176..bf2508a 100755 --- a/utils/index.js +++ b/utils/index.js @@ -1,11 +1,16 @@ +const { Permissions: { FLAGS } } = require('discord.js'); module.exports = { - format: require("./src/format"), - status: require("./src/statuses"), - calc: require("./src/calc"), - ShortLinks: require("./src/shortlinks"), - SourceFynnder: require("./src/sourceFynnder"), - emotes: require("./src/emotes"), - db: require("./src/database"), - log: require("./src/logs"), - discord: require("discord.js") + format: require('./src/format'), + status: require('./src/statuses'), + calc: require('./src/calc'), + ShortLinks: require('./src/shortlinks'), + SourceFynnder: require('./src/sourceFynnder'), + emotes: require('./src/emotes'), + db: require('./src/database'), + log: require('./src/logs'), + int: require('./src/interactions'), + //eco: require('./src/economy'), + discord: require('discord.js'), + yiff: require('yiff'), + perms: FLAGS }; diff --git a/utils/src/database.js b/utils/src/database.js index 67fb9b3..5d85958 100755 --- a/utils/src/database.js +++ b/utils/src/database.js @@ -1,112 +1,136 @@ -const db = require("quick.db"); -const Servers = new db.table("servers"); -const Users = new db.table("users"); -const { prefixes } = require("../../config"); -const chalk = require("chalk"); -const e = require("node-emoji"); +const db = require('quick.db'); +const Servers = new db.table('servers'); +const Users = new db.table('users'); +//const { prefixes } = require('../../config'); +const chalk = require('chalk'); +const e = require('node-emoji'); const DatabaseDefaults = { - user: { - id: null, - blacklist: { - state: false, - replied: false, - reason: undefined - } - }, - server: { - prefix: prefixes, - SourceFynnder: false, - Shortlinks: false, - embeds: true, - rp_text: true, - default_yiff: "gay" - } + user: { + id: null, + blacklist: { + state: false, + replied: false, + reason: undefined + } + }, + server: { + prefix: [], + SourceFynnder: false, + Shortlinks: false, + embeds: true, + rp_text: true, + default_yiff: 'gay' + } }; module.exports = { - defaults: DatabaseDefaults, - setupServer: async function(ctx) { - ctx.utils.log.servers.setup(ctx.guild); - await Servers.set(ctx.guild.id, DatabaseDefaults.server); - ctx.utils.log.servers.fin(ctx.guild); - return; - }, - prefix: { - add: async function(ctx) { - let Prefixes = []; - let New; - Prefixes = await Servers.get(ctx.guild.id).prefix; + defaults: DatabaseDefaults, + setupServer: async function(ctx) { + ctx.utils.log.servers.setup(ctx.guild); + await Servers.set(ctx.guild.id, DatabaseDefaults.server); + ctx.utils.log.servers.fin(ctx.guild); + return; + }, + prefix: { + add: async function(ctx, Prefix) { + let Prefixes = []; + let New; + Prefixes = await Servers.get(ctx.guild.id).prefix; - if (Prefixes.includes(ctx.args.join(" "))) - throw new Error("Prefix already in Database"); - else { - New = await Servers.push(`${ctx.guild.id}.prefix`, ctx.args.join(" ")); - } - return New; - }, - remove: async function(ctx) { - if (require("../../config").prefixes.includes(ctx.args.join(" "))) { - throw new Error("You cannot remove the Default Prefix(es)"); - } + if (Prefixes.includes(Prefix)) throw new Error('Prefix already in Database'); + else { + New = await Servers.push(`${ctx.guild.id}.prefix`, Prefix); + } + return New; + }, + remove: async function(ctx, Prefix) { + if (prefixes.includes(Prefix)) { + throw new Error('You cannot remove the Default Prefix(es)'); + } + let Prefixes = ctx.db.servers.get(ctx.guild.id).prefix; - let Prefixes = Servers.get(`${ctx.guild.id}.prefix`); - let New; + if (!Prefixes.includes(Prefix)) { + throw new Error('Prefix does not exist in Database'); + } - for (let i in Prefixes) { - console.log( - `[${i}] [${Prefixes.toString().replace( - Prefixes[i], - chalk.red(Prefixes[i]) - )}]` - ); - if (Prefixes[i] === ctx.args.join(" ")) { - New = Prefixes.slice(i, 1); - console.log(Prefixes.slice(i, 1)); - console.log(New); - i--; - return console.log("Found it"); - } - } - //return New; - } - }, - toggle: { - SourceFynnder: async function(ctx) { - let Server = await Servers.get(ctx.guild.id); - Server.SourceFynnder - ? console.log( - `${chalk.green("✔")} Set ${chalk.blue( - "SourceFynnder" - )} in ${chalk.magenta(ctx.guild.id)} to ${chalk.red("false")} ` - ) - : console.log( - `${chalk.green("✔")} Set ${chalk.blue( - "SourceFynnder" - )} in ${chalk.magenta(ctx.guild.id)} to ${chalk.green("true")} ` - ); + let index = Prefixes.indexOf(Prefix); + Prefixes.splice(index, 1); + await Servers.set(`${ctx.guild.id}.prefix`, Prefixes); + } + }, + toggle: { + SourceFynnder: async function(ctx) { + let Server = await Servers.get(ctx.guild.id); + Server.SourceFynnder + ? console.log( + `${chalk.green('✔')} Set ${chalk.blue('SourceFynnder')} in ${chalk.magenta( + ctx.guild.id + )} to ${chalk.red('false')} ` + ) + : console.log( + `${chalk.green('✔')} Set ${chalk.blue('SourceFynnder')} in ${chalk.magenta( + ctx.guild.id + )} to ${chalk.green('true')} ` + ); - Server.SourceFynnder - ? await Servers.set(`${ctx.guild.id}.SourceFynnder`, false) - : await Servers.set(`${ctx.guild.id}.SourceFynnder`, true); - }, - Shortlinks: async function(ctx) { - let Server = await Servers.get(ctx.guild.id); - Server.Shortlinks - ? console.log( - `${chalk.green("✔")} Set ${chalk.blue( - "Shortlinks" - )} in ${chalk.magenta(ctx.guild.id)} to ${chalk.red("false")} ` - ) - : console.log( - `${chalk.green("✔")} Set ${chalk.blue( - "Shortlinks" - )} in ${chalk.magenta(ctx.guild.id)} to ${chalk.green("true")} ` - ); + Server.SourceFynnder + ? await Servers.set(`${ctx.guild.id}.SourceFynnder`, false) + : await Servers.set(`${ctx.guild.id}.SourceFynnder`, true); + }, + Shortlinks: async function(ctx) { + let Server = await Servers.get(ctx.guild.id); + Server.Shortlinks + ? console.log( + `${chalk.green('✔')} Set ${chalk.blue('Shortlinks')} in ${chalk.magenta( + ctx.guild.id + )} to ${chalk.red('false')} ` + ) + : console.log( + `${chalk.green('✔')} Set ${chalk.blue('Shortlinks')} in ${chalk.magenta( + ctx.guild.id + )} to ${chalk.green('true')} ` + ); - Server.Shortlinks - ? await Servers.set(`${ctx.guild.id}.Shortlinks`, false) - : await Servers.set(`${ctx.guild.id}.Shortlinks`, true); - } - } + Server.Shortlinks + ? await Servers.set(`${ctx.guild.id}.Shortlinks`, false) + : await Servers.set(`${ctx.guild.id}.Shortlinks`, true); + }, + Embeds: async function(ctx) { + let Server = await Servers.get(ctx.guild.id); + Server.embeds + ? console.log( + `${chalk.green('✔')} Set ${chalk.blue('Emdeds')} in ${chalk.magenta(ctx.guild.id)} to ${chalk.red( + 'false' + )} ` + ) + : console.log( + `${chalk.green('✔')} Set ${chalk.blue('Embeds')} in ${chalk.magenta( + ctx.guild.id + )} to ${chalk.green('true')} ` + ); + + Server.embeds + ? await Servers.set(`${ctx.guild.id}.embeds`, false) + : await Servers.set(`${ctx.guild.id}.embeds`, true); + }, + Text: async function(ctx) { + let Server = await Servers.get(ctx.guild.id); + Server.rp_text + ? console.log( + `${chalk.green('✔')} Set ${chalk.blue('RP Text')} in ${chalk.magenta( + ctx.guild.id + )} to ${chalk.red('false')} ` + ) + : console.log( + `${chalk.green('✔')} Set ${chalk.blue('RP Text')} in ${chalk.magenta( + ctx.guild.id + )} to ${chalk.green('true')} ` + ); + + Server.rp_text + ? await Servers.set(`${ctx.guild.id}.rp_text`, false) + : await Servers.set(`${ctx.guild.id}.rp_text`, true); + } + } }; diff --git a/utils/src/economy.js b/utils/src/economy.js new file mode 100644 index 0000000..69d25a5 --- /dev/null +++ b/utils/src/economy.js @@ -0,0 +1,15 @@ +const { table } = require('quick.db'); +const Servers = new table('servers'); +const Users = new table('users'); +const Backend = new table('backend'); +let T = '-x-'; +let Message = {}; +let hasVoted = false; +let NormalAmout = 5; + +async function CalculateFromMessage(ctx) { + Message.content = ctx.msg.content; + Message.length = ctx.msg.content.length; + + console.log(); +} diff --git a/utils/src/emotes.js b/utils/src/emotes.js index f12aa60..885a141 100755 --- a/utils/src/emotes.js +++ b/utils/src/emotes.js @@ -1,41 +1,76 @@ module.exports = { - status: { - online: "<:oxONLINE:480145455708110850>", - streaming: "<:oxSTREAMING:487933554894962688>", - idle: "<:oxIDLE:480145455183953921>", - dnd: "<:oxDND:480145455104262165>", - offline: "<:oxOFFLINE:480145455330754571>" - }, + status: { + online: '<:oxONLINE:480145455708110850> Online', + streaming: '<:oxSTREAMING:487933554894962688> Streaming', + idle: '<:oxIDLE:480145455183953921> Idle', + dnd: '<:oxDND:480145455104262165> Do not Disturb', + offline: '<:oxOFFLINE:480145455330754571> Offline' + }, + MemberStatus: { + online: '<:oxONLINE:480145455708110850>: ', + streaming: '<:oxSTREAMING:487933554894962688>: ', + idle: '<:oxIDLE:480145455183953921>: ', + dnd: '<:oxDND:480145455104262165>: ', + offline: '<:oxOFFLINE:480145455330754571>: ' + }, - social: { - twitter: "<:twitter:517392526622064640>", - patreon: "<:patreon:465243291877900300>", - github: "<:github:487283925417459732>", - trello: "<:trello:526452412244951041>", - discord: "<:discord:517392526647361557>" - }, + social: { + twitter: '<:twitter:517392526622064640>', + patreon: '<:patreon:465243291877900300>', + github: '<:github:487283925417459732>', + trello: '<:trello:526452412244951041>', + discord: '<:discord:517392526647361557>' + }, - settings: { - cog: "<:settings:350172481157464064>", - on: "<:thalYes:444843380187332608>", - off: "<:thalNo:447651589902041102> ", - locked: "<:locked:350172480318603265>", - unlocked: "<:unlocked:350172481664974848>", - save: "<:save:350172480821919745>", - trash: "<:trash:350172481794998273>" - }, + settings: { + cog: '<:settings:350172481157464064>', + on: '<:thalYes:444843380187332608>', + off: '<:thalNo:447651589902041102> ', + locked: '<:locked:350172480318603265>', + unlocked: '<:unlocked:350172481664974848>', + save: '<:save:350172480821919745>', + trash: '<:trash:350172481794998273>' + }, - eval: { - working: "<:success:350172481186955267>", - warning: "<:warning:350172481757118478>", - error: "<:error:350172479936921611>" - }, + eval: { + working: '<:success:350172481186955267>', + warning: '<:warning:350172481757118478>', + error: '<:error:350172479936921611>' + }, - perms: { - auth: "<:authorization:350172478019993614>" - }, - - random: { - pin: "<:pin:350172480725581838>" - } + perms: { + auth: '<:authorization:350172478019993614>' + }, + features: { + commerce: '<:StoreChannel:640333912442404864> Store', + news: '<:NewsChannel:640333912417239050> News', + public: ':globe_with_meridians: Public', + invite_splash: ':frame_photo: Invite Splash', + animated_icon: 'Animated Icon', + banner: 'Banner', + vanity_url: ':link: Vanity URL' + }, + regions: { + 'us-east': ':flag_us: US East', + 'us-south': ':flag_us: US South', + 'us-central': ':flag_us: US Central', + singapore: ':flag_sg: Singapore', + sydney: ':flag_au: Sydney', + southafrika: 'South Afrika', + kongkong: ':flag_hk: Hong Kong', + brazil: ':flag_br: Brazil', + amsterdam: ':flag_nl: Amsterdam', + japan: ':flag_jp: Japan', + london: ':flag_gb: London', + india: ':flag_in: India', + europe: ':flag_eu: Europe', + 'eu-west': ':flag_eu: Europe West', + 'eu-central': ':flag_eu: Europe Central', + russia: ':flag_ru: Russia', + frankfurt: ':flag_de: Frankfurt', + dubai: 'Dubai' + }, + random: { + pin: '<:pin:350172480725581838>' + } }; diff --git a/utils/src/format.js b/utils/src/format.js index aa5a077..136c2cc 100755 --- a/utils/src/format.js +++ b/utils/src/format.js @@ -1,8 +1,11 @@ module.exports = { - bold: function(str) { - return `**${str}**`; - }, - italic: function(str) { - return `*${str}*`; - } + bold: function(str) { + return `**${str}**`; + }, + italic: function(str) { + return `*${str}*`; + }, + code: function(str) { + return `\`${str}\``; + } }; diff --git a/utils/src/interactions.js b/utils/src/interactions.js new file mode 100644 index 0000000..c141d90 --- /dev/null +++ b/utils/src/interactions.js @@ -0,0 +1,59 @@ +const hug = [ + '0 hugs 1', + '1 gets a tight hug from 0', + '1 is getting a hug from 0', + 'Is 0 hugging 1? They sure are!', + '0 hugs 1 in a lovable way', + '0 hugs 1 with a very warm smile', + '0 hugs 1 in an attempt to cheer them up', + '0 sneaks up behind 1 and gives him/her a surprise hug!', + '0 lunges at 1, wrapping his/her arms around lovingly!', + "1 wasn't suspecting anything at first, but then suddenly 0 appears and hugs him/her!", + '0 blushes a little bit, carefully approaching 1 and giving him/her a tender hug.', + '0 suddenly yells out loud; "Tactical hug incoming!".', + '0 lifts 1 from the ground and hugs them tightly.', + + '0 and 1 run towards eachother, arms open, not unlike the classic grassy-field-reunion scene. They meet in the middle with a strong embrace.', + '0 scoots closer over to 1 on a park bench, then wraps his/her arms around the unsuspecting hug victim.', + '0 confidently steps forward, giving 1 a tight hug.', + "0 gives 1 a big ol' hug.", + '1 is suddenly hugged by 0!' +]; +const kiss = [ + '0 kisses 1', + '0 gives 1 a kiss', + '1 gets a surprise kiss from 0', + '0 appears to be kissing 1. Lets leave them to it :3' +]; +const boop = [ '0 boops 1', "0 boops 1's Snoot", "1's Snoot got booped by 0", '0 nuzzles 1 and boops their Snoot' ]; + +const cuddle = [ '0 cuddles 1', '0 cuddles 1 lovingly', '0 has 1 in their lap and cuddles them lovingly' ]; + +const lick = [ + '0 licked 1 to the point where he/she murrred/purred', + '0 licked 1 in the name of love. Murr!', + '0 was feeling a little playful and decided to lick 1', + '0 slides over to 1 and licks them', + '0 nibbles and licks 1 playfully', + '0 slides over to 1 and licks and cuddles 1' +]; + +const hold = [ '0 holds 1', '0 holds 1 tight' ]; + +const bulge = [ "0 eyes 1's bulge", "0 likes to see 1's bulge~" ]; + +const suck = [ "0 sucks 1's cock with hungry eyes~", '1 lets 0 suck their cock~' ]; + +const bang = [ '0 bangs 1', '1 moans as 0 bangs them', '1 moans loudly as 0 bangs them hard~' ]; + +module.exports = { + hug, + kiss, + boop, + cuddle, + lick, + hold, + bulge, + suck, + bang +}; diff --git a/utils/src/shortlinks.js b/utils/src/shortlinks.js index dbb75f2..3397876 100755 --- a/utils/src/shortlinks.js +++ b/utils/src/shortlinks.js @@ -1,54 +1,77 @@ const ShortLinkReg = /(?:\s|^)(gh|gl|gd|owo|sg|ttv|teknik|bb|yt|bc|bcu|sc|aur|bot|sw|tw|npm|xkcd)\/([a-zA-Z0-9-_.#/!]*)/g; const ShortLinks = { - gh: "https://github.com/$link$", - gl: "https://gitlab.com/$link$", - yt: "https://youtu.be/$link$", - tw: "https://twitter.com/$link$", - npm: "https://npmjs.com/package/$link$", - ttv: "https://twitch.tv/$link$", - gd: "https://gitdab.com/$link$", - owo: "https://owo.codes/$link$", - sg: "https://git.supernets.org/$link$", - teknik: "https://git.teknik.io/$link$", - bb: "https://bitbucket.org/$link$", - bc: "https://$link$.bandcamp.com/", - bcu: "https://bandcamp.com/$link$", - sc: "https://soundcloud.com/$link$", - aur: "https://aur.archlinux.org/packages/$link$", - sw: "https://steamcommunity.com/sharedfiles/filedetails/?id=$link$", - bot: "", - xkcd: "https://xkcd.com/$link$" + gh: 'https://github.com/$link$', + gl: 'https://gitlab.com/$link$', + yt: 'https://youtu.be/$link$', + tw: 'https://twitter.com/$link$', + npm: 'https://npm.im/$link$', + ttv: 'https://twitch.tv/$link$', + gd: 'https://gitdab.com/$link$', + owo: 'https://owo.codes/$link$', + sg: 'https://git.supernets.org/$link$', + teknik: 'https://git.teknik.io/$link$', + bb: 'https://bitbucket.org/$link$', + bc: 'https://$link$.bandcamp.com/', + bcu: 'https://bandcamp.com/$link$', + sc: 'https://soundcloud.com/$link$', + aur: 'https://aur.archlinux.org/packages/$link$', + sw: 'https://steamcommunity.com/sharedfiles/filedetails/?id=$link$', + bot: '', + xkcd: 'https://xkcd.com/$link$' }; - -module.exports = function Shortlink(enabled, msg) { - if (!enabled || enabled === null || enabled === undefined) return; - let res = msg.content.match(ShortLinkReg); - if (!res) return; - res = res.map(x => (x.startsWith(" ") ? x.substring(1) : x)); - let links = []; - - for (const m in res) { - for (const x in ShortLinks) { - let url = res[m]; - if (!url.startsWith(x)) continue; - url = url.replace(x + "/", ""); - - if (x == "gh" || x == "gl" || x == "gd") { - url = url.replace("#", "/issues/"); - } - - if (x == "gl") { - url = url.replace("!", "/merge_requests/"); - } else if (x == "gd") { - url = url.replace("!", "/pulls/"); - } else if (x == "gh") { - url = url.replace("!", "/pull/"); - } - - url = ShortLinks[x].replace("$link$", url); - links.push(url); - } - } - - msg.channel.send(links.join("\n")); +const ShortLinkDirs = { + gh: 'Github', + gl: 'Gitlab', + gd: 'Gitdab', + yt: 'Youtube', + tw: 'Twitter', + npm: 'NPM', + ttv: 'TwitchTv', + owo: 'owo_codes', + sg: 'Supernets_Git', + teknik: 'Teknik_Git', + bb: 'BitBucket', + bc: 'Bandcamp_Band', + bcu: 'Bandcamp_User', + sc: 'Soundcloud', + aur: 'Arch_Packages', + sw: 'Steam_Workshop', + bot: 'Discord_Bot_Invite', + xkcd: 'xkcd' +}; +const db = require('quick.db'); +const backend = new db.table('backend'); +module.exports = async function Shortlink(enabled, msg) { + if (!enabled || enabled === null || enabled === undefined) return; + let res = msg.content.match(ShortLinkReg); + if (!res) return; + res = res.map((x) => (x.startsWith(' ') ? x.substring(1) : x)); + let links = []; + let Amount = []; + + for (const m in res) { + for (const x in ShortLinks) { + let url = res[m]; + if (!url.startsWith(x)) continue; + url = url.replace(x + '/', ''); + + if (x == 'gh' || x == 'gl' || x == 'gd') { + url = url.replace('#', '/issues/'); + } + + if (x == 'gl') { + url = url.replace('!', '/merge_requests/'); + } else if (x == 'gd') { + url = url.replace('!', '/pulls/'); + } else if (x == 'gh') { + url = url.replace('!', '/pull/'); + } + + url = ShortLinks[x].replace('$link$', url); + links.push(url); + await backend.add(`Shortlink.${ShortLinkDirs[x]}`, 1); + } + } + + msg.channel.send(links.join('\n')); }; diff --git a/utils/src/sourceFynnder.js b/utils/src/sourceFynnder.js index 291d199..a5fbd57 100755 --- a/utils/src/sourceFynnder.js +++ b/utils/src/sourceFynnder.js @@ -1,39 +1,41 @@ -const axios = require("axios"); -const db = require("quick.db"); -const backend = new db.table("backend"); +const axios = require('axios'); +const db = require('quick.db'); +const backend = new db.table('backend'); +const Servers = new db.table('servers'); let md5 = new RegExp( - "((?:!)?https?://static[0-9]*.(?:e621|e926).net/data/(?:sample/|preview/|)[0-9a-f]{2}/[0-9a-f]{2}/([0-9a-f]{32}).([0-9a-z]+))", - "igm" + '((?:!)?https?://static[0-9]*.(?:e621|e926).net/data/(?:sample/|preview/|)[0-9a-f]{2}/[0-9a-f]{2}/([0-9a-f]{32}).([0-9a-z]+))', + 'igm' ); -let search_md5 = "https://e621.net/post/show.json?md5="; -let e6 = "https://e621.net/post/show/"; -let e9 = "https://e926.net/post/show/"; +let search_md5 = 'https://e621.net/post/show.json?md5='; +let e6 = 'https://e621.net/post/show/'; +let e9 = 'https://e926.net/post/show/'; -const version = "0.1.0"; +const version = '0.1.0'; module.exports = async function SourceFynnder(enabled, msg) { - if (!enabled || enabled === null || enabled === undefined) return; - res = msg.content.match(md5); - if (!res) return; + if (!enabled || enabled === null || enabled === undefined) return; + res = msg.content.match(md5); + if (!res) return; - let Sources = []; - for (const m in res) { - let URL = res[m]; - let hash = URL.split(md5)[2]; + let Sources = []; + for (const m in res) { + let URL = res[m]; + let hash = URL.split(md5)[2]; - let { data } = await axios.get(search_md5 + hash, { - headers: { "user-agent": `SourceFynnder/${version} (ry / codepupper)` } - }); - if (data.rating === "s") { - Source = e9 + data.id; - } else { - Source = e6 + data.id; - } - Sources.push(`:link::mag: ${Source}`); - } - await backend.add("SourceFynnder.found", Sources.length); - msg.channel.send(Sources); + let { data } = await axios.get(search_md5 + hash, { + headers: { 'user-agent': `SourceFynnder/${version} (ry / codepupper)` } + }); + if (data.rating === 's') { + Source = e9 + data.id; + } else { + Source = e6 + data.id; + } + Sources.push(`:link::mag: ${Source}`); + } + msg.channel.send(Sources); + await backend.add('SourceFynnder.found', Sources.length); + await Servers.add(`${msg.guild.id}.foundSources`, Sources.length); }; /* url = msg.content.split(md5); hash = url[2]; diff --git a/views/index.hbs b/views/index.hbs new file mode 100644 index 0000000..e2c78d6 --- /dev/null +++ b/views/index.hbs @@ -0,0 +1,23 @@ + +
+ +
+ Thaldrin's Icon

{{title}}

+ {{subtitle}}
+ + + + + +
+ Channels - {{bot.channels}}
+ Servers - {{bot.guilds}}
+ Users - {{bot.users}}
+ Commands - {{bot.commands}} +
+
+ + +
+ + \ No newline at end of file diff --git a/views/layouts/main.hbs b/views/layouts/main.hbs new file mode 100644 index 0000000..6c1493b --- /dev/null +++ b/views/layouts/main.hbs @@ -0,0 +1,43 @@ + + + + + + + {{title}} | {{subtitle}} + {{!-- --}} + + + + {{!-- + + --}} + + + + + + + +{{!-- + --}} + + + + + + + + + + + + {{{body}}} + + + + \ No newline at end of file