-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: auto update && optimised it (#327)
- Loading branch information
Showing
3 changed files
with
40 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const { Client, GatewayIntentBits } = require('discord.js') | ||
const fs = require('fs') | ||
const AntiSpam = require('./templates/antispam') | ||
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildMessages] }) | ||
const { updateRoles } = require('./functions/roles') | ||
const mongo = require('./database/mongo') | ||
|
||
require('dotenv').config() | ||
mongo().then(() => { console.info('🧱 Connected to mongo') }).catch(console.error) | ||
|
||
client.antispam = new AntiSpam() | ||
|
||
fs.readdirSync('./events').filter(file => file.endsWith('.js')).forEach(async (file) => { | ||
const event = require(`./events/${file}`) | ||
client.on(event.name, (...args) => { event.execute(...args) }) | ||
}) | ||
|
||
// Start the bot | ||
client.login(process.env.TOKEN) | ||
|
||
setInterval(() => { updateRoles(client) }, 3600000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,7 @@ | ||
const { Client, GatewayIntentBits } = require('discord.js') | ||
const fs = require('fs') | ||
const AntiSpam = require('./templates/antispam') | ||
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages] }) | ||
const { updateRoles } = require('./functions/roles') | ||
const { ShardingManager } = require('discord.js') | ||
|
||
require('dotenv').config() | ||
const manager = new ShardingManager('./bot.js', { token: process.env.TOKEN }) | ||
|
||
client.antispam = new AntiSpam() | ||
manager.on('shardCreate', shard => console.info(`Launched shard ${shard.id}`)) | ||
|
||
fs.readdirSync('./events').filter(file => file.endsWith('.js')).forEach(async (file) => { | ||
const event = require(`./events/${file}`) | ||
client.on(event.name, (...args) => { event.execute(...args) }) | ||
}) | ||
|
||
// Start the bot | ||
client.login(process.env.TOKEN) | ||
|
||
setInterval(() => { updateRoles(client) }, 3600000) | ||
manager.spawn() |