1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-18 00:31:00 -05:00

Compare commits

..

2 Commits

Author SHA1 Message Date
AnxietyisReal
5c0f238531 Uppercase the prefix to match others 2024-01-17 03:23:59 +11:00
AnxietyisReal
9979a4af9d Add debug logging to Logger class 2024-01-17 00:25:22 +11:00
4 changed files with 5 additions and 4 deletions

View File

@ -17,11 +17,11 @@ export default class Automoderator {
// If the count has reached the threshold amount, punish the user like most daddy would do to their child. // If the count has reached the threshold amount, punish the user like most daddy would do to their child.
if (!this.lockQuery.has(message.author.id)) { if (!this.lockQuery.has(message.author.id)) {
this.lockQuery.add(message.author.id); this.lockQuery.add(message.author.id);
Logger.console('log', 'Automod', `Lock acquired for ${message.author.tag} with reason: ${reason}`); Logger.console('log', 'AUTOMOD', `Lock acquired for ${message.author.tag} with reason: ${reason}`);
await client.punishments.punishmentAdd('mute', {time: duration}, client.user.id, `AUTOMOD:${reason}`, message.author, message.member as Discord.GuildMember); await client.punishments.punishmentAdd('mute', {time: duration}, client.user.id, `AUTOMOD:${reason}`, message.author, message.member as Discord.GuildMember);
setTimeout(()=>{ setTimeout(()=>{
this.lockQuery.delete(message.author.id); this.lockQuery.delete(message.author.id);
Logger.console('log', 'Automod', `Lock released for ${message.author.tag}`); Logger.console('log', 'AUTOMOD', `Lock released for ${message.author.tag}`);
}, 3500); // Wait 3.5 seconds before releasing the lock. }, 3500); // Wait 3.5 seconds before releasing the lock.
} }
delete client.repeatedMessages[message.author.id]; delete client.repeatedMessages[message.author.id];

View File

@ -2,4 +2,5 @@ import dayjs from 'dayjs';
export default class Logger { export default class Logger {
public static console =(logType:'log'|'error', prefix:string, message:any)=>console[logType](`[${dayjs().format('DD/MM/YY HH:mm:ss')}]`, `[${prefix}]`, message); public static console =(logType:'log'|'error', prefix:string, message:any)=>console[logType](`[${dayjs().format('DD/MM/YY HH:mm:ss')}]`, `[${prefix}]`, message);
public static debug =(prefix:string, message:any)=>console.log(`[${dayjs().format('DD/MM/YY HH:mm:ss')}]`, `[${prefix}:DEBUG]`, message);
} }

View File

@ -114,7 +114,7 @@ export class UserLevelsSvc {
)) ))
]}); ]});
} catch (why) { } catch (why) {
Logger.console('error', 'Cron:resetAllData:DEBUG', why) Logger.debug('Cron:resetAllData', why)
} }
// Reset LRSstart to current Epoch and save it to config file // Reset LRSstart to current Epoch and save it to config file

View File

@ -43,7 +43,7 @@ export default async(client:TClient)=>{
continue; continue;
} }
if (getVideoId(1) === cachedVideoId) { if (getVideoId(1) === cachedVideoId) {
Logger.console('log', 'YTModule:DEBUG', `New video uploaded by ${YTChannelName} and notification sent to Discord`) Logger.debug('YTModule', `New video uploaded by ${YTChannelName} and notification sent to Discord`)
await CacheServer.delete(cacheKey).then(async()=>await CacheServer.set(cacheKey, getVideoId(0), false).then(async()=>await CacheServer.expiry(cacheKey, cacheExpiry))); await CacheServer.delete(cacheKey).then(async()=>await CacheServer.set(cacheKey, getVideoId(0), false).then(async()=>await CacheServer.expiry(cacheKey, cacheExpiry)));
(client.channels.resolve(DiscordChannelID) as TextChannel).send({ (client.channels.resolve(DiscordChannelID) as TextChannel).send({