Zain
Zain
DIAdiscord.js - Imagine an app
Created by Zain on 10/4/2024 in #djs-questions
Idk why am i getting this error while running bot for first time
works now
13 replies
DIAdiscord.js - Imagine an app
Created by Zain on 10/4/2024 in #djs-questions
Idk why am i getting this error while running bot for first time
forgot evevrything
13 replies
DIAdiscord.js - Imagine an app
Created by Zain on 10/4/2024 in #djs-questions
Idk why am i getting this error while running bot for first time
m so dumb, i last made a bot in 2023
13 replies
DIAdiscord.js - Imagine an app
Created by Zain on 10/4/2024 in #djs-questions
Idk why am i getting this error while running bot for first time
ohhh i see
13 replies
DIAdiscord.js - Imagine an app
Created by Zain on 10/4/2024 in #djs-questions
Idk why am i getting this error while running bot for first time
i didnt use it
13 replies
DIAdiscord.js - Imagine an app
Created by Zain on 10/4/2024 in #djs-questions
Idk why am i getting this error while running bot for first time
ik
13 replies
DIAdiscord.js - Imagine an app
Created by Zain on 10/4/2024 in #djs-questions
Idk why am i getting this error while running bot for first time
code:
const {Client, GatewayIntentBits, Collection} = require('discord.js');
const int = GatewayIntentBits;
const bot = new Client({intents:[int.Guilds,int.GuildMessages,int.GuildMembers,int.MessageContent]});
const fs = require('fs')
bot.commands = new Collection();
bot.snipes = new Collection();
bot.guilds = new Collection();
bot.esnipes = new Collection();

const {QuickDB} = require('quick.db');
const db = new QuickDB();

const eventsDir = fs.readdirSync("./events/").filter(c=>c.endsWith(".js"));
for(const eventFile of eventsDir) {
const event = require('./events/'+eventFile);
if(event.once)
bot.once(event.name, (bot, ...args) => event.execute(bot, args));
else bot.on(event.name, (bot,...args) => event.execute(bot, args));
}
let commands = [];
const commandsDir = fs.readdirSync('./commands/');
for(const commandFolders of commandsDir) {
const commandFolder = fs.readdirSync('./commands/'+commandFolders+'/').filter(c=>c.endsWith(".js"));
for(const commandFiles of commandFolder) {
const command = require(`./commands/${commandFolders}/${commandFiles}`);
commands[command.name] = command;
}
}
bot.commands.set('commands', commands);
db.get('bot.commands') ? 0 : (db.set('bot.commands', commands))

bot.db = db;

bot.login(require('./config.js').token)
const {Client, GatewayIntentBits, Collection} = require('discord.js');
const int = GatewayIntentBits;
const bot = new Client({intents:[int.Guilds,int.GuildMessages,int.GuildMembers,int.MessageContent]});
const fs = require('fs')
bot.commands = new Collection();
bot.snipes = new Collection();
bot.guilds = new Collection();
bot.esnipes = new Collection();

const {QuickDB} = require('quick.db');
const db = new QuickDB();

const eventsDir = fs.readdirSync("./events/").filter(c=>c.endsWith(".js"));
for(const eventFile of eventsDir) {
const event = require('./events/'+eventFile);
if(event.once)
bot.once(event.name, (bot, ...args) => event.execute(bot, args));
else bot.on(event.name, (bot,...args) => event.execute(bot, args));
}
let commands = [];
const commandsDir = fs.readdirSync('./commands/');
for(const commandFolders of commandsDir) {
const commandFolder = fs.readdirSync('./commands/'+commandFolders+'/').filter(c=>c.endsWith(".js"));
for(const commandFiles of commandFolder) {
const command = require(`./commands/${commandFolders}/${commandFiles}`);
commands[command.name] = command;
}
}
bot.commands.set('commands', commands);
db.get('bot.commands') ? 0 : (db.set('bot.commands', commands))

bot.db = db;

bot.login(require('./config.js').token)
13 replies
DIAdiscord.js - Imagine an app
Created by Zain on 10/4/2024 in #djs-questions
Idk why am i getting this error while running bot for first time
node is v18.18.2
13 replies
DIAdiscord.js - Imagine an app
Created by Zain on 10/4/2024 in #djs-questions
Idk why am i getting this error while running bot for first time
14.16.3
13 replies