#(d.js) TS -> JS: No Errors, won't run..

12 messages · Page 1 of 1 (latest)

gray lionBOT
#
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
  • Marked as resolved by OP
spiral lintel
#

What I'll show now is what is supposed to happen

#

When running "dev", the bot works perfectly fine. No internal db issues or any other potential problems, it's great! Here are my package scripts:

#

Lastly, where is the error coming from?? That I can't pick out, but here is my index.ts file along with my ts config.

#
import 'dotenv/config';
import { Client, Collection, GatewayIntentBits } from 'discord.js';
import { readdirSync } from 'fs';
import { join } from 'path';

const client = new Client({
  intents: [
    GatewayIntentBits.Guilds,
    GatewayIntentBits.GuildMessages,
    GatewayIntentBits.GuildMembers,
    GatewayIntentBits.MessageContent,
  ],
});

client.commands = new Collection<string, any>();

// Load Commands
const commandFiles = readdirSync(join(__dirname, 'commands')).filter((file: string) => file.endsWith('.ts'));

for (const file of commandFiles) {
  const command = require(`./commands/${file}`);
  client.commands.set(command.name, command);
}

// Load Events
const eventFiles = readdirSync(join(__dirname, 'events')).filter((file: string) => file.endsWith('.ts'));

for (const file of eventFiles) {
  const event = require(`./events/${file}`);
  const eventName = file.split('.')[0];
  if (eventName === 'ready') {
    client.once(eventName, (...args) => event(client, ...args));
  } else {
    client.on(eventName, (...args) => event(client, ...args));
  }
}

console.log('Running...');
client.login(process.env.TOKEN);
#
{
  "compilerOptions": {
    "target": "ES6",
    "module": "commonjs",
    "esModuleInterop": true,
    "skipLibCheck": true,
    "strict": true,
    "outDir": "./dist"
  },
  "include": ["src"]
}
#

Any help is much appreciated (read up)

:)

#

omg there's no way it's bc of that

#

hahaha

#

oh well, thats that!

#

?solved

#

!solved