Skip to content

Commit

Permalink
message on immich birthday
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldietzler committed Oct 6, 2023
1 parent 473209f commit 2c4ea57
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
23 changes: 23 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
},
"dependencies": {
"@discordx/importer": "^1.2.3",
"cron": "^3.0.0",
"discord.js": "^14.13.0",
"discordx": "^11.7.6"
},
Expand Down
11 changes: 11 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { dirname, importx } from '@discordx/importer';
import { CronJob } from 'cron';
import type { Interaction, Message, TextChannel } from 'discord.js';
import { IntentsBitField } from 'discord.js';
import { Client } from 'discordx';
Expand All @@ -16,6 +17,14 @@ export const bot = new Client({
},
});

const birthdayJob = new CronJob('36 4 3 2 *', async () => {
const channel = (await bot.channels.fetch('994044917355663450')) as TextChannel

if (channel) {
channel.send(`"Happy birthday my other child" - Alex`)
}
})

bot.once('ready', async () => {
const sha = process.env.COMMIT_SHA;
const fullVersion = `${process.env.npm_package_version}@[${sha?.substring(
Expand All @@ -32,6 +41,8 @@ bot.once('ready', async () => {
if (channel) {
channel.send(`I'm alive, running ${fullVersion}!`);
}

birthdayJob.start()
});

bot.on('interactionCreate', (interaction: Interaction) => {
Expand Down

0 comments on commit 2c4ea57

Please sign in to comment.