handle "major" sonar issues
This commit is contained in:
parent
4cb6d624f3
commit
9e4c351a85
|
@ -131,6 +131,8 @@ export const createLFGPost = (
|
|||
dateTimeValid: boolean,
|
||||
): InteractionResponse => {
|
||||
const icsDetails = `${category}: ${activity.name}`;
|
||||
const dateTimePastFutureStr = dateTimeValid ? 'in the past' : 'with an invalid date/time';
|
||||
const dateTimeValidStr = dateTimeValid ? 'in the future' : 'valid';
|
||||
return {
|
||||
type: InteractionResponseTypes.ChannelMessageWithSource,
|
||||
data: {
|
||||
|
@ -139,9 +141,7 @@ export const createLFGPost = (
|
|||
? `Please verify the information below, then click on the \`${createEventBtnName}\` or \`${createWhitelistedBtnName}\` button, or change the event \`Date/Time\` or \`Description\` with the \`${editEventDetailsBtnName}\` button below. \n\n${
|
||||
selfDestructMessage(new Date().getTime())
|
||||
}`
|
||||
: `You cannot create an event ${dateTimeValid ? 'in the past' : 'with an invalid date/time'}. Please change the event's \`Date/Time\` to be ${
|
||||
dateTimeValid ? 'in the future' : 'valid'
|
||||
} with the \`${editEventDetailsBtnName}\` button below.`,
|
||||
: `You cannot create an event ${dateTimePastFutureStr}. Please change the event's \`Date/Time\` to be ${dateTimeValidStr} with the \`${editEventDetailsBtnName}\` button below.`,
|
||||
embeds: [{
|
||||
color: eventInFuture ? successColor : warnColor,
|
||||
fields: [{
|
||||
|
|
|
@ -56,7 +56,6 @@ const execute = async (bot: Bot, interaction: Interaction) => {
|
|||
}
|
||||
|
||||
if (eventMessage && eventMessage.embeds[0].fields) {
|
||||
// eventMessage.embeds[0].fields[LfgEmbedIndexes.Description].value = newDescription || noDescProvided;
|
||||
eventMessage.embeds[0].fields[LfgEmbedIndexes.StartTime].value = generateTimeFieldStr(eventDateTimeStr, eventDateTime);
|
||||
const tIdx = eventMessage.embeds[0].fields[LfgEmbedIndexes.ICSLink].value.indexOf('?t=') + 3;
|
||||
const nIdx = eventMessage.embeds[0].fields[LfgEmbedIndexes.ICSLink].value.indexOf('&n=');
|
||||
|
|
|
@ -64,10 +64,14 @@ export const ready = (rawBot: Bot) => {
|
|||
|
||||
// Interval to handle updating botList statistics
|
||||
if (botListPosterIntervalId) clearInterval(botListPosterIntervalId);
|
||||
LOCALMODE ? log(LT.INFO, 'updateListStatistics not running') : botListPosterIntervalId = setInterval(() => {
|
||||
if (LOCALMODE) {
|
||||
log(LT.INFO, 'updateListStatistics not running');
|
||||
} else {
|
||||
botListPosterIntervalId = setInterval(() => {
|
||||
log(LT.LOG, 'Updating all bot lists statistics');
|
||||
updateBotListStatistics(bot.guilds.size + bot.dispatchedGuildIds.size);
|
||||
}, 86400000);
|
||||
}
|
||||
|
||||
// setTimeout added to make sure the startup message does not error out
|
||||
setTimeout(() => {
|
||||
|
|
|
@ -59,8 +59,9 @@ The message containing this event may have been deleted by a moderator or admini
|
|||
}
|
||||
|
||||
// Log this to bot's log channel
|
||||
const dmSuccessStr = dmSuccess ? 'SUCCESSFULLY' : 'NOT';
|
||||
bot.helpers.sendMessage(config.logChannel, {
|
||||
content: secondFailure ? `Hey <@${config.owner}>, something may have gone wrong. The owner of this event was ${dmSuccess ? 'SUCCESSFULLY' : 'NOT'} notified.` : undefined,
|
||||
content: secondFailure ? `Hey <@${config.owner}>, something may have gone wrong. The owner of this event was ${dmSuccessStr} notified.` : undefined,
|
||||
embeds: [{
|
||||
color: secondFailure ? failColor : warnColor,
|
||||
title: `Failed to ${stepName} an event in ${guildName}. This is the ${secondFailure ? 'second' : 'first'} attempt.`,
|
||||
|
|
Loading…
Reference in New Issue