Compare commits
2 commits
efc0186db2
...
f812185937
Author | SHA1 | Date | |
---|---|---|---|
f812185937 | |||
7a17c1685e |
5 changed files with 25 additions and 21 deletions
2
.dev.env
2
.dev.env
|
@ -12,7 +12,7 @@ BOT_AUTHOR=Vylpes
|
||||||
BOT_OWNERID=147392775707426816
|
BOT_OWNERID=147392775707426816
|
||||||
BOT_CLIENTID=682942374040961060
|
BOT_CLIENTID=682942374040961060
|
||||||
BOT_ENV=4
|
BOT_ENV=4
|
||||||
BOT_VERBOSE=false
|
BOT_LOGLEVEL=info
|
||||||
BOT_ADMINS=147392775707426816,887272961504071690
|
BOT_ADMINS=147392775707426816,887272961504071690
|
||||||
|
|
||||||
ABOUT_FUNDING=
|
ABOUT_FUNDING=
|
||||||
|
|
|
@ -12,7 +12,7 @@ BOT_AUTHOR=Vylpes
|
||||||
BOT_OWNERID=147392775707426816
|
BOT_OWNERID=147392775707426816
|
||||||
BOT_CLIENTID=1093810443589529631
|
BOT_CLIENTID=1093810443589529631
|
||||||
BOT_ENV=1
|
BOT_ENV=1
|
||||||
BOT_VERBOSE=false
|
BOT_LOGLEVEL=info
|
||||||
BOT_ADMINS=147392775707426816,887272961504071690
|
BOT_ADMINS=147392775707426816,887272961504071690
|
||||||
|
|
||||||
ABOUT_FUNDING=
|
ABOUT_FUNDING=
|
||||||
|
|
|
@ -12,7 +12,7 @@ BOT_AUTHOR=Vylpes
|
||||||
BOT_OWNERID=147392775707426816
|
BOT_OWNERID=147392775707426816
|
||||||
BOT_CLIENTID=1147976642942214235
|
BOT_CLIENTID=1147976642942214235
|
||||||
BOT_ENV=2
|
BOT_ENV=2
|
||||||
BOT_VERBOSE=false
|
BOT_LOGLEVEL=info
|
||||||
BOT_ADMINS=147392775707426816,887272961504071690
|
BOT_ADMINS=147392775707426816,887272961504071690
|
||||||
|
|
||||||
ABOUT_FUNDING=
|
ABOUT_FUNDING=
|
||||||
|
|
|
@ -12,16 +12,16 @@ export default class AppLogger {
|
||||||
level: logLevel,
|
level: logLevel,
|
||||||
format: format.combine(
|
format: format.combine(
|
||||||
format.timestamp({
|
format.timestamp({
|
||||||
format: 'YYYY-MM-DD HH:mm:ss'
|
format: "YYYY-MM-DD HH:mm:ss"
|
||||||
}),
|
}),
|
||||||
format.errors({ stack: true }),
|
format.errors({ stack: true }),
|
||||||
format.splat(),
|
format.splat(),
|
||||||
customFormat,
|
customFormat,
|
||||||
),
|
),
|
||||||
defaultMeta: { service: 'bot' },
|
defaultMeta: { service: "bot" },
|
||||||
transports: [
|
transports: [
|
||||||
new transports.File({ filename: 'error.log', level: 'error' }),
|
new transports.File({ filename: "error.log", level: "error" }),
|
||||||
new transports.File({ filename: 'combined.log' }),
|
new transports.File({ filename: "combined.log" }),
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -31,10 +31,12 @@ export default class AppLogger {
|
||||||
format.colorize(),
|
format.colorize(),
|
||||||
format.timestamp(),
|
format.timestamp(),
|
||||||
customFormat,
|
customFormat,
|
||||||
)}));
|
)}));
|
||||||
}
|
}
|
||||||
|
|
||||||
AppLogger.Logger = logger;
|
AppLogger.Logger = logger;
|
||||||
|
|
||||||
|
AppLogger.LogInfo("AppLogger", `Log Level: ${logLevel}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LogError(label: string, message: string) {
|
public static LogError(label: string, message: string) {
|
||||||
|
|
|
@ -47,7 +47,9 @@ export class CoreClient extends Client {
|
||||||
|
|
||||||
CoreClient.Environment = Number(process.env.BOT_ENV);
|
CoreClient.Environment = Number(process.env.BOT_ENV);
|
||||||
|
|
||||||
AppLogger.InitialiseLogger(process.env.BOT_VERBOSE == "true" ? "verbose" : "info", CoreClient.Environment == Environment.Local);
|
const loglevel = process.env.BOT_LOGLEVEL ?? "info";
|
||||||
|
|
||||||
|
AppLogger.InitialiseLogger(loglevel, CoreClient.Environment == Environment.Local);
|
||||||
|
|
||||||
AppLogger.LogInfo("Client", "Initialising Client");
|
AppLogger.LogInfo("Client", "Initialising Client");
|
||||||
|
|
||||||
|
@ -125,7 +127,7 @@ export class CoreClient extends Client {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
AppLogger.LogVerbose("Client", `Registered Channel Create Event`);
|
AppLogger.LogVerbose("Client", "Registered Channel Create Event");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RegisterChannelDeleteEvent(fn: (channel: DMChannel | NonThreadGuildBasedChannel) => void) {
|
public static RegisterChannelDeleteEvent(fn: (channel: DMChannel | NonThreadGuildBasedChannel) => void) {
|
||||||
|
@ -148,7 +150,7 @@ export class CoreClient extends Client {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
AppLogger.LogVerbose("Client", `Registered Channel Delete Event`);
|
AppLogger.LogVerbose("Client", "Registered Channel Delete Event");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RegisterChannelUpdateEvent(fn: (channel: DMChannel | NonThreadGuildBasedChannel) => void) {
|
public static RegisterChannelUpdateEvent(fn: (channel: DMChannel | NonThreadGuildBasedChannel) => void) {
|
||||||
|
@ -171,7 +173,7 @@ export class CoreClient extends Client {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
AppLogger.LogVerbose("Client", `Registered Channel Update Event`);
|
AppLogger.LogVerbose("Client", "Registered Channel Update Event");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RegisterGuildBanAddEvent(fn: (ban: GuildBan) => void) {
|
public static RegisterGuildBanAddEvent(fn: (ban: GuildBan) => void) {
|
||||||
|
@ -194,7 +196,7 @@ export class CoreClient extends Client {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
AppLogger.LogVerbose("Client", `Registered Guild Ban Add Event`);
|
AppLogger.LogVerbose("Client", "Registered Guild Ban Add Event");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RegisterGuildBanRemoveEvent(fn: (channel: GuildBan) => void) {
|
public static RegisterGuildBanRemoveEvent(fn: (channel: GuildBan) => void) {
|
||||||
|
@ -217,7 +219,7 @@ export class CoreClient extends Client {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
AppLogger.LogVerbose("Client", `Registered Guild Ban Remove Event`);
|
AppLogger.LogVerbose("Client", "Registered Guild Ban Remove Event");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RegisterGuildCreateEvent(fn: (guild: Guild) => void) {
|
public static RegisterGuildCreateEvent(fn: (guild: Guild) => void) {
|
||||||
|
@ -240,7 +242,7 @@ export class CoreClient extends Client {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
AppLogger.LogVerbose("Client", `Registered Guild Create Event`);
|
AppLogger.LogVerbose("Client", "Registered Guild Create Event");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RegisterGuildMemberAddEvent(fn: (member: GuildMember) => void) {
|
public static RegisterGuildMemberAddEvent(fn: (member: GuildMember) => void) {
|
||||||
|
@ -263,7 +265,7 @@ export class CoreClient extends Client {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
AppLogger.LogVerbose("Client", `Registered Guild Member Add Event`);
|
AppLogger.LogVerbose("Client", "Registered Guild Member Add Event");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RegisterGuildMemberRemoveEvent(fn: (member: GuildMember | PartialGuildMember) => void) {
|
public static RegisterGuildMemberRemoveEvent(fn: (member: GuildMember | PartialGuildMember) => void) {
|
||||||
|
@ -286,7 +288,7 @@ export class CoreClient extends Client {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
AppLogger.LogVerbose("Client", `Registered Guild Member Remove Event`);
|
AppLogger.LogVerbose("Client", "Registered Guild Member Remove Event");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GuildMemebrUpdate(fn: (oldMember: GuildMember | PartialGuildMember, newMember: GuildMember) => void) {
|
public static GuildMemebrUpdate(fn: (oldMember: GuildMember | PartialGuildMember, newMember: GuildMember) => void) {
|
||||||
|
@ -309,7 +311,7 @@ export class CoreClient extends Client {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
AppLogger.LogVerbose("Client", `Registered Guild Member Update Event`);
|
AppLogger.LogVerbose("Client", "Registered Guild Member Update Event");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RegisterMessageCreateEvent(fn: (message: Message<boolean>) => void) {
|
public static RegisterMessageCreateEvent(fn: (message: Message<boolean>) => void) {
|
||||||
|
@ -332,7 +334,7 @@ export class CoreClient extends Client {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
AppLogger.LogVerbose("Client", `Registered Message Create Event`);
|
AppLogger.LogVerbose("Client", "Registered Message Create Event");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RegisterMessageDeleteEvent(fn: (message: Message<boolean> | PartialMessage) => void) {
|
public static RegisterMessageDeleteEvent(fn: (message: Message<boolean> | PartialMessage) => void) {
|
||||||
|
@ -355,7 +357,7 @@ export class CoreClient extends Client {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
AppLogger.LogVerbose("Client", `Registered Message Delete Event`);
|
AppLogger.LogVerbose("Client", "Registered Message Delete Event");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RegisterMessageUpdateEvent(fn: (oldMessage: Message<boolean> | PartialMessage, newMessage: Message<boolean> | PartialMessage) => void) {
|
public static RegisterMessageUpdateEvent(fn: (oldMessage: Message<boolean> | PartialMessage, newMessage: Message<boolean> | PartialMessage) => void) {
|
||||||
|
@ -378,7 +380,7 @@ export class CoreClient extends Client {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
AppLogger.LogVerbose("Client", `Registered Message Update Event`);
|
AppLogger.LogVerbose("Client", "Registered Message Update Event");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RegisterButtonEvent(buttonId: string, event: ButtonEvent, environment: Environment = Environment.All) {
|
public static RegisterButtonEvent(buttonId: string, event: ButtonEvent, environment: Environment = Environment.All) {
|
||||||
|
|
Loading…
Reference in a new issue