add discord bot
This commit is contained in:
parent
c8670bfe65
commit
86134ed2e1
@ -5,6 +5,7 @@ import path from "path";
|
||||
import express from "express";
|
||||
import engine from "ejs-mate";
|
||||
|
||||
import "@bot/bot";
|
||||
import homeRouter from "@server/routers/home.router";
|
||||
|
||||
const app = express();
|
||||
|
20
src/bot/bot.ts
Normal file
20
src/bot/bot.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { Client, GatewayIntentBits, ActivityType } from "discord.js";
|
||||
|
||||
export const client = new Client({
|
||||
intents: [
|
||||
GatewayIntentBits.Guilds,
|
||||
GatewayIntentBits.GuildMembers,
|
||||
GatewayIntentBits.GuildWebhooks
|
||||
]
|
||||
})
|
||||
|
||||
client.on("ready", () => {
|
||||
if (!client.user) {
|
||||
throw Error("Client is null");
|
||||
}
|
||||
|
||||
client.user.setActivity("new sources", {type: ActivityType.Watching});
|
||||
console.log(`Discord Bot ${client.user.displayName} is online!`)
|
||||
});
|
||||
|
||||
client.login(process.env.BOT_TOKEN);
|
@ -10,7 +10,8 @@
|
||||
"DOM"
|
||||
],
|
||||
"paths": {
|
||||
"@server/*": ["./src/server/*"]
|
||||
"@server/*": ["./src/server/*"],
|
||||
"@bot/*": ["./src/bot/*"]
|
||||
},
|
||||
"plugins": [
|
||||
{"transform": "@zerollup/ts-transform-paths"}
|
||||
|
Loading…
x
Reference in New Issue
Block a user