mirror of
https://github.com/SrIzan10/vinci.git
synced 2026-06-06 01:07:00 +00:00
feat: actually fix the birthday command
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
// import everything
|
||||
import { commandModule, CommandType } from '@sern/handler'
|
||||
import { EmbedBuilder } from 'discord.js';
|
||||
import { publish } from "../../src/plugins/publish.js";
|
||||
import { ownerOnly } from "../../src/plugins/ownerOnly.js"
|
||||
import { TextChannel, ThreadAutoArchiveDuration, ThreadManager } from "discord.js";
|
||||
|
||||
export default commandModule({
|
||||
type: CommandType.Modal,
|
||||
//alias : [],
|
||||
async execute (modal) {
|
||||
|
||||
}
|
||||
});
|
||||
@@ -3,17 +3,17 @@ import { Client, TextChannel } from "discord.js";
|
||||
import db from "../schemas/birthdays.js";
|
||||
|
||||
export default async function birthdays(client: Client) {
|
||||
const fetchallusers = await db.find();
|
||||
const filtered = fetchallusers.map((user) => user.id);
|
||||
for (const user of filtered) {
|
||||
const finduser = await db.findOne({ id: user });
|
||||
db.find({}, (err, user) => {
|
||||
if (err) throw err
|
||||
user.map(async user => {
|
||||
const finduser = await db.findOne({ id: user.id });
|
||||
async function saveit() {
|
||||
finduser!.alreadysent = false
|
||||
await finduser!.save()
|
||||
await finduser!.save()
|
||||
}
|
||||
if (finduser!.date === dayjs().format("D-M")) {} else return
|
||||
if (finduser!.alreadysent === true && dayjs().format('D-M') !== finduser!.date) return saveit()
|
||||
if (finduser!.alreadysent === true && dayjs().format('D-M') === finduser!.date) return
|
||||
if (finduser!.alreadysent === true) return
|
||||
const sendtochannel = (await (
|
||||
await client.guilds.fetch("928018226330337280")
|
||||
).channels.fetch("1039613653269352449")) as TextChannel;
|
||||
@@ -22,5 +22,6 @@ export default async function birthdays(client: Client) {
|
||||
message.react('<:Pog:1030169609178976346>')
|
||||
finduser!.alreadysent = true
|
||||
await finduser?.save()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user