From 34c1822e97e429f5127d9ba551540ae9c95695ad Mon Sep 17 00:00:00 2001 From: ry Date: Fri, 3 Jan 2020 17:27:32 +0100 Subject: [PATCH] Blacklists / Topic Settings / many more changes --- ...{messageReactionAdd.js => EvalReaction.js} | 0 .../{EconomyMessage.js => MessageEconomy.js} | 7 +- ...hortlinkMessage.js => MessageShortlink.js} | 22 +- ...nderMessage.js => MessageSourceFynnder.js} | 22 +- DiscordEvents/message.js | 35 +++- DiscordModules/Developers/blacklist.js | 24 +++ DiscordModules/Developers/dig.js | 8 +- DiscordModules/Economy/crime.js | 22 ++ DiscordModules/Economy/daily.js | 4 +- DiscordModules/Economy/weekly.js | 4 +- DiscordModules/Economy/work.js | 4 +- DiscordModules/General/info.js | 22 +- DiscordModules/Settings/settings.js | 23 ++- utils/index.js | 1 + utils/src/TopicSettings.js | 25 +++ utils/src/database.js | 194 +++++++++++------- utils/src/economy.js | 7 +- utils/src/shortlinks.js | 4 +- vars.js | 20 +- 19 files changed, 317 insertions(+), 131 deletions(-) rename DiscordEvents/{messageReactionAdd.js => EvalReaction.js} (100%) rename DiscordEvents/{EconomyMessage.js => MessageEconomy.js} (80%) rename DiscordEvents/{ShortlinkMessage.js => MessageShortlink.js} (57%) rename DiscordEvents/{SourceFynnderMessage.js => MessageSourceFynnder.js} (58%) create mode 100644 DiscordModules/Developers/blacklist.js create mode 100644 DiscordModules/Economy/crime.js create mode 100644 utils/src/TopicSettings.js diff --git a/DiscordEvents/messageReactionAdd.js b/DiscordEvents/EvalReaction.js similarity index 100% rename from DiscordEvents/messageReactionAdd.js rename to DiscordEvents/EvalReaction.js diff --git a/DiscordEvents/EconomyMessage.js b/DiscordEvents/MessageEconomy.js similarity index 80% rename from DiscordEvents/EconomyMessage.js rename to DiscordEvents/MessageEconomy.js index d4d76a9..42d977c 100755 --- a/DiscordEvents/EconomyMessage.js +++ b/DiscordEvents/MessageEconomy.js @@ -1,5 +1,6 @@ const { - eco + eco, + db } = require("../utils"); const { table @@ -14,6 +15,10 @@ module.exports = { if (Message.author.bot) return; if (!Message.guild) return; if (Message.author.id !== '318044130796109825') return; + + let UserFromDB = await db.blacklist(Message.author.id, 's') + if (UserFromDB.state) return; + await eco.CalculateFromMessage(Message) // console.log(Message) } diff --git a/DiscordEvents/ShortlinkMessage.js b/DiscordEvents/MessageShortlink.js similarity index 57% rename from DiscordEvents/ShortlinkMessage.js rename to DiscordEvents/MessageShortlink.js index 67bdc29..8618a78 100755 --- a/DiscordEvents/ShortlinkMessage.js +++ b/DiscordEvents/MessageShortlink.js @@ -1,6 +1,14 @@ -const { log, db } = require("../utils/index"); -const { ShortLinks } = require("../utils"); -const { table } = require("quick.db"); +const { + log, + db +} = require("../utils/index"); +const { + ShortLinks, + topic +} = require("../utils"); +const { + table +} = require("quick.db"); const Servers = new table("servers"); const Users = new table("users"); const Backend = new table("backend"); @@ -9,6 +17,12 @@ module.exports = { name: "message", run: async (client, Message) => { if (Message.author.bot) return; + + let UserFromDB = await db.blacklist(Message.author.id, 's') + if (UserFromDB.state) return; + if (topic.includesSetting('thaldrin.no-SL', Message.channel.topic)) return; + + let Server = Servers.get(Message.guild.id); let Enabled; if (Server === null) { @@ -18,4 +32,4 @@ module.exports = { } ShortLinks(Enabled, Message); } -}; +}; \ No newline at end of file diff --git a/DiscordEvents/SourceFynnderMessage.js b/DiscordEvents/MessageSourceFynnder.js similarity index 58% rename from DiscordEvents/SourceFynnderMessage.js rename to DiscordEvents/MessageSourceFynnder.js index b7c6576..f3338fb 100755 --- a/DiscordEvents/SourceFynnderMessage.js +++ b/DiscordEvents/MessageSourceFynnder.js @@ -1,6 +1,14 @@ -const { log, db } = require("../utils/index"); -const { SourceFynnder } = require("../utils"); -const { table } = require("quick.db"); +const { + log, + db +} = require("../utils/index"); +const { + SourceFynnder, + topic +} = require("../utils"); +const { + table +} = require("quick.db"); const Servers = new table("servers"); const Users = new table("users"); const Backend = new table("backend"); @@ -9,6 +17,12 @@ module.exports = { name: "message", run: async (client, Message) => { if (Message.author.bot) return; + + let UserFromDB = await db.blacklist(Message.author.id, 's') + if (UserFromDB.state) return; + + if (topic.includesSetting('thaldrin.no-SF', Message.channel.topic)) return; + let Server = Servers.get(Message.guild.id); let Enabled; if (Server === null) { @@ -18,4 +32,4 @@ module.exports = { } SourceFynnder(Enabled, Message); } -}; +}; \ No newline at end of file diff --git a/DiscordEvents/message.js b/DiscordEvents/message.js index 8d0930b..8296edc 100755 --- a/DiscordEvents/message.js +++ b/DiscordEvents/message.js @@ -1,23 +1,36 @@ -const { Collection, MessageEmbed } = require('discord.js'); -const { table } = require('quick.db'); +const { + Collection, + MessageEmbed +} = require('discord.js'); +const { + table +} = require('quick.db'); const Servers = new table('servers'); const Users = new table('users'); const Backend = new table('backend'); const Trello = require('trello'); const config = require('../config'); +const { + db, + topic +} = require('../utils') const vars = require('../vars'); const trello = new Trello(config.trello.key, config.trello.token); module.exports = { name: 'message', run: async (client, msg) => { - //if (msg.author.id !== '318044130796109825') return; if (msg.author.bot) return; + //if (msg.author.id !== '318044130796109825') return; + //console.log(msg.author.tag) + + let UserFromDB = await db.blacklist(msg.author.id, 's') + if (UserFromDB.state) return; const DefaultPrefix = client.config.prefixes; const CustomPrefix = Servers.get(msg.guild.id); if (!CustomPrefix) { - PrefixArray = [ DefaultPrefix /* , CustomPrefix */ ].flat(Infinity); + PrefixArray = [DefaultPrefix /* , CustomPrefix */ ].flat(Infinity); } else { - PrefixArray = [ DefaultPrefix, CustomPrefix.prefix ].flat(Infinity); + PrefixArray = [DefaultPrefix, CustomPrefix.prefix].flat(Infinity); } let PREFIX; let EXISTS; @@ -28,10 +41,14 @@ module.exports = { } } if (!EXISTS) return; + //console.log(topic.includesSetting('thaldrin.no-cmds', msg.channel.topic)) + if (topic.includesSetting('thaldrin.no-cmd', msg.channel.topic)) 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))); + const ctx = { send: msg.channel.send.bind(msg.channel), client, @@ -44,7 +61,11 @@ module.exports = { author: msg.author, member: msg.member, trello, - db: { users: Users, servers: Servers, backend: Backend }, + db: { + users: Users, + servers: Servers, + backend: Backend + }, utils: require('../utils'), config: require('../config'), vars: require('../vars'), @@ -119,4 +140,4 @@ module.exports = { }); } } -}; +}; \ No newline at end of file diff --git a/DiscordModules/Developers/blacklist.js b/DiscordModules/Developers/blacklist.js new file mode 100644 index 0000000..a86e729 --- /dev/null +++ b/DiscordModules/Developers/blacklist.js @@ -0,0 +1,24 @@ +const Command = require('../../src/structures/Command'); +module.exports = class Blacklist extends Command { + constructor() { + super({ + name: 'blacklist', + description: 'Master the Blacklist', + aliases: ['bl'], + module: 'Developers', + cooldown: 0, + guildOnly: false, + developerOnly: true + }); + } + + async command(ctx) { + console.log(ctx.args) + let ACTION = ctx.args[0] + let ID = ctx.args[1] + let REASON = ctx.args[2] + + let X = await ctx.utils.db.blacklist(ID, ACTION, REASON) + console.log(X) + } +}; \ No newline at end of file diff --git a/DiscordModules/Developers/dig.js b/DiscordModules/Developers/dig.js index 738d7f4..42f080b 100644 --- a/DiscordModules/Developers/dig.js +++ b/DiscordModules/Developers/dig.js @@ -1,7 +1,9 @@ const Command = require("../../src/structures/Command"); const exec = require("shell-exec"); const dig = require("node-dig-dns"); -const { MessageEmbed } = require("discord.js"); +const { + MessageEmbed +} = require("discord.js"); let DomainReg = new RegExp( `(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]` ); @@ -11,7 +13,7 @@ module.exports = class Dig extends Command { name: "dig", description: "dig website dns information stuff", aliases: [], - module: "General", + module: "Developers", cooldown: 10, guildOnly: false, developerOnly: true, @@ -40,4 +42,4 @@ module.exports = class Dig extends Command { } ctx.send(DIG); } -}; +}; \ No newline at end of file diff --git a/DiscordModules/Economy/crime.js b/DiscordModules/Economy/crime.js new file mode 100644 index 0000000..af4c719 --- /dev/null +++ b/DiscordModules/Economy/crime.js @@ -0,0 +1,22 @@ +const Command = require('../../src/structures/Command'); +module.exports = class Crime extends Command { + constructor() { + super({ + name: 'crime', + description: 'Commit crimes', + aliases: [], + module: 'Economy', + cooldown: 15, + guildOnly: true, + developerOnly: true, + nsfw: false + }); + } + + + async command(ctx) { + ctx.utils.eco.quick('crime', ctx.author.id).then(r => { + ctx.send(r.text) + }).catch(error => ctx.send(`Error ${error.message}`)) + } +} \ No newline at end of file diff --git a/DiscordModules/Economy/daily.js b/DiscordModules/Economy/daily.js index 879b282..5e99519 100644 --- a/DiscordModules/Economy/daily.js +++ b/DiscordModules/Economy/daily.js @@ -16,7 +16,7 @@ module.exports = class Daily extends Command { async command(ctx) { ctx.utils.eco.Dailies().then(r => { - ctx.send(`**${r.amount}** has been added to your bank.`) + ctx.send(`**${r.amount}**<:coin:574116462260912138> has been added to your bank.`) }).catch(error => ctx.send(`You can get your dailies in ${error.message}`)) } -} +} \ No newline at end of file diff --git a/DiscordModules/Economy/weekly.js b/DiscordModules/Economy/weekly.js index 9da7bd8..4fe9732 100644 --- a/DiscordModules/Economy/weekly.js +++ b/DiscordModules/Economy/weekly.js @@ -16,7 +16,7 @@ module.exports = class Weekly extends Command { async command(ctx) { ctx.utils.eco.weekly().then(r => { - ctx.send(`**${r.amount}** has been added to your bank.`) + ctx.send(`**${r.amount}**<:coin:574116462260912138> has been added to your bank.`) }).catch(error => ctx.send(`You can get your weeklies in ${error.message}`)) } -} +} \ No newline at end of file diff --git a/DiscordModules/Economy/work.js b/DiscordModules/Economy/work.js index fcc86c5..ad878c5 100644 --- a/DiscordModules/Economy/work.js +++ b/DiscordModules/Economy/work.js @@ -3,7 +3,7 @@ module.exports = class Work extends Command { constructor() { super({ name: 'work', - description: 'Get your Dailies', + description: 'Work for your money', aliases: [], module: 'Economy', cooldown: 15, @@ -19,4 +19,4 @@ module.exports = class Work extends Command { ctx.send(r.text) }).catch(error => ctx.send(`Error ${error.message}`)) } -} +} \ No newline at end of file diff --git a/DiscordModules/General/info.js b/DiscordModules/General/info.js index cc4095c..fcaf02c 100755 --- a/DiscordModules/General/info.js +++ b/DiscordModules/General/info.js @@ -1,6 +1,8 @@ const Command = require('../../src/structures/Command'); -const { MessageEmbed, version: DiscordVersion } = require('discord.js'); -const { developers, contributors, source, color } = require('../../config'); +const { + MessageEmbed, + version: DiscordVersion +} = require('discord.js'); const db = require('quick.db'); const Backend = new db.table('backend'); module.exports = class Info extends Command { @@ -8,7 +10,7 @@ module.exports = class Info extends Command { super({ name: 'info', description: 'Show the Makers and Contributors of the Bot', - aliases: [ 'about' ], + aliases: ['about'], module: 'General', cooldown: 0, guildOnly: false, @@ -18,8 +20,18 @@ module.exports = class Info extends Command { async command(ctx) { let result; + const { + developers, + contributors, + source, + color + } = ctx.vars const contribs = []; - for (const { id, nick, reason } of contributors) { + for (const { + id, + nick, + reason + } of contributors) { const user = await ctx.client.users.fetch(id); contribs.push(`${user} (${nick}) - ${reason}`); } @@ -50,4 +62,4 @@ module.exports = class Info extends Command { ctx.send(CreditEmbed); } -}; +}; \ No newline at end of file diff --git a/DiscordModules/Settings/settings.js b/DiscordModules/Settings/settings.js index b4f0510..9e78680 100755 --- a/DiscordModules/Settings/settings.js +++ b/DiscordModules/Settings/settings.js @@ -1,10 +1,15 @@ const Command = require('../../src/structures/Command'); + +function Toggle(bool, ctx) { + return bool ? `${ctx.utils.emotes.settings.on}*_ _*` : `${ctx.utils.emotes.settings.off}*_ _*` +} + module.exports = class Settings extends Command { constructor() { super({ name: 'settings', description: 'Show the Settings of this Server', - aliases: [ 'config' ], + aliases: ['config'], module: 'Settings', cooldown: 5, guildOnly: true, @@ -12,6 +17,7 @@ module.exports = class Settings extends Command { }); } + async command(ctx) { const SettingsEmbed = new ctx.utils.discord.MessageEmbed(); SettingsEmbed.setColor(ctx.config.color); @@ -22,24 +28,19 @@ module.exports = class Settings extends Command { .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 + Toggle(Server.SourceFynnder, ctx), true ) .addField( 'Shortlinks', - Server.Shortlinks ? ctx.utils.emotes.settings.on : ctx.utils.emotes.settings.off, - true - ) + Toggle(Server.Shortlinks, ctx), true) .addBlankField(true) .addField( 'Image Embeds', - Server.embeds ? ctx.utils.emotes.settings.on : ctx.utils.emotes.settings.off, - true + Toggle(Server.embeds, ctx), true ) .addField( 'Image Text', - Server.rp_text ? ctx.utils.emotes.settings.on : ctx.utils.emotes.settings.off, - true + Toggle(Server.rp_text, ctx), true ); // .addField('Default Yiff', Server.default_yiff, true); ctx.send(SettingsEmbed); @@ -51,4 +52,4 @@ module.exports = class Settings extends Command { ctx.send(SettingsEmbed); } } -}; +}; \ No newline at end of file diff --git a/utils/index.js b/utils/index.js index 3d86e21..a6a46cb 100755 --- a/utils/index.js +++ b/utils/index.js @@ -4,6 +4,7 @@ const { } } = require('discord.js'); module.exports = { + topic: require('./src/TopicSettings'), format: require('./src/format'), status: require('./src/statuses'), calc: require('./src/calc'), diff --git a/utils/src/TopicSettings.js b/utils/src/TopicSettings.js new file mode 100644 index 0000000..0d7dac5 --- /dev/null +++ b/utils/src/TopicSettings.js @@ -0,0 +1,25 @@ +const TopicSettings = /thaldrin.(no-cmd|no-SL|no-SF)/g; +let PlaceholderTopic = ` +Commands for staff members + +thaldrin.no-cmd +thaldrin.no-SL` + +//if (PlaceholderTopic.match(TopicSettings)) return console.log(PlaceholderTopic.match(TopicSettings)) + +module.exports = { + includesSetting: function (setting, topic) { + if (!setting || !topic) return; + + let TopicSetting = topic.match(TopicSettings) + let Bool; + if (TopicSetting) { + if (TopicSetting.includes(setting)) { + Bool = true + } + } else { + Bool = false + } + return Bool + } +} \ No newline at end of file diff --git a/utils/src/database.js b/utils/src/database.js index 9d88d89..25cd65d 100755 --- a/utils/src/database.js +++ b/utils/src/database.js @@ -1,8 +1,8 @@ -const db = require('quick.db'); -const Servers = new db.table('servers'); -const Users = new db.table('users'); +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 chalk = require("chalk"); const DatabaseDefaults = { user: { @@ -19,13 +19,13 @@ const DatabaseDefaults = { Shortlinks: false, embeds: true, rp_text: true, - default_yiff: 'gay' + default_yiff: "gay" } }; module.exports = { defaults: DatabaseDefaults, - setupServer: async function(ctx) { + setupServer: async function (ctx) { ctx.utils.log.servers.setup(ctx.guild); if (Servers.get(ctx.guild.id) === null) { await Servers.set(ctx.guild.id, DatabaseDefaults.server); @@ -34,25 +34,26 @@ module.exports = { return true; }, prefix: { - add: async function(ctx, Prefix) { + add: async function (ctx, Prefix) { let Prefixes = []; let New; Prefixes = await Servers.get(ctx.guild.id).prefix; - if (Prefixes.includes(Prefix)) throw new Error('Prefix already in Database'); + 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) { + remove: async function (ctx, Prefix) { if (DatabaseDefaults.server.prefix.includes(Prefix)) { - throw new Error('You cannot remove the Default Prefix(es)'); + throw new Error("You cannot remove the Default Prefix(es)"); } let Prefixes = ctx.db.servers.get(ctx.guild.id).prefix; if (!Prefixes.includes(Prefix)) { - throw new Error('Prefix does not exist in Database'); + throw new Error("Prefix does not exist in Database"); } let index = Prefixes.indexOf(Prefix); @@ -61,77 +62,126 @@ module.exports = { } }, toggle: { - SourceFynnder: async function(ctx) { + 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 ? + 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); + Server.SourceFynnder ? + await Servers.set(`${ctx.guild.id}.SourceFynnder`, false) : + await Servers.set(`${ctx.guild.id}.SourceFynnder`, true); }, - Shortlinks: async function(ctx) { + 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 ? + 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) { + 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 ? + 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); + Server.embeds ? + await Servers.set(`${ctx.guild.id}.embeds`, false) : + await Servers.set(`${ctx.guild.id}.embeds`, true); }, - Text: async function(ctx) { + 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 ? + 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); + Server.rp_text ? + await Servers.set(`${ctx.guild.id}.rp_text`, false) : + await Servers.set(`${ctx.guild.id}.rp_text`, true); + } + }, + blacklist: async function (user = '318044130796109825', kind, reason) { + switch (kind) { + case "add": + case "a": + let Y = await Users.set(user, { + id: user, + blacklist: { + state: true, + replied: false, + reason: reason + } + }); + return Y; + break; + case "remove": + case "r": + let Z = await Users.set(user, { + id: user, + blacklist: { + state: false, + replied: false, + reason: undefined + } + }); + return Z; + break; + case "check": + case "status": + case "c": + case "s": + //let X = await Users.get(user); + //console.log(X) + //if (X === null) X = DatabaseDefaults.user + //if(X.blacklist === null) + let W = await Users.get(user) + let X = DatabaseDefaults.user.blacklist + + if (W === null) K = X + else if (W.blacklist === undefined || W.blacklist === null) K = X + else K = W.blacklist + + //console.log(K) + return K + break; + + default: + break; } } -}; +}; \ No newline at end of file diff --git a/utils/src/economy.js b/utils/src/economy.js index 255d3ce..a14c16d 100644 --- a/utils/src/economy.js +++ b/utils/src/economy.js @@ -15,7 +15,7 @@ module.exports = { let hasVoted = await Users.get(`${Message.author.id}.voted`); content = Message.content; length = Message.content.length; - if (hasVoted) d = 1; + if (hasVoted) d = 1 else d = 0.01; e = (length * d).toFixed(1); return await Users.add(`${Message.author.id}.money.bank`, e); @@ -79,18 +79,17 @@ module.exports = { } }; if (way.hasOwnProperty(kind)) { - console.log(way[kind].probability); if (way[kind].probability) { Users.add(`${User}.money.cash`, way[kind].payout); return { money: way[kind].payout, - text: `You got ${way[kind].payout} from doing ${kind}` + text: `You got ${way[kind].payout}<:coin:574116462260912138> from doing ${kind}` } } else { Users.subtract(`${User}.money.cash`, way[kind].fine); return { money: way[kind].fine, - text: `You were fined **${way[kind].fine}** by **${kind}**` + text: `You were fined **${way[kind].fine}**<:coin:574116462260912138> ` } } diff --git a/utils/src/shortlinks.js b/utils/src/shortlinks.js index 512325f..c052f07 100755 --- a/utils/src/shortlinks.js +++ b/utils/src/shortlinks.js @@ -70,10 +70,10 @@ module.exports = async function Shortlink(enabled, msg) { } url = ShortLinks[x].replace('$link$', url); - links.push(url); + links.push(`<${url}>`); await backend.add(`Shortlink.${ShortLinkDirs[x]}`, 1); } } msg.channel.send(links.join('\n')); -}; +}; \ No newline at end of file diff --git a/vars.js b/vars.js index 4cbe462..adefe3d 100644 --- a/vars.js +++ b/vars.js @@ -1,24 +1,20 @@ module.exports = { - version: '3.0.5', + version: '3.6.2', color: '#ff995d', name: 'thaldr.in', hostname: '127.2.11.1', //hostname: 'localhost', port: '8080', - /* authorization: "g66(TTV&^R^&T*IV56RF$FUTyxsyu534", */ type: { beta: true, prod: false }, - prefixes: [ "'", `<@511212243015434270> `, '<@!511212243015434270> ' ], - developers: [ - { - id: '318044130796109825', - nick: 'ry' - } - ], - contributors: [ - { + prefixes: ["'", `<@511212243015434270> `, '<@!511212243015434270> '], + developers: [{ + id: '318044130796109825', + nick: 'ry' + }], + contributors: [{ id: '150745989836308480', nick: 'Cyn', reason: 'Shortlink Code :3' @@ -41,4 +37,4 @@ module.exports = { ], source: 'https://gitdab.com/r/thaldrin', invite: 'https://discordapp.com/oauth2/authorize?client_id=434662676547764244&scope=bot&permissions=379968' -}; +}; \ No newline at end of file