init
Some checks failed
Gitea Auto Deploy / Deploy-Container (push) Failing after 6s

This commit is contained in:
2025-05-25 22:29:44 +07:00
commit 5eb5aa6eec
27 changed files with 1998 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
import { Client, Message } from "discord.js";
import { fetchApk } from "@/services/fetchApk";
export const name = "apk";
export const description = "Fetch apk";
export async function execute(client: Client, message: Message, args: string[]) {
const version = args[0];
await fetchApk(version, message);
}

View File

@@ -0,0 +1,24 @@
import { Client, Collection } from "discord.js";
import path from "path";
import fs from "fs";
import type { prefixCommand } from "@/types/discord.js";
export function ActiveAllPrefixCommands(client: Client) {
const commandFolder = path.join(__dirname);
client.prefix = new Collection<string, prefixCommand>();
for (const folder of fs.readdirSync(commandFolder)) {
const folderPath = path.join(commandFolder, folder);
if (!fs.statSync(folderPath).isDirectory()) continue;
const commandFiles = fs.readdirSync(folderPath).filter(file => file.endsWith(".ts"));
for (const file of commandFiles) {
const command = require(path.join(folderPath, file));
if (!command.name || typeof command.execute !== "function") {
console.log(`Prefix command at ${path.join(folderPath, file)} is missing a name or execute function`);
continue;
}
// console.log(`Prefix command ${command.name} loaded`);
client.prefix.set(command.name, command);
}
}
}

View File

@@ -0,0 +1,10 @@
import { Message, Client } from "discord.js";
export const name = "ping";
export const description = "Kiểm tra thời gian phản hồi của bot";
export async function execute(client: Client, message: Message, args: string[]) {
const sent = await message.reply('Pong!');
const latency = sent.createdTimestamp - message.createdTimestamp;
await sent.edit(`Pong! \`${latency}ms\``);
}