Update to 1.3 Stable
nice pr Update to Stable 1,3: Eval now has access to Client by default. (This is probably a security mess, oh well. lmao) Move token and ownerID to .env (Make sure to update your configuration when updating!) Refactor the entire help command, It's actually helpful now!: Running help now provides a command list, and running help provides information about the command, as it should've originally. Refactor info command, It now looks nicer both inside and out. Fixed a bug in userinfo where the username in the embed name returned as the User ID Other bug fixes. For developers: Added getTime function, This will allow you to get formatted time. Moved Uptime to its own !!!MAKE SURE TO MOVE YOUR TOKEN AND USERID TO THE NEW .ENV!!!
This commit is contained in:
commit
77acc594b2
19 changed files with 160 additions and 197 deletions
3
.env.example
Normal file
3
.env.example
Normal file
|
@ -0,0 +1,3 @@
|
|||
TOKEN="EVERYTHINGS SO FCKED AND IM TIRED OF BEING SCARED"
|
||||
OWNERID="SO LETS GET OUT AND FCK UP EQUESTRIA"
|
||||
# Do !!NOT!! share this file once filled out with anybody, Doing so can leak your Bot Token which will give anyone access to your bot!
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -2,4 +2,5 @@ node_modules/
|
|||
.vscode
|
||||
package-lock.json
|
||||
releasenotes.txt
|
||||
config.json
|
||||
config.json
|
||||
.env
|
||||
|
|
|
@ -3,11 +3,12 @@
|
|||
This is the stable branch, If you want the prepackaged and prepared builds, you're at the right place.
|
||||
# Dependencies to get started
|
||||
To begin, you will need to satisfy the following dependencies:
|
||||
Node.JS: 14
|
||||
Node.JS: 16
|
||||
npm: 6.14
|
||||
# Let's get this ~~party~~ bot started!
|
||||
For first time start up, You will need to run ``npm install`` to install the needed npm packages.
|
||||
Afterwards fill out the ``config-example.json`` and rename it to ``config.json``, then just run ``node start.js`` (or ``./start.js`` on Linux)!
|
||||
Afterwards fill out the ``.env.example`` and ``config-example.json`` and then rename them to ``.env`` and ``config.json``, then just run ``node start.js`` (or ``./start.js`` on Linux)!
|
||||
<br>
|
||||
⚠️ If you don't specify the Owner ID, Some commands such as the bot controls will be unusable!
|
||||
# Support
|
||||
Anitrox isn't really supported but you can get help from the Discord server if you need any: discord.gg/5nQtMNpf43
|
||||
Support is available on the [Discord Server!](discord.gg/5nQtMNpf43), or @ me on [Twitter!](twitter.com/IDeleteSystem64)
|
||||
|
|
28
commands.md
28
commands.md
|
@ -1,28 +0,0 @@
|
|||
# Anitrox Command List
|
||||
<> = Optionable
|
||||
<br>
|
||||
[] = Required
|
||||
|
||||
|Command|Arguments |Description |
|
||||
|-------|----------|------------|
|
||||
|Help |none |Help? Help!!|
|
||||
|8ball |[Question]|Ask a question, Any question! |
|
||||
|avatar |\<Member\> |Get a users beautiful avatar |
|
||||
|bonk |[Member] | Bonk, no horny. |
|
||||
|cheese |\<Member\>| Cheese.|
|
||||
|cuddle |[Member] | Cuddle someone! |
|
||||
|choose |[Option1] <br> [Option2] <br> [and so on] | Choose from a list of choices, as many as you want!
|
||||
|hug |[Member] | Hug someone! |
|
||||
|info |none | Information about the bot and host.
|
||||
|invite |none | Invite Anitrox to your server!
|
||||
|kiss |[Member] | Kiss someone! |
|
||||
|leskiss|[Member] | Lesbain kiss (Suggested by Emi)
|
||||
|lick |[Member] | Did you just lick me!?
|
||||
|nom |[Member] | Nom someone or something
|
||||
|opensource|none | Source code for Anitrox
|
||||
|pat |[Member] | Pat someone!
|
||||
|ping |none | Ping Elon Musk! or Mars! nah jk, Discord.
|
||||
|poke |[Member] | Poke someone!
|
||||
|slap |[Member] | Slap someone :(
|
||||
|snuggle|[Member] | Snuggle someone!
|
||||
|uinfo |[Member] | Information about an user
|
|
@ -20,8 +20,8 @@ module.exports = {
|
|||
await interaction.reply(this.handle(client, config, interaction.user, interaction.options.getString('code')));
|
||||
},
|
||||
|
||||
handle (_, config, user, code) {
|
||||
if (user.id === config.ownerID) {
|
||||
handle (client, config, user, code) {
|
||||
if (user.id === process.env.OWNERID) {
|
||||
try {
|
||||
const evaled = inspect(eval(code));
|
||||
// await message.channel.send(evaled, { code: 'xl' });
|
||||
|
|
|
@ -1,36 +1,62 @@
|
|||
const { Constants } = require('discord.js');
|
||||
|
||||
module.exports = {
|
||||
|
||||
name: require('path').parse(__filename).name,
|
||||
description: 'Get help on anything from commands, to what the bot does! just not your homework..',
|
||||
options: [],
|
||||
|
||||
async parseMessage (client, config, message) {
|
||||
await message.channel.send(this.handle(client, config, message.author));
|
||||
options: [{
|
||||
name: 'help',
|
||||
description: 'The command you want information on',
|
||||
required: false,
|
||||
type: Constants.ApplicationCommandOptionTypes.STRING
|
||||
}],
|
||||
async parseMessage (client, config, message, args) {
|
||||
await message.channel.send(this.handle(client, config, message.author, args[0]));
|
||||
},
|
||||
|
||||
async parseInteraction (client, config, interaction) {
|
||||
await interaction.reply(this.handle(client, config, interaction.user));
|
||||
await interaction.reply(this.handle(client, config, interaction.user, interaction.options.getString('help')));
|
||||
},
|
||||
|
||||
handle (_, config, user) {
|
||||
handle (client, config, user, command) {
|
||||
if (!command) {
|
||||
return {
|
||||
embeds: [{
|
||||
color: 9442302,
|
||||
title: `:question: SEYMOUR! THE ${client.user.username} IS ON FIRE!`,
|
||||
description: `Run ${config.prefix}help for more information on each command.`,
|
||||
footer: {
|
||||
icon_url: user.displayAvatarURL(),
|
||||
text: config.footerTxt
|
||||
},
|
||||
fields: [
|
||||
{ name: 'Commands', value: client.commands.map(command => command.name).join(', ') }
|
||||
]
|
||||
}]
|
||||
};
|
||||
}
|
||||
|
||||
const cmdName = command;
|
||||
const cmd = client.commands.get(cmdName);
|
||||
console.log(cmd.options.map);
|
||||
if (!cmd) {
|
||||
return client.generateErrorMessage(`${cmdName} is not a valid command. Run ${config.prefix}help for a command list!`);
|
||||
}
|
||||
return {
|
||||
embeds: [{
|
||||
title: 'HELP! SEYMOUR! THE BOT IS ON FIRE!',
|
||||
description: 'Get help on anything from commands, to what the bot does! just not your homework..',
|
||||
color: 9442302,
|
||||
title: ':question: Command Help',
|
||||
description: `Everything you've ever wanted to know about ${cmdName}!`,
|
||||
footer: {
|
||||
icon_url: user.displayAvatarURL(),
|
||||
text: `${config.footerTxt} | No mother it's just the northern lights`
|
||||
text: config.footerTxt
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'Command List',
|
||||
value: '[Click here!](https://github.com/IDeletedSystem64/anitrox/blob/dev/commands.md)'
|
||||
},
|
||||
{
|
||||
name: '...Or is the bot actually on fire?',
|
||||
value: 'Join the [support server!](https://discord.gg/grebRGsBZ3)'
|
||||
}
|
||||
{ name: 'Command Name', value: `${cmdName}`, inline: true },
|
||||
{ name: 'Command Description', value: cmd.description, inline: true },
|
||||
{ name: 'Command Options', value: cmd.options.map(option => option.name).join('\n') || 'None', inline: true },
|
||||
{ name: 'Command Option Description', value: cmd.options.map(option => option.description).join('\n') || 'None', inline: true }
|
||||
// { name: 'Command Option Required?', value: cmd.options.map(option => option.required) ? 'Yes' : 'No' }
|
||||
]
|
||||
}]
|
||||
};
|
||||
|
|
170
commands/info.js
170
commands/info.js
|
@ -1,117 +1,53 @@
|
|||
function Uptime (uptime) {
|
||||
const totalSeconds = (uptime / 1000);
|
||||
|
||||
const days = parseInt(totalSeconds / 86400);
|
||||
const hours = parseInt((totalSeconds % 86400) / 3600);
|
||||
const minutes = parseInt((totalSeconds % 3600) / 60);
|
||||
const seconds = parseInt(totalSeconds % 60);
|
||||
|
||||
const daystring = days + (days === 1 ? ' day' : ' days');
|
||||
const hourstring = hours + (hours === 1 ? ' hour' : ' hours');
|
||||
const minutestring = minutes + (minutes === 1 ? ' minute' : ' minutes');
|
||||
const secondstring = seconds + (seconds === 1 ? ' second' : ' seconds');
|
||||
|
||||
return `${daystring}**, **${hourstring}**, **${minutestring}**, **${secondstring}`;
|
||||
}
|
||||
|
||||
const os = require('os');
|
||||
const osu = require('node-os-utils');
|
||||
const cpu = osu.cpu;
|
||||
|
||||
module.exports = {
|
||||
|
||||
name: require('path').parse(__filename).name,
|
||||
description: 'Shows bot and host information',
|
||||
options: [],
|
||||
|
||||
async parseMessage (client, config, message) {
|
||||
await message.channel.send(this.handle(client, config, message.author));
|
||||
},
|
||||
|
||||
async parseInteraction (client, config, interaction) {
|
||||
await interaction.reply(this.handle(client, config, interaction.user));
|
||||
},
|
||||
|
||||
handle (client, config, user) {
|
||||
return {
|
||||
embeds: [{
|
||||
title: '<:AnitroxInfo:809651936831733791> Information about Anitrox',
|
||||
description: "Everything you've ever wanted to know about your favorite bot, Anitrox!",
|
||||
color: 9442302,
|
||||
footer: {
|
||||
icon_url: user.displayAvatarURL(),
|
||||
text: config.footerTxt
|
||||
},
|
||||
thumbnail: {
|
||||
url: client.user.displayAvatarURL()
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'Bot Information',
|
||||
value: '** **'
|
||||
},
|
||||
{
|
||||
name: 'Release Type',
|
||||
value: config.release,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: 'Release Version',
|
||||
value: config.build,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: 'Uptime',
|
||||
value: Uptime(client.uptime),
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: '<:memory:793536677737136178> Bot Memory Usage',
|
||||
value: `${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} MiB`,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: 'Bot Name',
|
||||
value: client.user.tag,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: 'Bot ID',
|
||||
value: `\`${client.user.id}\``,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: '<:hostinfo:793529505263517747> Host Information',
|
||||
value: '** **'
|
||||
},
|
||||
{
|
||||
name: '<:hostinfo:793529505263517747> Host Uptime',
|
||||
value: Uptime(os.uptime() * 1000)
|
||||
},
|
||||
{
|
||||
name: '<:cpu:793672442056802354> CPU Type',
|
||||
value: `${process.arch}, ${cpu.model()}`
|
||||
},
|
||||
|
||||
{
|
||||
name: '<:hostos:793866961675223090> OS Type',
|
||||
value: `${process.platform} / ${os.version()}`
|
||||
},
|
||||
{
|
||||
name: '<:node:793537507018145813> Node.JS Version',
|
||||
value: process.version
|
||||
},
|
||||
{
|
||||
name: '<:hostinfo:793529505263517747> Bot Ping',
|
||||
value: `${Math.round(client.ws.ping)} ms`,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: '**Special Thanks To**',
|
||||
value: '@OfficialTCGMatt for providing help with development\n @chuu_shi Allowing me to host Anitrox on his server'
|
||||
}
|
||||
]
|
||||
}]
|
||||
};
|
||||
}
|
||||
};
|
||||
const Uptime = require('../functions/uptime.js');
|
||||
const os = require('os');
|
||||
const osu = require('node-os-utils');
|
||||
module.exports = {
|
||||
name: 'info',
|
||||
description: 'Bot and System information',
|
||||
options: [],
|
||||
|
||||
async parseMessage (client, config, message) {
|
||||
await message.channel.send(this.handle(client, config, message.author));
|
||||
},
|
||||
// We'll be moving solely to Slash Commands in 1.4
|
||||
|
||||
async parseInteraction (client, config, interaction) {
|
||||
await interaction.reply(this.handle(client, config, interaction.user));
|
||||
},
|
||||
|
||||
handle (client, config, user) {
|
||||
return {
|
||||
embeds: [{
|
||||
title: `<:AnitroxInfo:809651936831733791> Information about ${client.user.username}`,
|
||||
description: `Everything you've ever wanted to know about your favorite bot, ${client.user.username}!`,
|
||||
color: 9442302,
|
||||
footer: {
|
||||
icon_url: user.displayAvatarURL(),
|
||||
text: config.footerTxt
|
||||
},
|
||||
thumbnail: {
|
||||
url: client.user.displayAvatarURL()
|
||||
},
|
||||
fields: [
|
||||
{ name: '<:anitrox:831193012699791361> Bot Information', value: '** **' },
|
||||
{ name: 'Bot Name', value: `${client.user.tag}`, inline: true },
|
||||
{ name: 'Bot ID', value: `${client.user.id}`, inline: true },
|
||||
{ name: 'Bot Owner', value: isNaN(process.env.OWNERID) ? "Owner didn't set an OwnerID :(" : client.users.cache.get(process.env.OWNERID).username, inline: true },
|
||||
{ name: 'Release Type', value: config.release, inline: true },
|
||||
{ name: 'Version', value: config.build, inline: true },
|
||||
{ name: ':gear: Bot Process Information', value: '** **' },
|
||||
{ name: '<:memory:997565609179107369> Bot Memory Usage', value: `${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} MiB`, inline: true },
|
||||
{ name: ':timer: Bot Uptime', value: Uptime(client.uptime), inline: true },
|
||||
{ name: ':one: Total Servers', value: `** **${client.guilds.cache.size}`, inline: true },
|
||||
{ name: '<:hostinfo:997565639352926250> System Information', value: '** **' },
|
||||
{ name: `${((process.platform === 'linux') ? '<:linux_tux:997565742960615424>' : '<:windows:997919047511453696>')} System Platform`, value: process.platform, inline: true },
|
||||
{ name: `${((process.platform === 'linux') ? ':gear: Kernel Version' : ':gear: System Version')}`, value: os.release(), inline: true },
|
||||
{ name: ':timer: System Uptime', value: Uptime(os.uptime() * 1000), inline: true },
|
||||
{ name: '<:cpu:997565592028598282> System CPU Architecture', value: os.arch(), inline: true },
|
||||
{ name: '<:cpu:997565592028598282> System CPU Model', value: osu.cpu.model(), inline: true },
|
||||
{ name: '<:nodejs:998609124453531740> Node.js Version', value: process.version, inline: true }
|
||||
]
|
||||
}]
|
||||
};
|
||||
}
|
||||
};
|
||||
|
|
|
@ -26,18 +26,10 @@ module.exports = {
|
|||
url: 'https://cdn.discordapp.com/attachments/803658122299572255/814352905394061322/anitroxaddsrvr.png'
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'Anitrox',
|
||||
value: 'Get the ripe off the vine Anitrox! \n [Add Anitrox to your server](https://discord.com/oauth2/authorize?client_id=576805923964715018&scope=bot&permissions=8)'
|
||||
},
|
||||
{
|
||||
name: 'Anitrox PTB (Public Test Build)',
|
||||
value: 'So you want the fresh and hot builds straight from the oven? We gotchu \n [Add Anitrox PTB to your server](https://discord.com/oauth2/authorize?client_id=489125054261755925&scope=bot&permissions=66186303)'
|
||||
},
|
||||
{
|
||||
name: 'Need help?',
|
||||
value: 'Come join the Anitrox Support Server, for support and much more!\n [Anitrox Support Server](https://discord.gg/grebRGsBZ3)'
|
||||
}
|
||||
{ name: 'Anitrox', value: 'Get the ripe off the vine Anitrox! \n [Add Anitrox to your server](https://discord.com/oauth2/authorize?client_id=576805923964715018&scope=bot&permissions=8)' },
|
||||
{ name: 'Anitrox PTB (Public Test Build)', value: 'So you want the fresh and hot builds straight from the oven? We gotchu \n [Add Anitrox PTB to your server](https://discord.com/oauth2/authorize?client_id=489125054261755925&scope=bot&permissions=66186303)' },
|
||||
{ name: 'Anitrox Dev, Self hosting and more!', value: 'Self-host your own Anitrox (including dev!), Contribute, and more! The possibilites are endless. [Anitrox Source](https://github.com/IDeletedSystem64/anitrox)' },
|
||||
{ name: 'Need help?', value: 'Come join the Anitrox Support Server, for support and much more!\n [Anitrox Support Server](https://discord.gg/grebRGsBZ3)' }
|
||||
]
|
||||
}]
|
||||
};
|
||||
|
|
|
@ -5,7 +5,7 @@ module.exports = {
|
|||
name: require('path').parse(__filename).name,
|
||||
description: 'Reloads a command',
|
||||
options: [...Array(10).keys()].map(i => ({
|
||||
name: `option${i + 1}`,
|
||||
name: `option${i + 0}`,
|
||||
description: 'Another option',
|
||||
required: i === 0,
|
||||
type: Constants.ApplicationCommandOptionTypes.STRING
|
||||
|
@ -20,7 +20,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
handle (client, config, user, args) {
|
||||
if (user.id === config.ownerID) {
|
||||
if (user.id === process.env.OWNERID) {
|
||||
if (!args.length) return client.generateErrorMessage('You forgot to provide anything to reload, you pillock', user.displayAvatarURL());
|
||||
let returnMessage = '';
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@ module.exports = {
|
|||
},
|
||||
|
||||
async handle (client, config, user, channel) {
|
||||
if (user.id === config.ownerID) {
|
||||
if (user.id === process.env.OWNERID) {
|
||||
const embeds = [{
|
||||
title: '<a:AnitroxWorking:697147309531594843> Restart Bot',
|
||||
title: '<a:AnitroxWorking:997565411212144730> Restart Bot',
|
||||
description: 'Restarting Anitrox...',
|
||||
color: 9442302,
|
||||
footer: {
|
||||
|
@ -27,11 +27,11 @@ module.exports = {
|
|||
const response = await channel.send({ embeds });
|
||||
try {
|
||||
client.destroy();
|
||||
await client.login(config.token);
|
||||
await client.login(process.env.TOKEN);
|
||||
console.log('[SYSTEM] [INFO] Restarted successfully!');
|
||||
await response.edit({
|
||||
embeds: [{
|
||||
title: '<a:AnitroxWorking:697147309531594843> Restart Bot',
|
||||
title: ':white_check_mark: Restart Bot',
|
||||
description: 'Restarted!',
|
||||
color: 9442302,
|
||||
footer: {
|
||||
|
|
|
@ -13,12 +13,12 @@ module.exports = {
|
|||
},
|
||||
|
||||
async handle (client, config, user, channel) {
|
||||
if (user.id === config.ownerID) {
|
||||
if (user.id === process.env.OWNERID) {
|
||||
console.log('[SYSTEM] [INFO] ' + `The bot is going down for shut down. \nShutdown requested by ${user.username}`);
|
||||
await channel.send({
|
||||
embeds: [{
|
||||
title: '**Shut down the bot**',
|
||||
description: ':AnitroxWorking: **Shutting Down...**',
|
||||
description: '<a:AnitroxWorking:997565411212144730> **Shutting Down...**',
|
||||
color: 9442302,
|
||||
footer: {
|
||||
icon_url: user.displayAvatarURL(),
|
||||
|
|
|
@ -24,7 +24,7 @@ module.exports = {
|
|||
handle (client, config, user, target) {
|
||||
return {
|
||||
embeds: [{
|
||||
title: `Everything you've ever wanted to know about ${target}!`,
|
||||
title: `Everything you've ever wanted to know about ${target.user.username}!`,
|
||||
color: 9442302,
|
||||
footer: {
|
||||
icon_url: user.displayAvatarURL(),
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
{
|
||||
"prefix": "n!",
|
||||
"token": "IM SO EXCITED ABOUT BURGER",
|
||||
"ownerID": "MY FAVORITE COLOR IS TWELVE",
|
||||
"release": "Stable Release",
|
||||
"build": "1.2.2",
|
||||
"build": "1.3",
|
||||
"footerTxt": "Anitrox, made with <3 by IDeletedSystem64 | 2018-2022",
|
||||
"sandbox": {
|
||||
"enabled": false,
|
||||
|
@ -37,8 +35,15 @@
|
|||
"127.0.0.1",
|
||||
"Sophie's computer",
|
||||
"Mars",
|
||||
"Elon Musk",
|
||||
"TMC Software"
|
||||
"Netro Corporation",
|
||||
"System64 Technologies",
|
||||
"myself",
|
||||
"Twilight Sparkle",
|
||||
"the Pokemon Center",
|
||||
"Who asked?",
|
||||
"you",
|
||||
"your mother"
|
||||
|
||||
],
|
||||
"answers": [
|
||||
"Heck no!",
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
|
|
@ -46,6 +46,7 @@ module.exports = {
|
|||
console.log(' / /| | / __ \\/ / __/ ___/ __ \\| |/_/');
|
||||
console.log(' / ___ |/ / / / / /_/ / / /_/ /> < ');
|
||||
console.log('/_/ |_/_/ /_/_/\\__/_/ \\____/_/|_| ');
|
||||
console.log('');
|
||||
console.log(`${config.release}, ${config.build}`);
|
||||
console.log('Bot online. | Anitrox by IDeletedSystem64 | ALL MY CODE KEEPS BLOWING UP!');
|
||||
// Statuses
|
||||
|
|
7
functions/getTime.js
Normal file
7
functions/getTime.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
module.exports = () => {
|
||||
const date = new Date();
|
||||
const timeDate = date.toLocaleDateString();
|
||||
const time = date.toLocaleTimeString();
|
||||
|
||||
return ` ${time} | ${timeDate} `;
|
||||
};
|
15
functions/uptime.js
Normal file
15
functions/uptime.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
module.exports = (uptime) => {
|
||||
const tSeconds = (uptime / 1000);
|
||||
|
||||
const tDays = parseInt(tSeconds / 86400);
|
||||
const tHrs = parseInt((tSeconds % 86400) / 3600);
|
||||
const tMins = parseInt((tSeconds % 3600) / 60);
|
||||
const tSecs = parseInt(tSeconds % 60);
|
||||
|
||||
const days = tDays + (tDays === 1 ? ' day' : ' days');
|
||||
const hours = tHrs + (tHrs === 1 ? ' hour' : ' hours');
|
||||
const minutes = tMins + (tMins === 1 ? ' minute' : ' minutes');
|
||||
const seconds = tSecs + (tSecs === 1 ? ' second' : ' seconds');
|
||||
|
||||
return `${days}, ${hours}, ${minutes}, ${seconds}`;
|
||||
};
|
|
@ -5,6 +5,8 @@
|
|||
"main": "start.js",
|
||||
"dependencies": {
|
||||
"discord.js": "^13.6.0",
|
||||
"dotenv": "^16.0.1",
|
||||
"node-fetch": "^3.2.9",
|
||||
"node-os-utils": "^1.3.2",
|
||||
"require-all": "^3.0.0"
|
||||
},
|
||||
|
|
7
start.js
7
start.js
|
@ -3,7 +3,7 @@
|
|||
const fs = require('fs');
|
||||
const Discord = require('discord.js');
|
||||
const config = require('./config.json');
|
||||
|
||||
require('dotenv').config();
|
||||
console.log('Starting!');
|
||||
const client = new Discord.Client({ intents: config.intents.map(intent => eval(`Discord.Intents.FLAGS.${intent}`)) });
|
||||
|
||||
|
@ -14,6 +14,7 @@ fs.readdirSync('./commands')
|
|||
const command = require(`./commands/${file}`);
|
||||
client.commands.set(command.name, command);
|
||||
});
|
||||
// Create a collection using those command files
|
||||
|
||||
fs.readdirSync('./events')
|
||||
.filter(file => file.endsWith('.js'))
|
||||
|
@ -21,6 +22,7 @@ fs.readdirSync('./events')
|
|||
.forEach(({ once, event, listener }) => {
|
||||
client[once ? 'once' : 'on'](event, listener(client, config));
|
||||
});
|
||||
// Create listeners from the event files.
|
||||
|
||||
client.generateErrorMessage = (errorMsg, avatarURL) => ({
|
||||
embeds: [{
|
||||
|
@ -39,4 +41,5 @@ client.generateErrorMessage = (errorMsg, avatarURL) => ({
|
|||
}]
|
||||
});
|
||||
|
||||
client.login(config.token);
|
||||
client.login(process.env.TOKEN);
|
||||
// Login to Discord!
|
||||
|
|
Reference in a new issue