sonar cleanup
This commit is contained in:
		
							parent
							
								
									85cb556763
								
							
						
					
					
						commit
						6918cc70a4
					
				| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
export const config = {
 | 
					export const config = {
 | 
				
			||||||
	'name': 'Sweeper Bot', // Name of the bot
 | 
						'name': 'Sweeper Bot', // Name of the bot
 | 
				
			||||||
	'version': '0.2.0', // Version of the bot
 | 
						'version': '0.2.1', // Version of the bot
 | 
				
			||||||
	'token': 'the_bot_token', // Discord API Token for this bot
 | 
						'token': 'the_bot_token', // Discord API Token for this bot
 | 
				
			||||||
	'localtoken': 'local_testing_token', // Discord API Token for a secondary OPTIONAL testing bot, THIS MUST BE DIFFERENT FROM "token"
 | 
						'localtoken': 'local_testing_token', // Discord API Token for a secondary OPTIONAL testing bot, THIS MUST BE DIFFERENT FROM "token"
 | 
				
			||||||
	'prefix': 's!', // Prefix for all commands
 | 
						'prefix': 's!', // Prefix for all commands
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,9 +14,6 @@ import utils from '../utils.ts';
 | 
				
			||||||
export const handleMentions = (bot: Bot, message: Message) => {
 | 
					export const handleMentions = (bot: Bot, message: Message) => {
 | 
				
			||||||
	log(LT.LOG, `Handling @mention message: ${utils.jsonStringifyBig(message)}`);
 | 
						log(LT.LOG, `Handling @mention message: ${utils.jsonStringifyBig(message)}`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Light telemetry to see how many times a command is being run
 | 
					 | 
				
			||||||
	// dbClient.execute(queries.callIncCnt('mention')).catch((e) => utils.commonLoggers.dbError('handleMentions.ts:17', 'call sproc INC_CNT on', e));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	bot.helpers.sendMessage(message.channelId, {
 | 
						bot.helpers.sendMessage(message.channelId, {
 | 
				
			||||||
		embeds: [{
 | 
							embeds: [{
 | 
				
			||||||
			color: infoColor1,
 | 
								color: infoColor1,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,9 +9,6 @@ import { infoColor2 } from '../commandUtils.ts';
 | 
				
			||||||
import utils from '../utils.ts';
 | 
					import utils from '../utils.ts';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const help = (bot: Bot, message: Message) => {
 | 
					export const help = (bot: Bot, message: Message) => {
 | 
				
			||||||
	// Light telemetry to see how many times a command is being run
 | 
					 | 
				
			||||||
	// dbClient.execute(queries.callIncCnt('help')).catch((e) => utils.commonLoggers.dbError('htlp.ts:15', 'call sproc INC_CNT on', e));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	bot.helpers.sendMessage(message.channelId, {
 | 
						bot.helpers.sendMessage(message.channelId, {
 | 
				
			||||||
		embeds: [{
 | 
							embeds: [{
 | 
				
			||||||
			color: infoColor2,
 | 
								color: infoColor2,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,9 +9,6 @@ import { infoColor2 } from '../commandUtils.ts';
 | 
				
			||||||
import utils from '../utils.ts';
 | 
					import utils from '../utils.ts';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const info = (bot: Bot, message: Message) => {
 | 
					export const info = (bot: Bot, message: Message) => {
 | 
				
			||||||
	// Light telemetry to see how many times a command is being run
 | 
					 | 
				
			||||||
	// dbClient.execute(queries.callIncCnt('info')).catch((e) => utils.commonLoggers.dbError('info.ts:12', 'call sproc INC_CNT on', e));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	bot.helpers.sendMessage(message.channelId, {
 | 
						bot.helpers.sendMessage(message.channelId, {
 | 
				
			||||||
		embeds: [{
 | 
							embeds: [{
 | 
				
			||||||
			color: infoColor2,
 | 
								color: infoColor2,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,9 +8,6 @@ import { generatePing } from '../commandUtils.ts';
 | 
				
			||||||
import utils from '../utils.ts';
 | 
					import utils from '../utils.ts';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const ping = async (bot: Bot, message: Message) => {
 | 
					export const ping = async (bot: Bot, message: Message) => {
 | 
				
			||||||
	// Light telemetry to see how many times a command is being run
 | 
					 | 
				
			||||||
	// dbClient.execute(queries.callIncCnt('ping')).catch((e) => utils.commonLoggers.dbError('ping.ts:14', 'call sproc INC_CNT on', e));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// Calculates ping between sending a message and editing it, giving a nice round-trip latency.
 | 
						// Calculates ping between sending a message and editing it, giving a nice round-trip latency.
 | 
				
			||||||
	try {
 | 
						try {
 | 
				
			||||||
		const m = await bot.helpers.sendMessage(message.channelId, generatePing(-1));
 | 
							const m = await bot.helpers.sendMessage(message.channelId, generatePing(-1));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,9 +11,6 @@ import { failColor, generateReport, successColor } from '../commandUtils.ts';
 | 
				
			||||||
import utils from '../utils.ts';
 | 
					import utils from '../utils.ts';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const report = (bot: Bot, message: Message, args: string[]) => {
 | 
					export const report = (bot: Bot, message: Message, args: string[]) => {
 | 
				
			||||||
	// Light telemetry to see how many times a command is being run
 | 
					 | 
				
			||||||
	// dbClient.execute(queries.callIncCnt('report')).catch((e) => utils.commonLoggers.dbError('report.ts:17', 'call sproc INC_CNT on', e));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (args.join(' ')) {
 | 
						if (args.join(' ')) {
 | 
				
			||||||
		sendMessage(bot, config.reportChannel, generateReport(args.join(' '))).catch((e: Error) => utils.commonLoggers.messageSendError('report.ts:22', message, e));
 | 
							sendMessage(bot, config.reportChannel, generateReport(args.join(' '))).catch((e: Error) => utils.commonLoggers.messageSendError('report.ts:22', message, e));
 | 
				
			||||||
		bot.helpers.sendMessage(message.channelId, {
 | 
							bot.helpers.sendMessage(message.channelId, {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,9 +10,6 @@ import { failColor, successColor } from '../commandUtils.ts';
 | 
				
			||||||
import utils from '../utils.ts';
 | 
					import utils from '../utils.ts';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const sendMsg = (bot: Bot, message: Message, args: string[]) => {
 | 
					export const sendMsg = (bot: Bot, message: Message, args: string[]) => {
 | 
				
			||||||
	// Light telemetry to see how many times a command is being run
 | 
					 | 
				
			||||||
	// dbClient.execute(queries.callIncCnt('report')).catch((e) => utils.commonLoggers.dbError('report.ts:17', 'call sproc INC_CNT on', e));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	try {
 | 
						try {
 | 
				
			||||||
		const channelId = BigInt(args.shift() || '0');
 | 
							const channelId = BigInt(args.shift() || '0');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,9 +9,6 @@ import { infoColor1 } from '../commandUtils.ts';
 | 
				
			||||||
import utils from '../utils.ts';
 | 
					import utils from '../utils.ts';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const version = (bot: Bot, message: Message) => {
 | 
					export const version = (bot: Bot, message: Message) => {
 | 
				
			||||||
	// Light telemetry to see how many times a command is being run
 | 
					 | 
				
			||||||
	// dbClient.execute(queries.callIncCnt('version')).catch((e) => utils.commonLoggers.dbError('version.ts:15', 'call sproc INC_CNT on', e));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	bot.helpers.sendMessage(message.channelId, {
 | 
						bot.helpers.sendMessage(message.channelId, {
 | 
				
			||||||
		embeds: [{
 | 
							embeds: [{
 | 
				
			||||||
			color: infoColor1,
 | 
								color: infoColor1,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,8 +16,5 @@ export const messageUpdate = (bot: Bot, message: Message) => {
 | 
				
			||||||
		if (config.pollChannels.includes(message.channelId)) {
 | 
							if (config.pollChannels.includes(message.channelId)) {
 | 
				
			||||||
			functions.pollReactions(bot, message, true);
 | 
								functions.pollReactions(bot, message, true);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					 | 
				
			||||||
		// return as we are done handling this command
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue