Blacklists / Topic Settings / many more changes

master
ry 3 years ago
parent 3793241426
commit 34c1822e97

@ -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)
}

@ -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);
}
};
};

@ -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);
}
};
};

@ -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 = {
});
}
}
};
};

@ -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)
}
};

@ -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);
}
};
};

@ -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}`))
}
}

@ -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}`))
}
}
}

@ -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}`))
}
}
}

@ -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}`))
}
}
}

@ -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);
}
};
};

@ -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);
}
}
};
};

@ -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'),

@ -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
}
}

@ -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;
}
}
};
};

@ -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> `
}
}

@ -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'));
};
};

@ -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'
};
};
Loading…
Cancel
Save