Compare commits
No commits in common. '1083262fae71a6ac8dbaf0af8055333612e109fc' and 'e3eb892ee41d85448e3c77d21995e398d91523c3' have entirely different histories.
1083262fae
...
e3eb892ee4
File diff suppressed because it is too large
Load Diff
@ -1,17 +1,13 @@ |
||||
const express = require('express'); |
||||
const chalk = require('chalk'); |
||||
|
||||
module.exports = (client) => { |
||||
return new Promise(r => { |
||||
const api = express(); |
||||
client.api = {wubzy: {}, natsuki: {}}; |
||||
client.api.log = (message, type, prenl, postnl) => client.log(message, {source: 'API', sourceColor: '#1F2B56', suffix: `${type ? chalk.gray(` [${type.toUpperCase()}]`) : ''} >> `}, prenl, postnl); |
||||
client.api.wubzy.app = api; |
||||
const api = express(); |
||||
client.api = {wubzy: {}, natsuki: {}}; |
||||
client.api.wubzy.app = api; |
||||
|
||||
client.api.wubzy.app.get('/', (req, res) => res.send("You've reached the wubzy.xyz API. If you're looking for Natsuki's endpoints, please append /natsuki to your query.")); |
||||
client.api.wubzy.app.get('/natsuki', (req, res) => res.send("You've reached Natsuki's status endpoint. Receiving this 200 reply indicates that Natsuki is online. If you're looking for the Natsuki API, it has been moved to natsuki.app")); |
||||
client.api.wubzy.app.get('/natsuki/:any?', (req, res) => res.status(301).send("Natsuki's API permanently resides at natsuki.app")); |
||||
client.api.wubzy.app.get('/', (req, res) => res.send("You've reached the wubzy.xyz API. If you're looking for Natsuki's endpoints, please append /natsuki to your query.")); |
||||
client.api.wubzy.app.get('/natsuki', (req, res) => res.send("You've reached Natsuki's status endpoint. Receiving this 200 reply indicates that Natsuki is online. If you're looking for the Natsuki API, it has been moved to natsuki.app")); |
||||
client.api.wubzy.app.get('/natsuki/:any?', (req, res) => res.status(301).send("Natsuki's API permanently resides at natsuki.app")); |
||||
|
||||
client.api.wubzy.server = client.api.wubzy.app.listen(4072, () => {client.api.log(`API ready at ${client.api.wubzy.server.address().address.replace('::', 'localhost')}:${client.api.wubzy.server.address().port}`, 'boot', false, true); r();}); |
||||
}); |
||||
client.api.wubzy.server = client.api.wubzy.app.listen(4072, () => console.log(`Ready at ${client.api.wubzy.server.address().address}:${client.api.wubzy.server.address().port}`)); |
||||
}; |
@ -1,7 +1,6 @@ |
||||
module.exports = { |
||||
name: "ping", |
||||
aliases: ["p"], |
||||
syntax: '`ping`', |
||||
async run(client, message, args, cmd) { |
||||
message.reply("Pong! This is Natsuki v2 you're speaking with \\*tips hat*"); |
||||
} |
@ -1,19 +1,9 @@ |
||||
const chalk = require('chalk'); |
||||
const {Embed, EmbedBuilder} = require('discord.js'); |
||||
|
||||
module.exports = async (client, message) => { |
||||
if (!message.content || !message.content.length) {return;} //privileged intent fallback //TODO edit for privileged intent
|
||||
|
||||
let prefix = client.basePrefix; //TODO prefixes
|
||||
|
||||
if ([`<@${client.user.id}>`, `<@!${client.user.id}>`].includes(message.content.trim())) { //Ping hello
|
||||
message.channel.send({embeds: [new EmbedBuilder() |
||||
.setTitle(client.utils.gr(client.config.randResp.pinghello)) |
||||
.setDescription(`You've reached ${client.config.options.dev ? "a developer (beta) instance of" : ''} Natsuki! My prefix here is \`${prefix}\`, and you can use the \`help\` command to get started.`) |
||||
.setColor('c375f0') |
||||
.setFooter({text: "Natsuki", iconURL: client.user.avatarURL()}) |
||||
]}); |
||||
} |
||||
if (!message.content || !message.content.length) {return;} //privileged intent fallback
|
||||
|
||||
if ([`<@${client.user.id}>`, `<@!${client.user.id}>`].includes(message.content.trim())) {} //TODO insert ping hello
|
||||
|
||||
let cmd = {}; |
||||
cmd.msg = message.content.toLowerCase().trim(); //i believe in shitty naming conventions :D
|
@ -1,10 +1,8 @@ |
||||
module.exports = async client => { |
||||
client.basePrefix = client.config.options.dev ? client.config.options.prefix || client.config.bot.devPrefix : client.config.bot.prefix; |
||||
|
||||
await require('../../../api/index')(client); |
||||
|
||||
require('../../startup/run/hello')(client); // startup info
|
||||
require('../../startup/run/setstatus')(client); |
||||
|
||||
client.log(client.utils.gr(client.config.randResp.cliloaded), {color: "#78d9f8", source: client.config.bot.consoleName}, true, true); //natsuki doing some more complaining
|
||||
require('../../../api/index')(client); |
||||
}; |
@ -1,11 +1,8 @@ |
||||
const chalk = require('chalk'); |
||||
|
||||
module.exports = (client, e, p) => { |
||||
console.log(`#######################################\n\n[${chalk.grey(client.config.bot.consoleName)}] >> ${chalk.hex('#78d9f8')("Well this is awkward.")}\n`); |
||||
console.log(`${chalk.bold.redBright.underline(`There was an error that killed ${client.utils.ps(client.config.bot.name)} process.`)}\n${chalk.redBright("See available stack trace and error information below.")}\n`); |
||||
if (p) { |
||||
client.log("This exception originates from an unhandled, uncaught promise rejection. Ya doofus.", 0, 0, 1); |
||||
} |
||||
module.exports = e => { |
||||
console.log(`#######################################\n\n${chalk.grey('[NATS]')} >> ${chalk.hex('#78d9f8')("Well this is awkward.")}\n`); |
||||
console.log(`${chalk.bold.redBright.underline("There was an error that killed Natsuki's process.")}\n${chalk.redBright("See available stack trace and error information below.")}\n`); |
||||
console.error(e); |
||||
console.log(`\n#######################################`); |
||||
console.log(`\n#######################################\n\n${chalk.grey('[NATS]')} >> ${chalk.hex('#78d9f8')("Back to sleepies...")}`); |
||||
}; |
@ -1,13 +0,0 @@ |
||||
const errorhandler = require("../log/errorhandler"); |
||||
const chalk = require('chalk'); |
||||
|
||||
module.exports = client => { |
||||
process.on('unhandledRejection', (e, p) => { //nested promise rejections like to be icky so this should catch them all
|
||||
errorhandler(client, e, p); |
||||
return process.exit(1); //i guess this handler does keep the event loop running but i'll adopt a zero-tolerance policy for unhandled rejections
|
||||
}); // gotta catch 'em all
|
||||
process.on('exit', code => { |
||||
client.log("Back to sleepies...", {color: "#78d9f8", source: client.config.bot.consoleName}, true); |
||||
return console.log(chalk.grey(`Exit code ${chalk.white(code)}`)); |
||||
}); |
||||
}; |
Loading…
Reference in new issue