마수현
Committed by Ma Suhyeon

Edit meta message to flex message

Showing 59 changed files with 34 additions and 2 deletions
......@@ -116,7 +116,7 @@ async function recommendMeta(replyToken) {
sql = 'SELECT `alias` FROM character_aliases WHERE character_id=? AND is_name=1';
for(let i = 1; i <= 8; i++) {
[results] = await pool.query(sql, [row[`character_${i}`]]);
chars.push(results[0].alias);
chars.push({id: row[`character_${i}`], name: results[0].alias});
}
let traitCnt = new Map();
......@@ -153,8 +153,40 @@ async function recommendMeta(replyToken) {
[results] = await pool.query('SELECT `name` FROM traits WHERE `id`=?', [row.chosen]);
messages.push({
type: 'flex',
altText: traits.join(', ') + '\n' + chars.join(', ') + '\n' + '선택받은 자: ' + results[0].name,
contents: {
type: 'bubble',
size: 'giga',
body: {
type: 'box',
layout: 'vertical',
contents: [
{type: 'text', text: '시너지'},
{
type: 'text',
text: traits.join(', '),
wrap: true
/*layout: 'horizontal',
contents: traits.map(e => ({
type: 'text',
text: traits.join(', ') + '\n' + chars.join(', ') + '\n' + '선택받은 자: ' + results[0].name
text: e
}))*/
},
{type: 'text', text: '캐릭터'},
{
type: 'box',
layout: 'horizontal',
contents: chars.map(e => ({
type: 'image',
url: `https://jongro3.ga/images/champions/${e.id}.png`,
size: 'xxs'
}))
},
{type: 'text', text: chars.map(e => e.name).join(', '), wrap: true},
]
}
}
});
}
......