@@ -13,7 +13,7 @@ import {
1313} from "discord.js" ;
1414import color from "colors" ;
1515import { randomUUID } from "crypto" ;
16- import { Config } from "./config.js" ;
16+ import { Config , configStartup } from "./config.js" ;
1717
1818color . enable ( ) ;
1919
@@ -30,57 +30,6 @@ class DiscordTransport extends Transport {
3030
3131 const uuid = randomUUID ( ) ;
3232
33- // const data = await database.disBot.findFirst({
34- // where: {
35- // GetConf: "config"
36- // }
37- // });
38- // if (data) {
39- // if (data.Logs.length >= 1000) {
40- // data.Logs.forEach(async (log) => {
41- // if (log.UUID === uuid) return;
42- // const logDate = new Date(log.Timestamp as string);
43- // const now = new Date();
44- // const diff = now.getTime() - logDate.getTime();
45- // if (diff > ms("10m")) {
46- // await database.disBot.update(
47- // {
48- // where: { GetConf: "config", },
49- // data: {
50- // Logs: {
51- // set: data.Logs.filter((f) => f.UUID != log.UUID)
52- // }
53- // }
54- // }
55- // );
56- // }
57- // });
58- // }
59- // }
60-
61- // await database.disBot.update(
62- // {
63- // where: { GetConf: "config", },
64- // data: {
65- // Logs: {
66- // push: {
67- // UUID: uuid.toString(),
68- // GuildId: info.guildId ? info.guildId : "0",
69- // UserId: info.userId ? info.userId : "0",
70- // ChannelId: info.channelId ? info.channelId : "0",
71- // MessageId: info.messageId ? info.messageId : "0",
72- // Timestamp: info.timestamp ? info.timestamp : new Date().toISOString(),
73- // Level: info.level ? info.level : "info",
74- // Label: info.label ? info.label : "General",
75- // Message: info.message ? info.message : "No message provided",
76- // BotType: Config.BotType.toString() || "Unknown",
77- // Action: info.action
78- // }
79- // }
80- // }
81- // })
82-
83- const logUrl = `https://logs.disbot.app/log/${ uuid } ` ;
8433 const emoji = this . getEmoji ( info . level ) ;
8534
8635 let truncatedMessage = "" ;
@@ -105,14 +54,6 @@ class DiscordTransport extends Transport {
10554 `**Bot Type:** ${ Config . BotType . toString ( ) || "Unknown" } ` ,
10655 `**Action:** ${ info . action } ` ,
10756 ] . join ( "\n" ) )
108- ) . addActionRowComponents (
109- new ActionRowBuilder < ButtonBuilder > ( )
110- . addComponents (
111- new ButtonBuilder ( )
112- . setLabel ( "View Log" )
113- . setStyle ( ButtonStyle . Link )
114- . setURL ( logUrl )
115- )
11657 )
11758 this . webhook . send ( {
11859 components : [ container ] ,
@@ -144,6 +85,7 @@ class DiscordTransport extends Transport {
14485 }
14586}
14687
88+ await configStartup ( ) ;
14789export const Logger = winston . createLogger ( {
14890 format : winston . format . combine (
14991 winston . format . timestamp ( { format : "YYYY-MM-DD HH:mm:ss" } ) ,
@@ -160,7 +102,6 @@ export const Logger = winston.createLogger({
160102 ) ,
161103 transports : [
162104 new winston . transports . Console ( ) ,
163- // TODO: Fix DiscordExporter
164- // new DiscordTransport({webhookUrl: Config.Logging.BotLogger})
105+ new DiscordTransport ( { webhookUrl : Config . Logging . BotLogger } )
165106 ] ,
166107} ) ;
0 commit comments