This repository has been archived by the owner on Aug 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
56 lines (47 loc) · 1.64 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
const { Client, GatewayIntentBits, Partials, Collection } = require('discord.js');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.MessageContent
],
partials: [Partials.Channel, Partials.Message, Partials.User, Partials.GuildMember, Partials.Reaction]
});
const winston = require('winston');
const { combine, timestamp, printf, align, errors } = winston.format;
const events = require('events');
const fs = require('fs');
require('dotenv').config();
const Utils = require('./structs/Utils.js');
const Stocks = require('./structs/Stocks.js');
const Account = require('./structs/Account.js');
client.slashCommands = new Collection();
client.subCommands = new Collection();
client.buttons = new Collection();
client.emitter = new events.EventEmitter();
client.emitter.setMaxListeners(25);
client.utils = new Utils();
client.stocks = new Stocks(client);
client.account = new Account(client);
client.logger = winston.createLogger({
level: 'info',
format: combine(
errors({ stack: true }),
timestamp({ format: 'YYYY-MM-DD hh:mm:ss.SSS A' }),
align(),
printf((info) => `[${info.timestamp}] ${info.level}: ${info.message}`)
),
transports: [
new winston.transports.Console(),
new winston.transports.File({ filename: 'combined.log' }),
new winston.transports.File({ filename: 'errors.log', level: 'error' })
],
});
module.exports = client;
fs.readdirSync('./handlers').forEach((handler) => {
require(`./handlers/${handler}`)(client);
});
client.login(process.env.TOKEN);