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

13
app.js
View file

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

View file

@ -11,7 +11,7 @@ class SoundReloadCommand extends Command {
this.ipc.register("soundReloadSuccess", (msg) => { this.ipc.register("soundReloadSuccess", (msg) => {
this.ipc.unregister("soundReloadSuccess"); this.ipc.unregister("soundReloadSuccess");
this.ipc.unregister("soundReloadFail"); 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.register("soundReloadFail", () => {
this.ipc.unregister("soundReloadSuccess"); 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({ await client.createMessage(message.channel.id, Object.assign({
content: result content: result
}, reference)); }, 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)); await client.createMessage(message.channel.id, Object.assign(result, reference));
} else if (typeof result === "object" && result.file) { } else if (typeof result === "object" && result.file) {
let fileSize = 8388119; 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", "dotenv": "^9.0.2",
"emoji-regex": "^9.2.2", "emoji-regex": "^9.2.2",
"eris": "github:abalabahaha/eris#dev", "eris": "github:abalabahaha/eris#dev",
"eris-fleet": "github:esmBot/eris-fleet", "eris-fleet": "github:esmBot/eris-fleet#development",
"file-type": "^16.1.0", "file-type": "^16.1.0",
"format-duration": "^1.4.0", "format-duration": "^1.4.0",
"lavacord": "^1.1.9", "lavacord": "^1.1.9",

View file

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