add catches to all messages
This commit is contained in:
		
							parent
							
								
									dba1976a8e
								
							
						
					
					
						commit
						bff208d560
					
				| 
						 | 
					@ -62,7 +62,9 @@ export const getModifiers = (m: DiscordenoMessage, args: string[], command: stri
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				if (modifiers.gms.length < 1) {
 | 
									if (modifiers.gms.length < 1) {
 | 
				
			||||||
					// If -gm is on and none were found, throw an error
 | 
										// If -gm is on and none were found, throw an error
 | 
				
			||||||
					m.edit(generateRollError(errorType, 'Must specifiy at least one GM by @mentioning them'));
 | 
										m.edit(generateRollError(errorType, 'Must specifiy at least one GM by @mentioning them')).catch((e) => {
 | 
				
			||||||
 | 
											log(LT.ERROR, `Failed to edit message: ${JSON.stringify(m)} | ${JSON.stringify(e)}`);
 | 
				
			||||||
 | 
										});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					if (DEVMODE && config.logRolls) {
 | 
										if (DEVMODE && config.logRolls) {
 | 
				
			||||||
						// If enabled, log rolls so we can verify the bots math
 | 
											// If enabled, log rolls so we can verify the bots math
 | 
				
			||||||
| 
						 | 
					@ -79,7 +81,9 @@ export const getModifiers = (m: DiscordenoMessage, args: string[], command: stri
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (!args[i] || args[i].toLowerCase()[0] !== 'd' && args[i].toLowerCase()[0] !== 'a') {
 | 
									if (!args[i] || args[i].toLowerCase()[0] !== 'd' && args[i].toLowerCase()[0] !== 'a') {
 | 
				
			||||||
					// If -o is on and asc or desc was not specified, error out
 | 
										// If -o is on and asc or desc was not specified, error out
 | 
				
			||||||
					m.edit(generateRollError(errorType, 'Must specifiy `a` or `d` to order the rolls ascending or descending'));
 | 
										m.edit(generateRollError(errorType, 'Must specifiy `a` or `d` to order the rolls ascending or descending')).catch((e) => {
 | 
				
			||||||
 | 
											log(LT.ERROR, `Failed to edit message: ${JSON.stringify(m)} | ${JSON.stringify(e)}`);
 | 
				
			||||||
 | 
										});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					if (DEVMODE && config.logRolls) {
 | 
										if (DEVMODE && config.logRolls) {
 | 
				
			||||||
						// If enabled, log rolls so we can verify the bots math
 | 
											// If enabled, log rolls so we can verify the bots math
 | 
				
			||||||
| 
						 | 
					@ -106,7 +110,9 @@ export const getModifiers = (m: DiscordenoMessage, args: string[], command: stri
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// maxRoll and nominalRoll cannot both be on, throw an error
 | 
						// maxRoll and nominalRoll cannot both be on, throw an error
 | 
				
			||||||
	if (modifiers.maxRoll && modifiers.nominalRoll) {
 | 
						if (modifiers.maxRoll && modifiers.nominalRoll) {
 | 
				
			||||||
		m.edit(generateRollError(errorType, 'Cannot maximise and nominise the roll at the same time'));
 | 
							m.edit(generateRollError(errorType, 'Cannot maximise and nominise the roll at the same time')).catch((e) => {
 | 
				
			||||||
 | 
								log(LT.ERROR, `Failed to edit message: ${JSON.stringify(m)} | ${JSON.stringify(e)}`);
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (DEVMODE && config.logRolls) {
 | 
							if (DEVMODE && config.logRolls) {
 | 
				
			||||||
			// If enabled, log rolls so we can verify the bots math
 | 
								// If enabled, log rolls so we can verify the bots math
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -47,6 +47,8 @@ const handleRollWorker = async (rq: QueuedRoll) => {
 | 
				
			||||||
						<RollModifiers> {},
 | 
											<RollModifiers> {},
 | 
				
			||||||
					)).embed,
 | 
										)).embed,
 | 
				
			||||||
				],
 | 
									],
 | 
				
			||||||
 | 
								}).catch((e) => {
 | 
				
			||||||
 | 
									log(LT.ERROR, `Failed to edit message: ${JSON.stringify(rq.dd.m)} | ${JSON.stringify(e)}`);
 | 
				
			||||||
			});
 | 
								});
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}, config.limits.workerTimeout);
 | 
						}, config.limits.workerTimeout);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue