From 22956c26a68a6777df3b0957fd618c7693bc394b Mon Sep 17 00:00:00 2001 From: reishimanfr Date: Sun, 2 Jun 2024 12:32:03 +0200 Subject: [PATCH] v2.4.1 - Fix starboard not working with custom emojis and improve docker support --- src/Classes/Bot.ts | 1 - src/Commands/config/starboard-config.ts | 2 +- src/Events/Bot/Ready.ts | 1 - src/Helpers/Logger.ts | 3 +-- src/Models/Connection.ts | 5 ++++- src/index.ts | 5 ++++- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Classes/Bot.ts b/src/Classes/Bot.ts index 0603572..738b211 100644 --- a/src/Classes/Bot.ts +++ b/src/Classes/Bot.ts @@ -7,7 +7,6 @@ import type { Event } from '../Types/Event' import type { Command } from '../Types/Command' import { setTimeout } from 'node:timers/promises' import type { Button } from '../Types/Button' -require('dotenv').config() const COMMANDS_PATH = join(__dirname, '../Commands') const CLIENT_EVENTS_PATH = join(__dirname, '../Events/Bot') diff --git a/src/Commands/config/starboard-config.ts b/src/Commands/config/starboard-config.ts index 2c2ce46..da3ab5a 100644 --- a/src/Commands/config/starboard-config.ts +++ b/src/Commands/config/starboard-config.ts @@ -152,7 +152,7 @@ const starboard_config: Command = { newEmojisInput .split(', ') .map(emoji => emoji.trim()) - .filter(emoji => emoji.match(/|\p{Extended_Pictographic}/gu))) + .filter(emoji => emoji.match(/()?|\p{Extended_Pictographic}/gu))) ] data.emojis = newEmojis.join(' ') diff --git a/src/Events/Bot/Ready.ts b/src/Events/Bot/Ready.ts index 245e9f6..ae35551 100644 --- a/src/Events/Bot/Ready.ts +++ b/src/Events/Bot/Ready.ts @@ -5,7 +5,6 @@ import pjson from '../../../package.json' import axios from 'axios' import semver from 'semver' import type { Bot } from '../../Classes/Bot' -require('dotenv').config() async function checkIfNewVersionAvailable() { const REPOSITORY_URL = 'https://api.github.com/repos/Reishimanfr/The-World-Machine-Bot/tags' diff --git a/src/Helpers/Logger.ts b/src/Helpers/Logger.ts index a3f1141..2322e9f 100644 --- a/src/Helpers/Logger.ts +++ b/src/Helpers/Logger.ts @@ -1,8 +1,7 @@ import chalk from "chalk" import moment from 'moment' -require('dotenv').config() -const logLevel = process.env.LOG_LEVEL +const logLevel = process.env.LOG_LEVEL ?? 'info' // 0 1 2 3 4 5 const levelNames = ['trace', 'debug', 'info', 'warn', 'error', 'fatal'] diff --git a/src/Models/Connection.ts b/src/Models/Connection.ts index 03fa374..6c74eef 100644 --- a/src/Models/Connection.ts +++ b/src/Models/Connection.ts @@ -1,7 +1,10 @@ import { Sequelize } from 'sequelize' import { logger } from '../Helpers/Logger' import path from 'node:path' -require('dotenv').config() + +if (!process.env.DOCKER) { + require('dotenv').config() +} const sequelize = new Sequelize({ dialect: process.env.DATABASE_DIALECT, diff --git a/src/index.ts b/src/index.ts index 3c8e90a..0ee9fc1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,7 +5,10 @@ import cron from 'node-cron' import { clipString } from './Funcs/ClipString' import { logger } from './Helpers/Logger' import process from "node:process" -require('dotenv').config() + +if (!process.env.DOCKER) { + require('dotenv').config() +} export const client = new Bot({ failIfNotExists: true,