-
Notifications
You must be signed in to change notification settings - Fork 0
/
david.js
31 lines (23 loc) · 1.08 KB
/
david.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
const Discord = require("discord.js")
const config = require("./config.json")
const bot = new Discord.Client({intents: 3276799})
const cron = require("cron")
const jsonfile = require ("jsonfile")
const fs = require("fs")
const { Player } = require("discord-player")
bot.commands = new Discord.Collection()
bot.color = "553380"
bot.player = new Player(bot)
bot.player.extractors.loadDefault()
fs.readdirSync("./events/").filter(f => f.endsWith(".js")).forEach(async file => {
let event = require(`./events/${file}`)
if(!file.startsWith(".")) bot.on(file.split(".js").join(""), event.bind(null, bot))
else bot.player.events.on(file.split(".js").join("").slice(1), event.bind(null, bot))
})
if(fs.existsSync("./event.json")) bot.eventjson = jsonfile.readFileSync("./event.json")
new cron.CronJob('00 00 00 * * *', () => {
var date = new Date()
datestr = date.getDate().toString()+"/"+(date.getMonth()+1).toString()
if(bot.eventjson[datestr] != undefined) bot.channels.cache.get("295252502679650315").send("<@&474513550992211979> "+bot.eventjson[datestr])
}).start()
bot.login(config.token)