Add bot schedules (routines), open Activity, add Help and a Desktop computer view
Bots create, list, update and delete schedules (cron_jobs, Bun.cron in UTC); a per-minute cron queues due runs as tasks. Routines, Activity (super admins) and Help get their own rail aside. Help covers familiar problems, starting with signing in to Google through Cookie-Editor over the new Desktop (noVNC) view. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import AppError from "@/src/utils/app-error";
|
||||
import grabCronJobs from "./grab-cron-jobs";
|
||||
|
||||
type Params = {
|
||||
user_id: number | string;
|
||||
cron_job_id: number | string;
|
||||
/**
|
||||
* Only if it's this bot's (a bot managing its own schedules).
|
||||
*/
|
||||
bot_id?: number | string;
|
||||
};
|
||||
|
||||
/**
|
||||
* One of the user's schedules. Throws when it isn't theirs (or the bot's).
|
||||
*/
|
||||
export default async function grabUserCronJob({ user_id, cron_job_id, bot_id }: Params) {
|
||||
const [cron_job] = await grabCronJobs({ user_id, bot_id, cron_job_id });
|
||||
|
||||
if (!cron_job?.id) {
|
||||
throw new AppError(`Schedule #${cron_job_id} not found.`);
|
||||
}
|
||||
|
||||
return cron_job;
|
||||
}
|
||||
Reference in New Issue
Block a user