Skip to content

Commit

Permalink
Merge pull request #89 from Blvckleg/dev
Browse files Browse the repository at this point in the history
RC
  • Loading branch information
sanriodev authored Apr 9, 2024
2 parents bffea39 + ef35974 commit c9b48c0
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 2 deletions.
Binary file added src/assets/wakeup.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/wakeup.mp4
Binary file not shown.
8 changes: 8 additions & 0 deletions src/modules/cron-tasks/cron-scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import BirthdayShoutoutTask from './tasks/birthday-shoutout.task'
import * as cron from 'node-cron'
import { Inject } from '@nestjs/common'
import { BirthdayEntryService } from '../birthday/service/birthday-entry.service'
import WakeUpTask from './tasks/wake-up.task'


interface TaskEntry {
Expand All @@ -30,6 +31,13 @@ class CronScheduler {
this.client.channels.cache.find((channel) => channel.id === '447554141724737548') as TextChannel,birthdayService
),
},
{
name: 'first-of-the-month',
schedule: '0 12 1 * *',
task: new WakeUpTask(
this.client.channels.cache.find((channel) => channel.id === '447554141724737548') as TextChannel,
),
},
]

CronScheduler.instance = this
Expand Down
2 changes: 0 additions & 2 deletions src/modules/cron-tasks/task.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { Module } from "@nestjs/common";
import { BirthdayEntryModule } from "../birthday/module/birthday-entry.module";
import BirthdayShoutoutTask from "./tasks/birthday-shoutout.task";
import { CronScheduler } from "./cron-scheduler";


@Module({
Expand Down
22 changes: 22 additions & 0 deletions src/modules/cron-tasks/tasks/wake-up.task.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { EmbedBuilder, TextChannel } from 'discord.js'
import { ITask } from './interfaces/task.interface'

export default class WakeUpTask implements ITask {
private channel: TextChannel

constructor(channel: TextChannel) {
this.channel = channel
}

async execute(): Promise<void> {

let embed = new EmbedBuilder()
.setTitle(`🚨 WAKE UP 🚨`)
.setColor('Random')
.setDescription(`🎉 it's the first of the month 🎉`)
.setTimestamp(new Date()).setImage("https://raw.githubusercontent.com/Blvckleg/BingusBoingus/master/src/assets/wakeup.gif").setFooter({text: 'party bingus',})

await this.channel.send({ embeds: [embed] })

}
}

0 comments on commit c9b48c0

Please sign in to comment.