continue work on retrofit
This commit is contained in:
parent
8e912ca8f2
commit
3b1e6b6370
|
@ -254,20 +254,24 @@ The Discord Slash Command system will ensure you provide all the required detail
|
||||||
if (oldEvent && oldEvent.embeds[0].fields && oldEvent.embeds[0].footer) {
|
if (oldEvent && oldEvent.embeds[0].fields && oldEvent.embeds[0].footer) {
|
||||||
const eventMembers = [...getLfgMembers(oldEvent.embeds[0].fields[LfgEmbedIndexes.JoinedMembers].value), ...getLfgMembers(oldEvent.embeds[0].fields[LfgEmbedIndexes.AlternateMembers].value)]
|
const eventMembers = [...getLfgMembers(oldEvent.embeds[0].fields[LfgEmbedIndexes.JoinedMembers].value), ...getLfgMembers(oldEvent.embeds[0].fields[LfgEmbedIndexes.AlternateMembers].value)]
|
||||||
const eventDateTime = new Date((oldEvent.embeds[0].fields[LfgEmbedIndexes.StartTime].value.split('tz#')[1] || ' ').slice(0, -1));
|
const eventDateTime = new Date((oldEvent.embeds[0].fields[LfgEmbedIndexes.StartTime].value.split('tz#')[1] || ' ').slice(0, -1));
|
||||||
const eventDateTimeStr = (oldEvent.embeds[0].fields[LfgEmbedIndexes.StartTime].value.split('](')[0] || ' ').slice(1);
|
console.log(oldEvent.embeds[0].fields[LfgEmbedIndexes.StartTime].value)
|
||||||
oldEvent.embeds[0].fields[LfgEmbedIndexes.StartTime].value = generateTimeFieldStr(eventDateTimeStr, eventDateTime);
|
if (!isNaN(eventDateTime.getTime())) {
|
||||||
oldEvent.embeds[0].footer.text = oldEvent.embeds[0].footer.text.split(' | ')[0];
|
const eventDateTimeStr = (oldEvent.embeds[0].fields[LfgEmbedIndexes.StartTime].value.split('](')[0] || ' ').slice(1);
|
||||||
const ownerName = oldEvent.embeds[0].footer.text.split(': ')[1];
|
oldEvent.embeds[0].fields[LfgEmbedIndexes.StartTime].value = generateTimeFieldStr(eventDateTimeStr, eventDateTime);
|
||||||
const ownerId = eventMembers.find((member) => ownerName === member.name)?.id || 0n;
|
oldEvent.embeds[0].footer.text = oldEvent.embeds[0].footer.text.split(' | ')[0];
|
||||||
oldEvent.embeds[0].footer.iconUrl = `${config.links.creatorIcon}#${ownerId}`;
|
const ownerName = oldEvent.embeds[0].footer.text.split(': ')[1];
|
||||||
bot.helpers.editMessage(oldEvent.channelId, oldEvent.id, {
|
const ownerId = eventMembers.find((member) => ownerName === member.name)?.id || 0n;
|
||||||
content: '',
|
oldEvent.embeds[0].footer.iconUrl = `${config.links.creatorIcon}#${ownerId}`;
|
||||||
embeds: [oldEvent.embeds[0]],
|
bot.helpers.editMessage(oldEvent.channelId, oldEvent.id, {
|
||||||
components: [{
|
content: '',
|
||||||
type: MessageComponentTypes.ActionRow,
|
embeds: [oldEvent.embeds[0]],
|
||||||
components: generateLFGButtons(false),
|
components: [{
|
||||||
}],
|
type: MessageComponentTypes.ActionRow,
|
||||||
})
|
components: generateLFGButtons(false),
|
||||||
|
}],
|
||||||
|
}).catch((e: Error) => utils.commonLoggers.messageEditError('setup.ts', 'retrofit event', e));
|
||||||
|
dbClient.execute(queries.insertEvent, [oldEvent.id, oldEvent.channelId, interaction.guildId, ownerId, eventDateTime]).catch((e) => utils.commonLoggers.dbError('setup.ts@retrofit', 'INSERT event to DB', e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue