Skip to content

Commit

Permalink
will ti work
Browse files Browse the repository at this point in the history
  • Loading branch information
nyakase authored Dec 7, 2022
1 parent 967c286 commit e86f949
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
let client;
let config;
let utilsy;
let serverHasBanner;
var CronJob = require("cron").CronJob;
const fs = require('fs');

Expand All @@ -21,6 +22,8 @@ function initAPIs(utils) {
* Get banner or something idk i cant read
*/
function bannerify() {
client.guilds.fetch("868937321402204220").then(server => serverHasBanner = server.features.includes("BANNER"))

let decidedbanner;
const availabanners = fs.readdirSync(`${__dirname}/../banners`).filter(fn => fn.startsWith(new Date().toLocaleString("en-GB", {day: "2-digit", month: "2-digit"}).replace("/", "-")));
if(availabanners[0]) {
Expand All @@ -39,13 +42,14 @@ function bannerify() {
}
console.log(availabanners, config.bannerState, decidedbanner);
if(decidedbanner) {
client.guilds.fetch("868937321402204220").then(server => server.setBanner(`${__dirname}/../banners/${decidedbanner}`, "bannerfest update")
.then(function() {
if(config.bannerState == "holiday") client.channels.fetch('951903299236413500').then(channel=>channel.send(`hey everyone! we're now celebrating ${decidedbanner}! have fun!`))
})
.catch(err => {
console.log(err)
}))
if(serverHasBanner) client.guilds.fetch("868937321402204220").then(server => server.setBanner(`${__dirname}/../banners/${decidedbanner}`, "bannerfest update");
client.channels.fetch('951903299236413500').then(channel=>channel.send({
content: `hey everyone! we're now celebrating ${decidedbanner}! have fun!`,
files: [{
attachment: `${__dirname}/../banners/${decidedbanner}`,
name: "banner.png"
}]
}));
}
}

Expand Down

0 comments on commit e86f949

Please sign in to comment.