parent
6124dc7d6d
commit
1083262fae
@ -1,40 +1,40 @@ |
||||
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()}) |
||||
]}); |
||||
} |
||||
|
||||
let cmd = {}; |
||||
cmd.msg = message.content.toLowerCase().trim(); //i believe in shitty naming conventions :D
|
||||
|
||||
let prefixUsed = cmd.msg.startsWith(client.basePrefix) ? client.basePrefix //stamdard default/dev client prefix
|
||||
: cmd.msg.startsWith(`<@${client.user.id}>`) ? `<@${client.user.id}>` //mention prefix
|
||||
: cmd.msg.startsWith(`<@!${client.user.id}>`) ? `<@!${client.user.id}>` //nicknamed mention prefix
|
||||
: null //no prefix used
|
||||
|
||||
cmd.prefix = prefixUsed; |
||||
|
||||
if (!cmd.prefix) {return;} // ----------> PREFIXED GATEWAY <----------
|
||||
|
||||
cmd.msg = cmd.msg.slice(prefixUsed.length); |
||||
let args = cmd.msg.split(/\s+/gm); //"args" is split by ALL WHITESPACE AND IS LOWERCASED
|
||||
cmd.name = args.shift(); //the command without the prefix
|
||||
cmd.msg = args.join(" "); |
||||
cmd.args = message.content.trim().slice(prefixUsed.length).trim().split(/ +/gm).slice(1); //args but preserves text state and newlines
|
||||
|
||||
let cmdToRun = client.commands.get(cmd.name) || client.commands.get(client.aliases.get(cmd.name)); |
||||
if (!cmdToRun) {return;} |
||||
try {cmdToRun.run(client, message, args, cmd).catch(e => client.error(`There was an error in the ${cmdToRun.name} command.`, 0, 1, e, '\n'));} |
||||
catch (e) {client.error(`There was an error in the ${cmdToRun.name} command.`, 0, 1, e, '\n');} |
||||
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()}) |
||||
]}); |
||||
} |
||||
|
||||
let cmd = {}; |
||||
cmd.msg = message.content.toLowerCase().trim(); //i believe in shitty naming conventions :D
|
||||
|
||||
let prefixUsed = cmd.msg.startsWith(client.basePrefix) ? client.basePrefix //stamdard default/dev client prefix
|
||||
: cmd.msg.startsWith(`<@${client.user.id}>`) ? `<@${client.user.id}>` //mention prefix
|
||||
: cmd.msg.startsWith(`<@!${client.user.id}>`) ? `<@!${client.user.id}>` //nicknamed mention prefix
|
||||
: null //no prefix used
|
||||
|
||||
cmd.prefix = prefixUsed; |
||||
|
||||
if (!cmd.prefix) {return;} // ----------> PREFIXED GATEWAY <----------
|
||||
|
||||
cmd.msg = cmd.msg.slice(prefixUsed.length); |
||||
let args = cmd.msg.split(/\s+/gm); //"args" is split by ALL WHITESPACE AND IS LOWERCASED
|
||||
cmd.name = args.shift(); //the command without the prefix
|
||||
cmd.msg = args.join(" "); |
||||
cmd.args = message.content.trim().slice(prefixUsed.length).trim().split(/ +/gm).slice(1); //args but preserves text state and newlines
|
||||
|
||||
let cmdToRun = client.commands.get(cmd.name) || client.commands.get(client.aliases.get(cmd.name)); |
||||
if (!cmdToRun) {return;} |
||||
try {cmdToRun.run(client, message, args, cmd).catch(e => client.error(`There was an error in the ${cmdToRun.name} command.`, 0, 1, e, '\n'));} |
||||
catch (e) {client.error(`There was an error in the ${cmdToRun.name} command.`, 0, 1, e, '\n');} |
||||
}; |
@ -1,10 +1,10 @@ |
||||
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
|
||||
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
|
||||
}; |
@ -1,53 +1,53 @@ |
||||
const fs = require('fs'); |
||||
const chalk = require('chalk'); |
||||
const {Collection} = require('discord.js'); |
||||
|
||||
const commandsDirName = './src/handle/runtime/commands'; |
||||
|
||||
module.exports = async client => { |
||||
client.aliases = new Collection(); |
||||
|
||||
let dirErrors = []; let fileErrors = []; //collect error objects to output them all at the end
|
||||
let readDirs = []; //list of dirs to print at the end
|
||||
let conflictingAliases = {}; |
||||
client.log('Loading commands...', {source: 'boot', color: 'blue'}, 0, 1); |
||||
const readDir = dir => { //when you're trying to comment your code but realize you have good variable naming for once and don't need to :D
|
||||
let dirRead; |
||||
try {dirRead = fs.readdirSync(dir);} |
||||
catch (e) { |
||||
client.error(`Failed to read directory ${chalk.white(dir)}`); |
||||
return dirErrors.push([`Unable to read directory ${chalk.white(dir)}. Error:`, e]); |
||||
} |
||||
let files = dirRead.filter(item => item.endsWith('.js')); |
||||
let folders = dirRead.filter(item => fs.lstatSync(`${dir}/${item}`).isDirectory()); |
||||
files.forEach(file => { |
||||
try { |
||||
const command = require(`../../../../${dir.slice(2)}/${file}`); |
||||
client.commands.set(command.name, command); |
||||
if (command.aliases) {command.aliases.forEach(alias => { |
||||
if (client.aliases.has(alias)) { |
||||
if (conflictingAliases[alias]) {conflictingAliases[alias].push(command.name);} //object of alias conflictions keyed by alias -> by array[command names]
|
||||
else {conflictingAliases[alias] = [command.name];} |
||||
} |
||||
client.aliases.set(alias, command.name); |
||||
});} |
||||
client.log(`Loaded ${chalk.white(command.name)} with ${chalk.white(`${command.aliases ? command.aliases.length : 0}`)} alias${command.aliases && command.aliases.length === 1 ? '' : 'es'}.`, {color: 'blueBright', source: 'boot', sourceColor: 'blue'}); |
||||
} |
||||
catch (e) { |
||||
client.error(`Failed to read file ${chalk.white(file)}`); |
||||
return fileErrors.push([`Unable to read file ${chalk.white(file)}. Error:`, e]); |
||||
} |
||||
}); |
||||
readDirs.push(`${dir.split('/').slice(4).join('/')}/`); // "commands/..."
|
||||
return folders.forEach(folder => readDir(`${dir}/${folder}`)); //recurse infinitely
|
||||
}; |
||||
readDir(commandsDirName); |
||||
console.log(""); |
||||
dirErrors.forEach(error => client.error(error[0], 0, 0, 1, error[1])); |
||||
fileErrors.forEach(error => client.error(error[0], 0, 0, 1, error[1])); |
||||
readDirs.forEach(dir => client.log(`Read from directory ${chalk.green(dir)}`, {source: 'proc'})); |
||||
console.log(''); |
||||
Object.keys(conflictingAliases).forEach(alias => client.warn(`Alias ${chalk.white(alias)} appears on ${client.utils.as(conflictingAliases[alias].length, 'command')} ${chalk.white(conflictingAliases[alias].join(chalk.yellow(', ')))}`)); |
||||
if (Object.keys(conflictingAliases).length) {console.log('')}; |
||||
client.log(`Loaded ${chalk.white(client.commands.size)} command${client.utils.s(client.commands.size)}!`, {color: 'blue', source: 'boot'}, 0, 1); |
||||
const fs = require('fs'); |
||||
const chalk = require('chalk'); |
||||
const {Collection} = require('discord.js'); |
||||
|
||||
const commandsDirName = './src/bot/runtime/commands'; |
||||
|
||||
module.exports = async client => { |
||||
client.aliases = new Collection(); |
||||
|
||||
let dirErrors = []; let fileErrors = []; //collect error objects to output them all at the end
|
||||
let readDirs = []; //list of dirs to print at the end
|
||||
let conflictingAliases = {}; |
||||
client.log('Loading commands...', {source: 'boot', color: 'blue'}, 0, 1); |
||||
const readDir = dir => { //when you're trying to comment your code but realize you have good variable naming for once and don't need to :D
|
||||
let dirRead; |
||||
try {dirRead = fs.readdirSync(dir);} |
||||
catch (e) { |
||||
client.error(`Failed to read directory ${chalk.white(dir)}`); |
||||
return dirErrors.push([`Unable to read directory ${chalk.white(dir)}. Error:`, e]); |
||||
} |
||||
let files = dirRead.filter(item => item.endsWith('.js')); |
||||
let folders = dirRead.filter(item => fs.lstatSync(`${dir}/${item}`).isDirectory()); |
||||
files.forEach(file => { |
||||
try { |
||||
const command = require(`../../../../${dir.slice(2)}/${file}`); |
||||
client.commands.set(command.name, command); |
||||
if (command.aliases) {command.aliases.forEach(alias => { |
||||
if (client.aliases.has(alias)) { |
||||
if (conflictingAliases[alias]) {conflictingAliases[alias].push(command.name);} //object of alias conflictions keyed by alias -> by array[command names]
|
||||
else {conflictingAliases[alias] = [command.name];} |
||||
} |
||||
client.aliases.set(alias, command.name); |
||||
});} |
||||
client.log(`Loaded ${chalk.white(command.name)} with ${chalk.white(`${command.aliases ? command.aliases.length : 0}`)} alias${command.aliases && command.aliases.length === 1 ? '' : 'es'}.`, {color: 'blueBright', source: 'boot', sourceColor: 'blue'}); |
||||
} |
||||
catch (e) { |
||||
client.error(`Failed to read file ${chalk.white(file)}`); |
||||
return fileErrors.push([`Unable to read file ${chalk.white(file)}. Error:`, e]); |
||||
} |
||||
}); |
||||
readDirs.push(`${dir.split('/').slice(4).join('/')}/`); // "commands/..."
|
||||
return folders.forEach(folder => readDir(`${dir}/${folder}`)); //recurse infinitely
|
||||
}; |
||||
readDir(commandsDirName); |
||||
console.log(""); |
||||
dirErrors.forEach(error => client.error(error[0], 0, 0, 1, error[1])); |
||||
fileErrors.forEach(error => client.error(error[0], 0, 0, 1, error[1])); |
||||
readDirs.forEach(dir => client.log(`Read from directory ${chalk.green(dir)}`, {source: 'proc'})); |
||||
console.log(''); |
||||
Object.keys(conflictingAliases).forEach(alias => client.warn(`Alias ${chalk.white(alias)} appears on ${client.utils.as(conflictingAliases[alias].length, 'command')} ${chalk.white(conflictingAliases[alias].join(chalk.yellow(', ')))}`)); |
||||
if (Object.keys(conflictingAliases).length) {console.log('')}; |
||||
client.log(`Loaded ${chalk.white(client.commands.size)} command${client.utils.s(client.commands.size)}!`, {color: 'blue', source: 'boot'}, 0, 1); |
||||
}; |
@ -1,45 +1,45 @@ |
||||
const fs = require('fs'); |
||||
const chalk = require('chalk'); |
||||
const {Collection} = require('discord.js'); |
||||
|
||||
const eventsDirName = './src/handle/runtime/events'; |
||||
|
||||
module.exports = async client => { |
||||
client.aliases = new Collection(); |
||||
|
||||
let dirErrors = []; let fileErrors = []; //collect error objects to output them all at the end
|
||||
let readDirs = []; //list of dirs to print at the end
|
||||
let totalEvents = 0; |
||||
client.log('Loading events...', {source: 'boot', color: 'blue'}, 0, 1); |
||||
const readDir = dir => { |
||||
let dirRead; |
||||
try {dirRead = fs.readdirSync(dir);} |
||||
catch (e) { |
||||
client.error(`Failed to read directory ${chalk.white(dir)}`); |
||||
return dirErrors.push([`Unable to read directory ${chalk.white(dir)}. Error:`, e]); |
||||
} |
||||
let files = dirRead.filter(item => item.endsWith('.js')); |
||||
let folders = dirRead.filter(item => fs.lstatSync(`${dir}/${item}`).isDirectory()); |
||||
files.forEach(file => { |
||||
try { |
||||
const event = require(`../../../../${dir.slice(2)}/${file}`); |
||||
const eventName = file.split('.')[0]; |
||||
client.removeAllListeners(eventName); |
||||
client.on(eventName, event.bind(null, client)); |
||||
client.log(`Loaded event ${chalk.white(eventName)}`, {color: 'blueBright', source: 'boot', sourceColor: 'blue'}); |
||||
} |
||||
catch (e) { |
||||
client.error(`Failed to read file ${chalk.white(file)}`); |
||||
return fileErrors.push([`Unable to read file ${chalk.white(file)}. Error:`, e]); |
||||
} |
||||
}); |
||||
readDirs.push(`${dir.split('/').slice(4).join('/')}/`); // "events/..."
|
||||
return folders.forEach(folder => readDir(`${dir}/${folder}`)); //recurse infinitely
|
||||
}; |
||||
readDir(eventsDirName); |
||||
console.log(""); |
||||
dirErrors.forEach(error => client.error(error[0], 0, 0, 1, error[1])); |
||||
fileErrors.forEach(error => client.error(error[0], 0, 0, 1, error[1])); |
||||
readDirs.forEach(dir => client.log(`Read from directory ${chalk.green(dir)}`, {source: 'proc'})); |
||||
client.log(`Loaded ${chalk.white(totalEvents)} event${client.utils.s(totalEvents)}!`, {color: 'blue', source: 'boot'}, 1, 1); |
||||
const fs = require('fs'); |
||||
const chalk = require('chalk'); |
||||
const {Collection} = require('discord.js'); |
||||
|
||||
const eventsDirName = './src/bot/runtime/events'; |
||||
|
||||
module.exports = async client => { |
||||
client.aliases = new Collection(); |
||||
|
||||
let dirErrors = []; let fileErrors = []; //collect error objects to output them all at the end
|
||||
let readDirs = []; //list of dirs to print at the end
|
||||
let totalEvents = 0; |
||||
client.log('Loading events...', {source: 'boot', color: 'blue'}, 0, 1); |
||||
const readDir = dir => { |
||||
let dirRead; |
||||
try {dirRead = fs.readdirSync(dir);} |
||||
catch (e) { |
||||
client.error(`Failed to read directory ${chalk.white(dir)}`); |
||||
return dirErrors.push([`Unable to read directory ${chalk.white(dir)}. Error:`, e]); |
||||
} |
||||
let files = dirRead.filter(item => item.endsWith('.js')); |
||||
let folders = dirRead.filter(item => fs.lstatSync(`${dir}/${item}`).isDirectory()); |
||||
files.forEach(file => { |
||||
try { |
||||
const event = require(`../../../../${dir.slice(2)}/${file}`); |
||||
const eventName = file.split('.')[0]; |
||||
client.removeAllListeners(eventName); |
||||
client.on(eventName, event.bind(null, client)); |
||||
client.log(`Loaded event ${chalk.white(eventName)}`, {color: 'blueBright', source: 'boot', sourceColor: 'blue'}); |
||||
} |
||||
catch (e) { |
||||
client.error(`Failed to read file ${chalk.white(file)}`); |
||||
return fileErrors.push([`Unable to read file ${chalk.white(file)}. Error:`, e]); |
||||
} |
||||
}); |
||||
readDirs.push(`${dir.split('/').slice(4).join('/')}/`); // "events/..."
|
||||
return folders.forEach(folder => readDir(`${dir}/${folder}`)); //recurse infinitely
|
||||
}; |
||||
readDir(eventsDirName); |
||||
console.log(""); |
||||
dirErrors.forEach(error => client.error(error[0], 0, 0, 1, error[1])); |
||||
fileErrors.forEach(error => client.error(error[0], 0, 0, 1, error[1])); |
||||
readDirs.forEach(dir => client.log(`Read from directory ${chalk.green(dir)}`, {source: 'proc'})); |
||||
client.log(`Loaded ${chalk.white(totalEvents)} event${client.utils.s(totalEvents)}!`, {color: 'blue', source: 'boot'}, 1, 1); |
||||
}; |
@ -1,8 +1,8 @@ |
||||
const {Collection} = require("discord.js"); |
||||
|
||||
module.exports = async client => { |
||||
['commands', 'events'].forEach(x => { |
||||
client[x] = new Collection(); |
||||
require(`../collect/${x}`)(client); |
||||
}); |
||||
const {Collection} = require("discord.js"); |
||||
|
||||
module.exports = async client => { |
||||
['commands', 'events'].forEach(x => { |
||||
client[x] = new Collection(); |
||||
require(`../collect/${x}`)(client); |
||||
}); |
||||
}; |
@ -1,20 +1,20 @@ |
||||
const chalk = require('chalk'); |
||||
|
||||
const {Tag, TagFilter} = require('../../../util/ts/tagfilter'); |
||||
|
||||
module.exports = client => { |
||||
const options = new TagFilter([ |
||||
new Tag(['dev', 'd', 'developer', 'test'], 'dev', 'toggle'), |
||||
new Tag(['prefix', 'devprefix', 'p'], 'prefix', 'append') |
||||
]).test(process.argv.slice(2).join(" ")); |
||||
client.config.options = {}; |
||||
|
||||
if (Object.keys(options).length) { //log and set options
|
||||
client.log(`${chalk.gray.bold("Arguments detected.")}`, {source: 'args'}, 0, 1); |
||||
Object.keys(options).forEach(arg => { |
||||
client.config.options[arg] = options[arg]; |
||||
client.log(`${chalk.gray.bold(arg)}${chalk.gray(':')} ${chalk.blue(options[arg])}`, {source: 'args'}); |
||||
}); |
||||
console.log(''); |
||||
} |
||||
const chalk = require('chalk'); |
||||
|
||||
const {Tag, TagFilter} = require('../../../util/ts/tagfilter'); |
||||
|
||||
module.exports = client => { |
||||
const options = new TagFilter([ |
||||
new Tag(['dev', 'd', 'developer', 'test'], 'dev', 'toggle'), |
||||
new Tag(['prefix', 'devprefix', 'p'], 'prefix', 'append') |
||||
]).test(process.argv.slice(2).join(" ")); |
||||
client.config.options = {}; |
||||
|
||||
if (Object.keys(options).length) { //log and set options
|
||||
client.log(`${chalk.gray.bold("Arguments detected.")}`, {source: 'args'}, 0, 1); |
||||
Object.keys(options).forEach(arg => { |
||||
client.config.options[arg] = options[arg]; |
||||
client.log(`${chalk.gray.bold(arg)}${chalk.gray(':')} ${chalk.blue(options[arg])}`, {source: 'args'}); |
||||
}); |
||||
console.log(''); |
||||
} |
||||
}; |
@ -1,12 +1,12 @@ |
||||
const moment = require("moment"); |
||||
const chalk = require('chalk'); |
||||
const os = require('os'); |
||||
const gs = require('gradient-string'); |
||||
|
||||
module.exports = client => { |
||||
client.log(`Logged in as ${gs.instagram(client.user.username)}. ${chalk.greenBright(`[${chalk.grey(client.user.id)}]`)}`); |
||||
client.log(`Time: ${chalk.blueBright(moment().format('MMMM d, YYYY - HH:MM:SS'))}`); |
||||
client.log(`This ${chalk.blue('heap')} has ${chalk.blueBright((process.memoryUsage().heapTotal / (1024 ** 2)).toFixed(2))}MB allocated; The ${chalk.blue('machine')} has ${chalk.blueBright((os.totalmem() / (1024 ** 3)).toFixed(2))}GB (${chalk.blueBright((os.freemem() / (1024 ** 3)).toFixed(2))}GB free)`); |
||||
client.log(`Running on ${chalk.blueBright(client.guilds.cache.size)} ${chalk.blue("servers")} and interacting with about ${chalk.blueBright(client.users.cache.size)} ${chalk.blue("users")}.`); |
||||
client.log(`Listening for prefix ${chalk.greenBright(client.basePrefix)} || ${chalk.greenBright(`${client.basePrefix}help`)} to get started!`); |
||||
const moment = require("moment"); |
||||
const chalk = require('chalk'); |
||||
const os = require('os'); |
||||
const gs = require('gradient-string'); |
||||
|
||||
module.exports = client => { |
||||
client.log(`Logged in as ${gs.instagram(client.user.username)}. ${chalk.greenBright(`[${chalk.grey(client.user.id)}]`)}`); |
||||
client.log(`Time: ${chalk.blueBright(moment().format('MMMM d, YYYY - HH:MM:SS'))}`); |
||||
client.log(`This ${chalk.blue('heap')} has ${chalk.blueBright((process.memoryUsage().heapTotal / (1024 ** 2)).toFixed(2))}MB allocated; The ${chalk.blue('machine')} has ${chalk.blueBright((os.totalmem() / (1024 ** 3)).toFixed(2))}GB (${chalk.blueBright((os.freemem() / (1024 ** 3)).toFixed(2))}GB free)`); |
||||
client.log(`Running on ${chalk.blueBright(client.guilds.cache.size)} ${chalk.blue("servers")} and interacting with about ${chalk.blueBright(client.users.cache.size)} ${chalk.blue("users")}.`); |
||||
client.log(`Listening for prefix ${chalk.greenBright(client.basePrefix)} || ${chalk.greenBright(`${client.basePrefix}help`)} to get started!`); |
||||
}; |
@ -1,21 +1,21 @@ |
||||
const chalk = require('chalk'); |
||||
|
||||
const ora = require('../../../util/log/ora'); |
||||
|
||||
module.exports = async (client) => { |
||||
const t = Date.now(); |
||||
client.misc = {}; |
||||
client.misc.dscconnected = true; |
||||
|
||||
await ora(`Waking up Natsuki... ${chalk.blueBright.bold.underline("(Connecting to Discord...)")}`, |
||||
client.login(client.auth.token) |
||||
).catch((e) => { |
||||
client.error("Failed to connect to Discord!! Error below.", 0, 0, true, e); |
||||
client.misc.dscconnected = false; |
||||
}); |
||||
if (!client.misc.dscconnected) { |
||||
client.warn("Discord not connected, considering runtime to be unusable and exiting.", 0, true, true); |
||||
throw new Error(); |
||||
} |
||||
return client.success(`Connected to Discord in ${chalk.white(`${Date.now() - t}ms`)}.`, 0, 0, 1); |
||||
}; |
||||
const chalk = require('chalk'); |
||||
|
||||
const ora = require('../../../util/log/ora'); |
||||
|
||||
module.exports = async (client) => { |
||||
const t = Date.now(); |
||||
client.misc = {}; |
||||
client.misc.dscconnected = true; |
||||
|
||||
await ora(`Waking up Natsuki... ${chalk.blueBright.bold.underline("(Connecting to Discord...)")}`, |
||||
client.login(client.auth.token) |
||||
).catch((e) => { |
||||
client.error("Failed to connect to Discord!! Error below.", 0, 0, true, e); |
||||
client.misc.dscconnected = false; |
||||
}); |
||||
if (!client.misc.dscconnected) { |
||||
client.warn("Discord not connected, considering runtime to be unusable and exiting.", 0, true, true); |
||||
throw new Error(); |
||||
} |
||||
return client.success(`Connected to Discord in ${chalk.white(`${Date.now() - t}ms`)}.`, 0, 0, 1); |
||||
}; |
@ -1,42 +1,42 @@ |
||||
module.exports = client => { |
||||
const prefix = client.basePrefix; |
||||
const statuses = { |
||||
"PLAYING": [ |
||||
`with my darling`, 'RAIN: Shadow Lords', "with my waifu", "with the neko formula", |
||||
"with magic", "terrible anime games", "anime OSTs at max volume", |
||||
`${Math.ceil(Math.random() * 100)} days of trying to become a samurai`, |
||||
"with the sauce", "witch hats are >", "explosion magic is the best magic", |
||||
"with Kazuma's sanity", "please help i gave myself cat ears", |
||||
"starting my own harem", "wor. wor never changes", "a little more UwU than necessary", |
||||
"please i just want a cat girl in my life", "i'm your waifu now.", |
||||
"i'm in intervention for my neko addiction", "i tried to make a catgirl and broke my staff", |
||||
"fluffy tails = drugs", "in a dungeon without wearing my plot armor", |
||||
"benefits of Natsuki worship: my beautiful face" |
||||
,`in ${client.guilds.cache.size} servers` |
||||
], |
||||
"WATCHING": [ |
||||
`for ${client.commands.size} commands`, |
||||
"I'm not a bad slime, slurp!", "Lelouch rule the world!", |
||||
"a slime somehow start an empire", "a fox-maid get her tail fluffed", |
||||
"a raccoon-girl and some guy with a shield", "some chick with unusually red hair", |
||||
"Mob hit 100", "a really bad harem anime", "The Black Swordsman", |
||||
"The Misfit of Demon King Academy", "Akame ga Kill", "a witch explode a castle", |
||||
"Code Geass", "\"did you really think ___ would be enough to kill me?\"", |
||||
"hentacle tentai", "JIBUN WO-", "he did it... he actually made risotto", |
||||
"sasageyo, sasageyo, chi nto wo sasegeyo", "scientists make nekos real :3", |
||||
"yet another isekai don't @ me", "magical girl anime", "episode 1 of One Piece.. pain.", |
||||
"a white-haired dude and a goddess with some MELONS" |
||||
,`over ${client.guilds.cache.size} servers` |
||||
] |
||||
}; |
||||
|
||||
try {if (client.misc.statusTimeout) {clearTimeout(client.misc.statusTimeout)};} catch {} |
||||
|
||||
const setStatus = () => { |
||||
let type = Object.keys(statuses)[Math.floor(Math.random() * Object.keys(statuses).length)]; |
||||
if (type === "PLAYING") {client.user.setActivity(statuses[type][Math.floor(Math.random() * statuses[type].length)] + " | " + prefix + "help");} |
||||
else {client.user.setActivity(statuses[type][Math.floor(Math.random() * statuses[type].length)] + " | " + prefix + "help", {type: type});} |
||||
}; |
||||
setStatus(); |
||||
client.misc.statusTimeout = setTimeout(setStatus, 14400000); |
||||
module.exports = client => { |
||||
const prefix = client.basePrefix; |
||||
const statuses = { |
||||
"PLAYING": [ |
||||
`with my darling`, 'RAIN: Shadow Lords', "with my waifu", "with the neko formula", |
||||
"with magic", "terrible anime games", "anime OSTs at max volume", |
||||
`${Math.ceil(Math.random() * 100)} days of trying to become a samurai`, |
||||
"with the sauce", "witch hats are >", "explosion magic is the best magic", |
||||
"with Kazuma's sanity", "please help i gave myself cat ears", |
||||
"starting my own harem", "wor. wor never changes", "a little more UwU than necessary", |
||||
"please i just want a cat girl in my life", "i'm your waifu now.", |
||||
"i'm in intervention for my neko addiction", "i tried to make a catgirl and broke my staff", |
||||
"fluffy tails = drugs", "in a dungeon without wearing my plot armor", |
||||
"benefits of Natsuki worship: my beautiful face" |
||||
,`in ${client.guilds.cache.size} servers` |
||||
], |
||||
"WATCHING": [ |
||||
`for ${client.commands.size} commands`, |
||||
"I'm not a bad slime, slurp!", "Lelouch rule the world!", |
||||
"a slime somehow start an empire", "a fox-maid get her tail fluffed", |
||||
"a raccoon-girl and some guy with a shield", "some chick with unusually red hair", |
||||
"Mob hit 100", "a really bad harem anime", "The Black Swordsman", |
||||
"The Misfit of Demon King Academy", "Akame ga Kill", "a witch explode a castle", |
||||
"Code Geass", "\"did you really think ___ would be enough to kill me?\"", |
||||
"hentacle tentai", "JIBUN WO-", "he did it... he actually made risotto", |
||||
"sasageyo, sasageyo, chi nto wo sasegeyo", "scientists make nekos real :3", |
||||
"yet another isekai don't @ me", "magical girl anime", "episode 1 of One Piece.. pain.", |
||||
"a white-haired dude and a goddess with some MELONS" |
||||
,`over ${client.guilds.cache.size} servers` |
||||
] |
||||
}; |
||||
|
||||
try {if (client.misc.statusTimeout) {clearTimeout(client.misc.statusTimeout)};} catch {} |
||||
|
||||
const setStatus = () => { |
||||
let type = Object.keys(statuses)[Math.floor(Math.random() * Object.keys(statuses).length)]; |
||||
if (type === "PLAYING") {client.user.setActivity(statuses[type][Math.floor(Math.random() * statuses[type].length)] + " | " + prefix + "help");} |
||||
else {client.user.setActivity(statuses[type][Math.floor(Math.random() * statuses[type].length)] + " | " + prefix + "help", {type: type});} |
||||
}; |
||||
setStatus(); |
||||
client.misc.statusTimeout = setTimeout(setStatus, 14400000); |
||||
}; |
Loading…
Reference in new issue