Files
selfbot-discord/commands/automatisation/viewtasks.ts
T
2024-04-26 23:38:26 +02:00

28 lines
1016 B
TypeScript

import { Message, Client } from 'discord.js';
import db from '../../fonctions/instanceDB';
require('dotenv').config();
module.exports = {
aliases: ['viewtask', 'alltask', 'tasks', 'tasklist', 'listtasks', 'listtask', 'alltasks', 'viewalltasks', 'alltaskslist', 'alltasklist', 'taskslist', 'listalltasks', 'listalltask'],
description: 'Voir toutes les tâches.',
emote: '⏱️',
utilisation: '',
async execute(message: Message, args: string[], client: Client) {
message.delete();
db.all(`SELECT * FROM task`, (err: any, rows: any) => {
if (err) {
console.error(err.message);
}
let tasks = '# Voici la liste des tâches :';
rows.forEach((row: any) => {
if (tasks.length + row.id.toString().length + row.name.length + row.time.toString().length > 1970) {
message.channel.send(tasks);
tasks = '';
}
tasks += `\n- ${row.id} - ${row.name} : ${row.time} minutes`;
});
message.channel.send(tasks);
});
}
};