Updated packages, take advantage of new eris-fleet features, fixed issue where messages wouldn't send

This commit is contained in:
Essem 2021-11-12 17:21:43 -06:00
parent 8431a3ab95
commit 536b931ead
No known key found for this signature in database
GPG Key ID: 7D497397CC3A2A8C
8 changed files with 465 additions and 558 deletions

View File

@ -5,7 +5,7 @@
# Put environment type here (development, staging, or production)
NODE_ENV=development
# Put Discord token here
# Put Discord bot token here, you can get it from https://discord.com/developers/applications
TOKEN=
# Put the database connection URL here

13
app.js
View File

@ -9,9 +9,11 @@ config();
// main sharding manager
import { Fleet } from "eris-fleet";
import { isMaster } from "cluster";
// main services
import Shard from "./shard.js";
import ImageWorker from "./utils/services/image.js";
import PrometheusWorker from "./utils/services/prometheus.js";
// some utils
import { join, dirname } from "path";
import { fileURLToPath } from "url";
import { readFileSync } from "fs";
import winston from "winston";
import { exec as baseExec } from "child_process";
@ -50,8 +52,9 @@ esmBot ${esmBotVersion} (${(await exec("git rev-parse HEAD").catch(() => {})).st
}
const Admiral = new Fleet({
path: join(dirname(fileURLToPath(import.meta.url)), "./shard.js"),
BotWorker: Shard,
token: `Bot ${process.env.TOKEN}`,
fetchTimeout: 900000,
startingStatus: {
status: "idle",
game: {
@ -101,8 +104,8 @@ const Admiral = new Fleet({
}
},
services: [
{ name: "prometheus", path: join(dirname(fileURLToPath(import.meta.url)), "./utils/services/prometheus.js") },
{ name: "image", path: join(dirname(fileURLToPath(import.meta.url)), "./utils/services/image.js") }
{ name: "prometheus", ServiceWorker: PrometheusWorker },
{ name: "image", ServiceWorker: ImageWorker }
]
});

View File

@ -11,7 +11,7 @@ class SoundReloadCommand extends Command {
this.ipc.register("soundReloadSuccess", (msg) => {
this.ipc.unregister("soundReloadSuccess");
this.ipc.unregister("soundReloadFail");
resolve(`Successfully connected to ${msg.msg.length} Lavalink node(s).`);
resolve(`Successfully connected to ${msg.length} Lavalink node(s).`);
});
this.ipc.register("soundReloadFail", () => {
this.ipc.unregister("soundReloadSuccess");

View File

@ -110,7 +110,7 @@ export default async (client, cluster, worker, ipc, message) => {
await client.createMessage(message.channel.id, Object.assign({
content: result
}, reference));
} else if (typeof result === "object" && result.embed) {
} else if (typeof result === "object" && result.embeds) {
await client.createMessage(message.channel.id, Object.assign(result, reference));
} else if (typeof result === "object" && result.file) {
let fileSize = 8388119;

994
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -28,7 +28,7 @@
"dotenv": "^9.0.2",
"emoji-regex": "^9.2.2",
"eris": "github:abalabahaha/eris#dev",
"eris-fleet": "github:esmBot/eris-fleet",
"eris-fleet": "github:esmBot/eris-fleet#development",
"file-type": "^16.1.0",
"format-duration": "^1.4.0",
"lavacord": "^1.1.9",

View File

@ -1,9 +1,9 @@
// dummy (no-op) database handler
import { warn } from "../logger.js";
warn("Using dummy database adapter. If this isn't what you wanted, check your DB variable.");
export async function setup() {}
export async function setup() {
warn("Using dummy database adapter. If this isn't what you wanted, check your DB variable.");
}
export async function stop() {}
export async function fixGuild() {}
export async function addCount() {}

View File

@ -1,4 +1,4 @@
export function log(type, content) { return content ? process.send({ op: type, msg: content }) : process.send({ op: "info", msg: type }); }
export function log(type, content) { return content ? console[type](content) : console.info(type); }
export function error(...args) { return log("error", ...args); }