Migrate bot-token and ownerid to dotenv
This commit is contained in:
parent
0f78055a66
commit
cb1eb0a5bd
|
@ -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!
|
|
@ -21,7 +21,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
|
|
||||||
handle (client, config, user, code) {
|
handle (client, config, user, code) {
|
||||||
if (user.id === config.ownerID) {
|
if (user.id === process.env.OWNERID) {
|
||||||
try {
|
try {
|
||||||
const evaled = inspect(eval(code));
|
const evaled = inspect(eval(code));
|
||||||
// await message.channel.send(evaled, { code: 'xl' });
|
// await message.channel.send(evaled, { code: 'xl' });
|
||||||
|
|
|
@ -32,7 +32,7 @@ module.exports = {
|
||||||
{ name: '<:anitrox:831193012699791361> Bot Information', value: '** **' },
|
{ name: '<:anitrox:831193012699791361> Bot Information', value: '** **' },
|
||||||
{ name: 'Bot Name', value: `${client.user.tag}`, inline: true },
|
{ name: 'Bot Name', value: `${client.user.tag}`, inline: true },
|
||||||
{ name: 'Bot ID', value: `${client.user.id}`, inline: true },
|
{ name: 'Bot ID', value: `${client.user.id}`, inline: true },
|
||||||
{ name: 'Bot Owner', value: isNaN(config.ownerID) ? "Owner didn't set an OwnerID :(" : client.users.cache.get(config.ownerID).username, 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: 'Release Type', value: config.release, inline: true },
|
||||||
{ name: 'Version', value: config.build, inline: true },
|
{ name: 'Version', value: config.build, inline: true },
|
||||||
{ name: ':gear: Bot Process Information', value: '** **' },
|
{ name: ':gear: Bot Process Information', value: '** **' },
|
||||||
|
|
|
@ -5,7 +5,7 @@ module.exports = {
|
||||||
name: require('path').parse(__filename).name,
|
name: require('path').parse(__filename).name,
|
||||||
description: 'Reloads a command',
|
description: 'Reloads a command',
|
||||||
options: [...Array(10).keys()].map(i => ({
|
options: [...Array(10).keys()].map(i => ({
|
||||||
name: `option${i + 1}`,
|
name: `option${i + 0}`,
|
||||||
description: 'Another option',
|
description: 'Another option',
|
||||||
required: i === 0,
|
required: i === 0,
|
||||||
type: Constants.ApplicationCommandOptionTypes.STRING
|
type: Constants.ApplicationCommandOptionTypes.STRING
|
||||||
|
@ -20,7 +20,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
|
|
||||||
handle (client, config, user, args) {
|
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());
|
if (!args.length) return client.generateErrorMessage('You forgot to provide anything to reload, you pillock', user.displayAvatarURL());
|
||||||
let returnMessage = '';
|
let returnMessage = '';
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
|
|
||||||
async handle (client, config, user, channel) {
|
async handle (client, config, user, channel) {
|
||||||
if (user.id === config.ownerID) {
|
if (user.id === process.env.OWNERID) {
|
||||||
const embeds = [{
|
const embeds = [{
|
||||||
title: '<a:AnitroxWorking:997565411212144730> Restart Bot',
|
title: '<a:AnitroxWorking:997565411212144730> Restart Bot',
|
||||||
description: 'Restarting Anitrox...',
|
description: 'Restarting Anitrox...',
|
||||||
|
@ -27,11 +27,11 @@ module.exports = {
|
||||||
const response = await channel.send({ embeds });
|
const response = await channel.send({ embeds });
|
||||||
try {
|
try {
|
||||||
client.destroy();
|
client.destroy();
|
||||||
await client.login(config.token);
|
await client.login(process.env.TOKEN);
|
||||||
console.log('[SYSTEM] [INFO] Restarted successfully!');
|
console.log('[SYSTEM] [INFO] Restarted successfully!');
|
||||||
await response.edit({
|
await response.edit({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
title: '<a:AnitroxWorking:997565411212144730> Restart Bot',
|
title: ':white_check_mark: Restart Bot',
|
||||||
description: 'Restarted!',
|
description: 'Restarted!',
|
||||||
color: 9442302,
|
color: 9442302,
|
||||||
footer: {
|
footer: {
|
||||||
|
|
|
@ -13,7 +13,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
|
|
||||||
async handle (client, config, user, channel) {
|
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}`);
|
console.log('[SYSTEM] [INFO] ' + `The bot is going down for shut down. \nShutdown requested by ${user.username}`);
|
||||||
await channel.send({
|
await channel.send({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{
|
||||||
"prefix": "n!",
|
"prefix": "n!",
|
||||||
"token": "IM SO EXCITED ABOUT BURGER",
|
|
||||||
"ownerID": "MY FAVORITE COLOR IS TWELVE",
|
|
||||||
"release": "Stable Release",
|
"release": "Stable Release",
|
||||||
"build": "1.3",
|
"build": "1.3",
|
||||||
"footerTxt": "Anitrox, made with <3 by IDeletedSystem64 | 2018-2022",
|
"footerTxt": "Anitrox, made with <3 by IDeletedSystem64 | 2018-2022",
|
||||||
|
|
7
start.js
7
start.js
|
@ -3,7 +3,7 @@
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const Discord = require('discord.js');
|
const Discord = require('discord.js');
|
||||||
const config = require('./config.json');
|
const config = require('./config.json');
|
||||||
|
require('dotenv').config();
|
||||||
console.log('Starting!');
|
console.log('Starting!');
|
||||||
const client = new Discord.Client({ intents: config.intents.map(intent => eval(`Discord.Intents.FLAGS.${intent}`)) });
|
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}`);
|
const command = require(`./commands/${file}`);
|
||||||
client.commands.set(command.name, command);
|
client.commands.set(command.name, command);
|
||||||
});
|
});
|
||||||
|
// Create a collection using those command files
|
||||||
|
|
||||||
fs.readdirSync('./events')
|
fs.readdirSync('./events')
|
||||||
.filter(file => file.endsWith('.js'))
|
.filter(file => file.endsWith('.js'))
|
||||||
|
@ -21,6 +22,7 @@ fs.readdirSync('./events')
|
||||||
.forEach(({ once, event, listener }) => {
|
.forEach(({ once, event, listener }) => {
|
||||||
client[once ? 'once' : 'on'](event, listener(client, config));
|
client[once ? 'once' : 'on'](event, listener(client, config));
|
||||||
});
|
});
|
||||||
|
// Create listeners from the event files.
|
||||||
|
|
||||||
client.generateErrorMessage = (errorMsg, avatarURL) => ({
|
client.generateErrorMessage = (errorMsg, avatarURL) => ({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
|
@ -39,4 +41,5 @@ client.generateErrorMessage = (errorMsg, avatarURL) => ({
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
|
||||||
client.login(config.token);
|
client.login(process.env.TOKEN);
|
||||||
|
// Login to Discord!
|
||||||
|
|
Reference in New Issue