2023-08-20 20:44:16 +02:00
|
|
|
import { Client, Message } from "revolt.js";
|
|
|
|
import { commandHandler } from "./utils/commandHandler"
|
2023-09-02 23:21:55 +02:00
|
|
|
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}!`)
|
2023-09-02 23:21:55 +02:00
|
|
|
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) => {
|
2023-09-05 19:28:54 +02:00
|
|
|
try{if (!message.author) {await client.users.fetch(message.authorId)} }
|
|
|
|
catch(e){console.log(e)}
|
2023-09-05 20:07:46 +02:00
|
|
|
|
|
|
|
if (message === undefined) {return}
|
2023-09-04 10:57:25 +02:00
|
|
|
if (message.author?.bot) {}
|
|
|
|
else {
|
2023-09-05 20:07:46 +02:00
|
|
|
if (message.content.startsWith(config.prefix)) {
|
2023-09-05 19:40:46 +02:00
|
|
|
commandHandler(message, config.prefix);
|
2023-08-20 20:44:16 +02:00
|
|
|
}
|
2023-09-05 19:40:46 +02:00
|
|
|
else {
|
|
|
|
nonCommandHandler(message);
|
|
|
|
}
|
|
|
|
}
|
2023-08-20 20:44:16 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
client.loginBot(config.botKey);
|