linting/type cleanup
This commit is contained in:
		
							parent
							
								
									103ad8a8f5
								
							
						
					
					
						commit
						74c733308f
					
				| 
						 | 
					@ -9,7 +9,7 @@ import auditCommands from './auditCmd/_index.ts';
 | 
				
			||||||
import { failColor } from '../commandUtils.ts';
 | 
					import { failColor } from '../commandUtils.ts';
 | 
				
			||||||
import utils from '../utils.ts';
 | 
					import utils from '../utils.ts';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const audit = async (message: DiscordenoMessage, args: string[]) => {
 | 
					export const audit = (message: DiscordenoMessage, args: string[]) => {
 | 
				
			||||||
  // Light telemetry to see how many times a command is being run
 | 
					  // Light telemetry to see how many times a command is being run
 | 
				
			||||||
  dbClient.execute(queries.callIncCnt('audit')).catch((e) => utils.commonLoggers.dbError('audit.ts:16', 'call sproc INC_CNT on', e));
 | 
					  dbClient.execute(queries.callIncCnt('audit')).catch((e) => utils.commonLoggers.dbError('audit.ts:16', 'call sproc INC_CNT on', e));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,6 +8,12 @@ import { infoColor2 } from '../../commandUtils.ts';
 | 
				
			||||||
import { compilingStats } from '../../commonEmbeds.ts';
 | 
					import { compilingStats } from '../../commonEmbeds.ts';
 | 
				
			||||||
import utils from '../../utils.ts';
 | 
					import utils from '../../utils.ts';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					interface DBSizeData {
 | 
				
			||||||
 | 
					  table: string;
 | 
				
			||||||
 | 
					  size: string;
 | 
				
			||||||
 | 
					  rows: number;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const auditDB = async (message: DiscordenoMessage) => {
 | 
					export const auditDB = async (message: DiscordenoMessage) => {
 | 
				
			||||||
  try {
 | 
					  try {
 | 
				
			||||||
    const m = await message.send(compilingStats);
 | 
					    const m = await message.send(compilingStats);
 | 
				
			||||||
| 
						 | 
					@ -17,7 +23,7 @@ export const auditDB = async (message: DiscordenoMessage) => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Turn all tables into embed fields, currently only properly will handle 25 tables, but we'll fix that when artificer gets 26 tables
 | 
					    // Turn all tables into embed fields, currently only properly will handle 25 tables, but we'll fix that when artificer gets 26 tables
 | 
				
			||||||
    const embedFields: Array<EmbedField> = [];
 | 
					    const embedFields: Array<EmbedField> = [];
 | 
				
			||||||
    auditQuery.forEach((row: any) => {
 | 
					    auditQuery.forEach((row: DBSizeData) => {
 | 
				
			||||||
      embedFields.push({
 | 
					      embedFields.push({
 | 
				
			||||||
        name: `${row.table}`,
 | 
					        name: `${row.table}`,
 | 
				
			||||||
        value: `**Size:** ${row.size} MB
 | 
					        value: `**Size:** ${row.size} MB
 | 
				
			||||||
| 
						 | 
					@ -39,6 +45,6 @@ export const auditDB = async (message: DiscordenoMessage) => {
 | 
				
			||||||
      ],
 | 
					      ],
 | 
				
			||||||
    }).catch((e: Error) => utils.commonLoggers.messageEditError('auditDB.ts:43', message, e));
 | 
					    }).catch((e: Error) => utils.commonLoggers.messageEditError('auditDB.ts:43', message, e));
 | 
				
			||||||
  } catch (e) {
 | 
					  } catch (e) {
 | 
				
			||||||
    utils.commonLoggers.messageSendError('auditDB.ts:45', message, e);
 | 
					    utils.commonLoggers.messageSendError('auditDB.ts:45', message, e as Error);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,7 +9,7 @@ import { failColor, infoColor2 } from '../commandUtils.ts';
 | 
				
			||||||
import utils from '../utils.ts';
 | 
					import utils from '../utils.ts';
 | 
				
			||||||
import intervals from '../intervals.ts';
 | 
					import intervals from '../intervals.ts';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const heatmap = async (message: DiscordenoMessage) => {
 | 
					export const heatmap = (message: DiscordenoMessage) => {
 | 
				
			||||||
  // Light telemetry to see how many times a command is being run
 | 
					  // Light telemetry to see how many times a command is being run
 | 
				
			||||||
  dbClient.execute(queries.callIncCnt('heatmap')).catch((e) => utils.commonLoggers.dbError('heatmap.ts:14', 'call sproc INC_CNT on', e));
 | 
					  dbClient.execute(queries.callIncCnt('heatmap')).catch((e) => utils.commonLoggers.dbError('heatmap.ts:14', 'call sproc INC_CNT on', e));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,7 +31,7 @@ export const optIn = async (message: DiscordenoMessage) => {
 | 
				
			||||||
          ],
 | 
					          ],
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
        .catch((e: Error) => utils.commonLoggers.messageSendError('optIn.ts:27', message, e));
 | 
					        .catch((e: Error) => utils.commonLoggers.messageSendError('optIn.ts:27', message, e));
 | 
				
			||||||
    } catch (err) {
 | 
					    } catch (_e) {
 | 
				
			||||||
      message
 | 
					      message
 | 
				
			||||||
        .reply({
 | 
					        .reply({
 | 
				
			||||||
          embeds: [
 | 
					          embeds: [
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -29,7 +29,7 @@ export const optOut = async (message: DiscordenoMessage) => {
 | 
				
			||||||
        ],
 | 
					        ],
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
      .catch((e: Error) => utils.commonLoggers.messageSendError('optOut.ts:25', message, e));
 | 
					      .catch((e: Error) => utils.commonLoggers.messageSendError('optOut.ts:25', message, e));
 | 
				
			||||||
  } catch (err) {
 | 
					  } catch (_e) {
 | 
				
			||||||
    message
 | 
					    message
 | 
				
			||||||
      .reply({
 | 
					      .reply({
 | 
				
			||||||
        embeds: [
 | 
					        embeds: [
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,6 +16,6 @@ export const ping = async (message: DiscordenoMessage) => {
 | 
				
			||||||
    const m = await message.send(generatePing(-1));
 | 
					    const m = await message.send(generatePing(-1));
 | 
				
			||||||
    m.edit(generatePing(m.timestamp - message.timestamp));
 | 
					    m.edit(generatePing(m.timestamp - message.timestamp));
 | 
				
			||||||
  } catch (e) {
 | 
					  } catch (e) {
 | 
				
			||||||
    utils.commonLoggers.messageSendError('ping.ts:23', message, e);
 | 
					    utils.commonLoggers.messageSendError('ping.ts:23', message, e as Error);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -44,6 +44,6 @@ export const stats = async (message: DiscordenoMessage) => {
 | 
				
			||||||
      ),
 | 
					      ),
 | 
				
			||||||
    ).catch((e: Error) => utils.commonLoggers.messageEditError('stats.ts:38', m, e));
 | 
					    ).catch((e: Error) => utils.commonLoggers.messageEditError('stats.ts:38', m, e));
 | 
				
			||||||
  } catch (e) {
 | 
					  } catch (e) {
 | 
				
			||||||
    utils.commonLoggers.messageSendError('stats.ts:41', message, e);
 | 
					    utils.commonLoggers.messageSendError('stats.ts:41', message, e as Error);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -62,7 +62,8 @@ const updateListStatistics = (botID: bigint, serverCount: number): void => {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        log(LT.INFO, `Posted server count to ${e.name}.  Results: ${JSON.stringify(response)}`);
 | 
					        log(LT.INFO, `Posted server count to ${e.name}.  Results: ${JSON.stringify(response)}`);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    } catch (err) {
 | 
					    } catch (error) {
 | 
				
			||||||
 | 
					      const err = error as Error;
 | 
				
			||||||
      log(LT.ERROR, `Failed to update statistics for ${e.name} | Error: ${err.name} - ${err.message}`);
 | 
					      log(LT.ERROR, `Failed to update statistics for ${e.name} | Error: ${err.name} - ${err.message}`);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
| 
						 | 
					@ -103,7 +104,8 @@ const updateHourlyRates = async () => {
 | 
				
			||||||
    if (previousHours.length > hoursToKeep) {
 | 
					    if (previousHours.length > hoursToKeep) {
 | 
				
			||||||
      previousHours.unshift();
 | 
					      previousHours.unshift();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  } catch (e) {
 | 
					  } catch (err) {
 | 
				
			||||||
 | 
					    const e = err as Error;
 | 
				
			||||||
    log(LT.ERROR, `Something went wrong in previousHours interval | Error: ${e.name} - ${e.message}`);
 | 
					    log(LT.ERROR, `Something went wrong in previousHours interval | Error: ${e.name} - ${e.message}`);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue