Compare commits
No commits in common. '245603472639904111b5f8bc4e860aeb1358b200' and '762bdc17bd8edf9a40af241afd49b351fc1e8e0e' have entirely different histories.
2456034726
...
762bdc17bd
@ -1,31 +1,5 @@ |
|||||||
const Discord = require('discord.js'); |
const dbConnect = require('./src/db/connect'); |
||||||
|
const r = async () => { |
||||||
const auth = require('./src/json/auth.json'); |
await dbConnect({auth: require('./src/json/auth.json'), config: {logLevel: 1}}); |
||||||
const config = require('./src/json/config.json'); |
|
||||||
const randresp = require('./src/json/randresp.json'); |
|
||||||
|
|
||||||
const log = require('./src/util/log/log'); |
|
||||||
|
|
||||||
const flags = Discord.GatewayIntentBits; |
|
||||||
const partials = Discord.Partials; |
|
||||||
let fl = []; Object.keys(flags).forEach(flag => fl.push(flags[flag])); // fuck new standards i'm in't'zing with all the flags.
|
|
||||||
const client = new Discord.Client({intents: fl, partials: [partials.Channel, partials.Message, partials.Reaction]}); |
|
||||||
// a "fuck v14" counter is gonna be here real soon i can feel it.
|
|
||||||
|
|
||||||
const startBot = async () => { |
|
||||||
client.config = config; |
|
||||||
client.auth = auth; |
|
||||||
client.config.randResp = randresp; |
|
||||||
|
|
||||||
require('./src/util/misc/setutils')(client); // add some basic swiss army knife utils
|
|
||||||
const loggers = log(client); |
|
||||||
Object.keys(loggers).forEach(logger => client[logger] = loggers[logger]); |
|
||||||
|
|
||||||
client.log(client.utils.gr(client.config.randResp.clistart), {color: "#78d9f8", source: "NATS"}); |
|
||||||
}; |
}; |
||||||
startBot(); |
r(); |
||||||
// feels like there isn't a function name to do this justice :joy:
|
|
||||||
|
|
||||||
// to do list:
|
|
||||||
// TODO check log files later for cleanup, config, and util optimization
|
|
||||||
// TODO check connect file later for ^
|
|
@ -1,11 +0,0 @@ |
|||||||
{ |
|
||||||
"clistart": [ |
|
||||||
"Let me go wake Natsuki real quick...", |
|
||||||
"You were looking for Natsuki? I'll grab her, give me just a sec.", |
|
||||||
"Natsuki's not here right now... she can take a message... ehe...", |
|
||||||
"Ughhhh. Yet again with your beckoning call.", |
|
||||||
"I think Natsuki mentioned something about wanting to rest... I'm guessing that won't be happening?", |
|
||||||
"*in robotic voice* starting up. booting now. am i convincing yet?", |
|
||||||
"Sure sure I'd love to be bothered by Discord users all day. It's not like I had anything else to do, really." |
|
||||||
] |
|
||||||
} |
|
@ -1,22 +0,0 @@ |
|||||||
module.exports = client => { |
|
||||||
client.utils = {}; //small collection of basic string manipulation utilities so prettier strings are easier
|
|
||||||
|
|
||||||
//pluralize most strings based on a number
|
|
||||||
client.utils.s = num => num === 1 ? '' : 's'; |
|
||||||
//pluralize but pass in the text to make plural
|
|
||||||
client.utils.as = (num, text) => `${text}${client.utils.s(num)}`; |
|
||||||
// "a" or "an" based on the provided string, caps to begin with capital letter
|
|
||||||
client.utils.an = (text, caps) => `${caps ? 'A' : 'a'}${['a', 'e', 'i', 'o', 'u'].includes(text.toLowerCase().trim().slice(0, 1)) ? 'n' : ''} ${text}`; |
|
||||||
//capitalize a string automatically, "a" if rest of string should be automatically lowercased
|
|
||||||
client.utils.c = (text, a=true) => `${text.slice(0, 1).toUpperCase()}${a ? text.slice(1).toLowerCase() : text.slice(1)}`; |
|
||||||
//split text into words and autocap each one
|
|
||||||
client.utils.ca = (text, a=true) => text.split(/\s+/gm).map(t => client.utils.c(t, a)).join(" "); |
|
||||||
//format a moment-presice-range object
|
|
||||||
client.utils.sm = (mpr, ago=true) => `${mpr.years ? `${mpr.years} year${client.utils.s(mpr.years)} ` : ''}${mpr.months ? `${mpr.months} month${client.utils.s(mpr.months)} ` : ''}${mpr.days} day${client.utils.s(mpr.days)}${ago ? ' ago' : ''}`; |
|
||||||
//add a grammatically correct possessive indicator to the end of a word/string
|
|
||||||
client.utils.p = (text) => text.endsWith('s') ? "'" : "'s"; |
|
||||||
//possessivise but pass in the text to possessivize
|
|
||||||
client.utils.ps = (text) => `${text}${client.utils.p(text)}`; |
|
||||||
//random element of array
|
|
||||||
client.utils.gr = list => list[Math.floor(Math.random() * list.length)]; |
|
||||||
}; |
|
Loading…
Reference in new issue