Got rid of unnecessary check for empty message from user (Fluxer doesn't allow this to happen)

Removed export of token
This commit is contained in:
Aster Fialla
2026-02-24 20:15:00 -05:00
parent 1d9d9600e5
commit 6d82a067a1
2 changed files with 3 additions and 17 deletions

View File

@@ -8,7 +8,7 @@ import {utils} from "./helpers/utils.js";
env.config({path: './.env'});
export const token = process.env.FLUXER_BOT_TOKEN;
const token = process.env.FLUXER_BOT_TOKEN;
if (!token) {
console.error("Missing FLUXER_BOT_TOKEN environment variable.");
@@ -30,11 +30,10 @@ client.on(Events.MessageCreate, async (message) => {
**/
export const handleMessageCreate = async function(message) {
try {
// Ignore bots
if (message.author.bot) return;
// Parse command and arguments
const content = message.content.trim();
// Ignore bots and messages without content
if (message.author.bot || content.length === 0) return;
// If message doesn't start with the bot prefix, it could still be a message with a proxy tag. If it's not, return.
if (!content.startsWith(messageHelper.prefix)) {
return await webhookHelper.sendMessageAsMember(client, message);

View File

@@ -87,19 +87,6 @@ describe('bot', () => {
expect(res).toBeUndefined();
})
test('on message creation, if message is empty, return', async () => {
// Arrange
const message = {
content: " ",
author: {
bot: false
}
}
// Act
const res = await handleMessageCreate(message);
expect(res).toBeUndefined();
})
test("if message doesn't start with bot prefix, call sendMessageAsMember", async () => {
// Arrange
webhookHelper.sendMessageAsMember.mockResolvedValue();