Fix alternates DM to actually notify people and make english more endlish in message
This commit is contained in:
parent
85b843e0e2
commit
e63818cf7a
|
@ -137,7 +137,7 @@ export const notifyEventMembers = async (bot: Bot, event: ActiveEvent, secondTry
|
||||||
export const lockEvent = async (bot: Bot, event: ActiveEvent, secondTry = false): Promise<boolean> => {
|
export const lockEvent = async (bot: Bot, event: ActiveEvent, secondTry = false): Promise<boolean> => {
|
||||||
const eventMessage = await bot.helpers.getMessage(event.channelId, event.messageId).catch((e: Error) => utils.commonLoggers.messageGetError('notificationSystem.ts@lock', 'get event', e));
|
const eventMessage = await bot.helpers.getMessage(event.channelId, event.messageId).catch((e: Error) => utils.commonLoggers.messageGetError('notificationSystem.ts@lock', 'get event', e));
|
||||||
if (eventMessage?.embeds[0].fields) {
|
if (eventMessage?.embeds[0].fields) {
|
||||||
const [currentMemberCount, maxMemberCount] = getEventMemberCount(eventMessage.embeds[0].fields[LfgEmbedIndexes.Activity].name);
|
const [currentMemberCount, maxMemberCount] = getEventMemberCount(eventMessage.embeds[0].fields[LfgEmbedIndexes.JoinedMembers].name);
|
||||||
const alternates = getLfgMembers(eventMessage.embeds[0].fields[LfgEmbedIndexes.AlternateMembers].value);
|
const alternates = getLfgMembers(eventMessage.embeds[0].fields[LfgEmbedIndexes.AlternateMembers].value);
|
||||||
const memberMentionString = joinWithAnd(alternates.map((member) => `<@${member.id}>`));
|
const memberMentionString = joinWithAnd(alternates.map((member) => `<@${member.id}>`));
|
||||||
|
|
||||||
|
@ -146,6 +146,7 @@ export const lockEvent = async (bot: Bot, event: ActiveEvent, secondTry = false)
|
||||||
if (alternatesNeeded) {
|
if (alternatesNeeded) {
|
||||||
const activityName = `\`${eventMessage.embeds[0].fields[LfgEmbedIndexes.Activity].name} ${eventMessage.embeds[0].fields[LfgEmbedIndexes.Activity].value}\``;
|
const activityName = `\`${eventMessage.embeds[0].fields[LfgEmbedIndexes.Activity].name} ${eventMessage.embeds[0].fields[LfgEmbedIndexes.Activity].value}\``;
|
||||||
const guildName = await getGuildName(bot, event.guildId);
|
const guildName = await getGuildName(bot, event.guildId);
|
||||||
|
const peopleShort = maxMemberCount - currentMemberCount;
|
||||||
|
|
||||||
// Send the notifications to the members
|
// Send the notifications to the members
|
||||||
alternates.forEach(async (member) => {
|
alternates.forEach(async (member) => {
|
||||||
|
@ -153,9 +154,7 @@ export const lockEvent = async (bot: Bot, event: ActiveEvent, secondTry = false)
|
||||||
embeds: [{
|
embeds: [{
|
||||||
color: infoColor1,
|
color: infoColor1,
|
||||||
title: `Hello ${member.name}! An activity in ${guildName} may need your help.`,
|
title: `Hello ${member.name}! An activity in ${guildName} may need your help.`,
|
||||||
description: `The ${activityName} in ${guildName} that you marked yourself as an alternate for may be \`${
|
description: `The ${activityName} in ${guildName} that you marked yourself as an alternate for may be \`${peopleShort}\` ${peopleShort === 1 ? 'person' : 'people'} short. If you are available, please join up with them.`,
|
||||||
maxMemberCount - currentMemberCount
|
|
||||||
}\` people short. If you are available, please join up with them.`,
|
|
||||||
}, eventMessage.embeds[0]],
|
}, eventMessage.embeds[0]],
|
||||||
}).catch((e: Error) => utils.commonLoggers.messageSendError('notificationSystem.ts@lock', 'send DM fail', e));
|
}).catch((e: Error) => utils.commonLoggers.messageSendError('notificationSystem.ts@lock', 'send DM fail', e));
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue