This commit is contained in:
lilyissillyyy
2026-02-16 17:29:51 -05:00
parent 41be1ed725
commit 0baeaa44ed
+6 -7
View File
@@ -28,7 +28,6 @@ module.exports = class AvatarChanger {
this.isWearingHat = true; this.isWearingHat = true;
const image = await this.editAvatar(hat); const image = await this.editAvatar(hat);
await this.client.user.setAvatar(image); await this.client.user.setAvatar(image);
return;
} }
setInterval() { setInterval() {
@@ -37,14 +36,14 @@ module.exports = class AvatarChanger {
now.getUTCFullYear(), now.getUTCFullYear(),
now.getUTCMonth(), now.getUTCMonth(),
now.getUTCDate() + 1, now.getUTCDate() + 1,
0 ,0, 0, 0 0, 0, 0, 0
)); ));
const msUntilNext = midnight - now; const msUntilNext = midnight - now;
setTimeout(() => { setTimeout(() => {
const today = new Date(); const today = new Date();
const holiday = this.isHoliday(today); const holiday = this.isHoliday(today);
if (holiday) { if (holiday) {
let hat = holiday.hat; let { hat } = holiday;
if (Array.isArray(hat)) hat = hat[Math.floor(Math.random() * hat.length)]; if (Array.isArray(hat)) hat = hat[Math.floor(Math.random() * hat.length)];
this.setAvatar(hat) this.setAvatar(hat)
.then(() => this.client.logger.info(`[AVATAR] Updated avatar to ${hat}!`)) .then(() => this.client.logger.info(`[AVATAR] Updated avatar to ${hat}!`))
@@ -73,10 +72,10 @@ module.exports = class AvatarChanger {
isThanksgiving(day) { isThanksgiving(day) {
const thanksgiving = this.getThanksgiving(day.getUTCFullYear()); const thanksgiving = this.getThanksgiving(day.getUTCFullYear());
return ( return (
day.getUTCFullYear() === thanksgiving.getUTCFullYear() && day.getUTCFullYear() === thanksgiving.getUTCFullYear()
day.getUTCMonth() === thanksgiving.getUTCMonth() && && day.getUTCMonth() === thanksgiving.getUTCMonth()
day.getUTCDate() === thanksgiving.getUTCDate() && day.getUTCDate() === thanksgiving.getUTCDate()
); );
} }
getThanksgiving(year) { getThanksgiving(year) {