Revolt-Bot/src/index.ts

26 lines
734 B
TypeScript
Raw Normal View History

2023-08-20 20:44:16 +02:00
import { Client, Message } from "revolt.js";
import { commandHandler } from "./utils/commandHandler"
import { nonCommandHandler } from "./utils/nonCommandHandler"
2023-08-20 20:44:16 +02:00
import config from "../config.json"
2023-09-04 10:41:08 +02:00
const client : Client = new Client({ eagerFetching: false });
2023-08-20 20:44:16 +02:00
client.on("ready", async () => {
console.info(`Gummed in as ${client.user.username}!`)
client.user.edit({status : {text: config.prefix + " help for the help menu"}})
2023-08-20 20:44:16 +02:00
});
client.on("messageCreate", async (message: Message) => {
if (message.author.bot) {}
else {
if (message.content.startsWith(config.prefix)) {
commandHandler(message, config.prefix);
}
else {
nonCommandHandler(message);
}
2023-08-20 20:44:16 +02:00
}
});
client.loginBot(config.botKey);