Compare commits
2 Commits
762bdc17bd
...
2456034726
Author | SHA1 | Date |
---|---|---|
Kit Kasune | 2456034726 | 2 years ago |
Kit Kasune | 8018ff8dd9 | 2 years ago |
@ -1,5 +1,31 @@ |
||||
const dbConnect = require('./src/db/connect'); |
||||
const r = async () => { |
||||
await dbConnect({auth: require('./src/json/auth.json'), config: {logLevel: 1}}); |
||||
const Discord = require('discord.js'); |
||||
|
||||
const auth = require('./src/json/auth.json'); |
||||
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"}); |
||||
}; |
||||
r(); |
||||
startBot(); |
||||
// 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 ^
|
@ -0,0 +1,11 @@ |
||||
{ |
||||
"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." |
||||
] |
||||
} |
@ -0,0 +1,22 @@ |
||||
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