prepare for deploy
This commit is contained in:
17
src/bot.ts
17
src/bot.ts
@@ -5,19 +5,12 @@ import {
|
|||||||
REST,
|
REST,
|
||||||
Routes,
|
Routes,
|
||||||
} from "@discordjs";
|
} from "@discordjs";
|
||||||
import * as stdDotenv from "jsr:@std/dotenv@0.225.3";
|
|
||||||
import { commandRouter } from "@root/commands.ts";
|
import { commandRouter } from "@root/commands.ts";
|
||||||
|
import { EnvConst, loadConfig } from "@root/core/configLoader.ts";
|
||||||
const env = await stdDotenv.load();
|
|
||||||
|
|
||||||
const token = env.TOKEN;
|
|
||||||
if (token === undefined) throw Error("no bot token");
|
|
||||||
// import { EnvConst, loadConfig } from "@root/core/configLoader.ts";
|
|
||||||
// import { messagehandler } from "@root/messages.ts";
|
|
||||||
|
|
||||||
// const env: EnvConst = loadConfig();
|
|
||||||
const { promise, resolve, reject } = Promise.withResolvers<void>();
|
const { promise, resolve, reject } = Promise.withResolvers<void>();
|
||||||
|
|
||||||
|
const env: EnvConst = loadConfig();
|
||||||
|
|
||||||
const client = new Client({
|
const client = new Client({
|
||||||
intents: [
|
intents: [
|
||||||
GatewayIntentBits.Guilds,
|
GatewayIntentBits.Guilds,
|
||||||
@@ -46,9 +39,9 @@ client.on(Events.Error, (e) => {
|
|||||||
reject(e);
|
reject(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
const rest = new REST({ version: "10" }).setToken(token);
|
const rest = new REST({ version: "10" }).setToken(env.BOT_TOKEN);
|
||||||
|
|
||||||
client.login(token);
|
client.login(env.BOT_TOKEN);
|
||||||
|
|
||||||
await promise;
|
await promise;
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import * as stdlogger from "jsr:@std/log";
|
// import * as stdlogger from "jsr:@std/log";
|
||||||
import { Message } from "@discordjs";
|
// import { Message } from "@discordjs";
|
||||||
|
|
||||||
export function logMessage(message: Message) {
|
// export function logMessage(message: Message) {
|
||||||
return stdlogger.info(
|
// return stdlogger.info(
|
||||||
`Message from ${message.author} in ${message.guildId?? "Private"} ${message.channelId} Command:[${message.content}]`
|
// `Message from ${message.author} in ${message.guildId?? "Private"} ${message.channelId} Command:[${message.content}]`
|
||||||
);
|
// );
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|||||||
Reference in New Issue
Block a user