@conflict/beta
Advanced tools
Comparing version 0.6.0 to 0.7.0
14
bot.js
@@ -57,2 +57,11 @@ import Discord, { | ||
let { token, intents, errorHandler, plugins } = config.default; | ||
if (!token) token = process.env.TOKEN ?? process.env.token; | ||
if (!token) { | ||
try { | ||
token = fs.readFileSync(process.cwd() + '/token', 'utf8'); | ||
} catch (err) { | ||
stump.error(new Error('Missing token. No token found in config file, token file, or env variable.')); | ||
process.exit(1); | ||
} | ||
} | ||
if (!plugins) plugins = []; | ||
@@ -329,3 +338,6 @@ | ||
await initEvents(); | ||
for (const plugin of plugins) { | ||
for (let plugin of plugins) { | ||
if (typeof plugin === "string") plugin = (await plugin()).default; | ||
if (plugin instanceof Promise) plugin = await plugin; | ||
if (plugin && plugin.default && plugin.default instanceof Function) plugin = plugin.default; | ||
plugin({ | ||
@@ -332,0 +344,0 @@ stump, |
@@ -5,2 +5,3 @@ import { ShardingManager } from 'discord.js'; | ||
import path from 'path'; | ||
import fs from 'fs'; | ||
import chokidar from 'chokidar'; | ||
@@ -12,3 +13,3 @@ import { dirname } from "esm-dirname"; | ||
return new Promise((resolve, reject) => { | ||
exec('npx babel bot --out-dir .conflict/build', { cwd: process.cwd() }, (error, stdout, stderr) => { | ||
exec('npx babel bot --out-dir .conflict/build --config-file ' + path.join(__dirname, '..', 'babel.config.js'), { cwd: process.cwd() }, (error, stdout, stderr) => { | ||
if (error) return reject(error); | ||
@@ -38,3 +39,12 @@ resolve({ stdout, stderr }); | ||
const { token } = config.default; | ||
let { token } = config.default; | ||
if (!token) token = process.env.TOKEN ?? process.env.token; | ||
if (!token) { | ||
try { | ||
token = fs.readFileSync(process.cwd() + '/token', 'utf8'); | ||
} catch (err) { | ||
stump.error(new Error('Missing token. No token found in config file, token file, or env variable.')); | ||
process.exit(1); | ||
} | ||
} | ||
@@ -41,0 +51,0 @@ const manager = new ShardingManager(path.join(__dirname, '..', 'bot.js'), { token: token }); |
14
ep.js
@@ -6,2 +6,3 @@ #!/usr/bin/env node | ||
import path from 'path' | ||
import fs from 'fs' | ||
import { exec } from 'child_process' | ||
@@ -22,3 +23,3 @@ const __dirname = dirname(import.meta); | ||
stump.info('Starting build...'); | ||
exec('npx babel bot --out-dir .conflict/build', { cwd: process.cwd() }, (error, stdout, stderr) => { | ||
exec('npx babel bot --out-dir .conflict/build --config-file ' + path.join(__dirname, 'babel.config.js'), { cwd: process.cwd() }, (error, stdout, stderr) => { | ||
if (error) return stump.error(error); | ||
@@ -41,3 +42,12 @@ stdout.trim().split('\n').filter(line => line).forEach(line => stump.info(line)); | ||
} | ||
const { token } = config.default; | ||
let { token } = config.default; | ||
if (!token) token = process.env.TOKEN ?? process.env.token; | ||
if (!token) { | ||
try { | ||
token = fs.readFileSync(process.cwd() + '/token', 'utf8'); | ||
} catch (err) { | ||
stump.error(new Error('Missing token. No token found in config file, token file, or env variable.')); | ||
process.exit(1); | ||
} | ||
} | ||
@@ -44,0 +54,0 @@ const manager = new ShardingManager(path.join(__dirname, 'bot.js'), { token: token }); |
{ | ||
"name": "@conflict/beta", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"description": "The first and only UI framework for Discord bots", | ||
@@ -48,3 +48,5 @@ "main": "exports.js", | ||
"./Components": "./components.js", | ||
"./babel-plugin": "./babel.js" | ||
"./babel-plugin": "./babel.js", | ||
"./global-ratelimit-plugin": "./plugins/global-ratelimit.js", | ||
"./plugins": "./plugins" | ||
}, | ||
@@ -51,0 +53,0 @@ "devDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70495
38
1928
15