Formatting with Prettier
This commit is contained in:
60
server.ts
60
server.ts
@@ -19,25 +19,59 @@ let db: Database = null;
|
||||
async function openDb() {
|
||||
return open({
|
||||
filename: 'discord/db.sqlite',
|
||||
driver: Database3
|
||||
driver: Database3,
|
||||
});
|
||||
}
|
||||
|
||||
app.get('/', async (req, res) => {
|
||||
const msg1 = await db.all<[ScoreboardMessageRow]>('SELECT * FROM messages ORDER BY reaction_1_count DESC LIMIT 5');
|
||||
const msg2 = await db.all<[ScoreboardMessageRow]>('SELECT * FROM messages ORDER BY reaction_2_count DESC LIMIT 5');
|
||||
const msg3 = await db.all<[ScoreboardMessageRow]>('SELECT * FROM messages ORDER BY reaction_3_count DESC LIMIT 5');
|
||||
const msg4 = await db.all<[ScoreboardMessageRow]>('SELECT * FROM messages ORDER BY reaction_4_count DESC LIMIT 5');
|
||||
const msg5 = await db.all<[ScoreboardMessageRow]>('SELECT * FROM messages ORDER BY reaction_5_count DESC LIMIT 5');
|
||||
const bestMsg = await db.all<[ScoreboardMessageRow]>('SELECT *, SUM(reaction_1_count)+SUM(reaction_2_count)+SUM(reaction_3_count)+SUM(reaction_4_count)+SUM(reaction_5_count) AS all_reacts FROM messages GROUP BY id ORDER BY all_reacts DESC LIMIT 5');
|
||||
const msg1 = await db.all<[ScoreboardMessageRow]>(
|
||||
'SELECT * FROM messages ORDER BY reaction_1_count DESC LIMIT 5'
|
||||
);
|
||||
const msg2 = await db.all<[ScoreboardMessageRow]>(
|
||||
'SELECT * FROM messages ORDER BY reaction_2_count DESC LIMIT 5'
|
||||
);
|
||||
const msg3 = await db.all<[ScoreboardMessageRow]>(
|
||||
'SELECT * FROM messages ORDER BY reaction_3_count DESC LIMIT 5'
|
||||
);
|
||||
const msg4 = await db.all<[ScoreboardMessageRow]>(
|
||||
'SELECT * FROM messages ORDER BY reaction_4_count DESC LIMIT 5'
|
||||
);
|
||||
const msg5 = await db.all<[ScoreboardMessageRow]>(
|
||||
'SELECT * FROM messages ORDER BY reaction_5_count DESC LIMIT 5'
|
||||
);
|
||||
const bestMsg = await db.all<[ScoreboardMessageRow]>(
|
||||
'SELECT *, SUM(reaction_1_count)+SUM(reaction_2_count)+SUM(reaction_3_count)+SUM(reaction_4_count)+SUM(reaction_5_count) AS all_reacts FROM messages GROUP BY id ORDER BY all_reacts DESC LIMIT 5'
|
||||
);
|
||||
|
||||
const funniest = await db.all<[ScoreboardUserRow]>('SELECT * FROM users ORDER BY reaction_1_total DESC LIMIT 15');
|
||||
const realest = await db.all<[ScoreboardUserRow]>('SELECT * FROM users ORDER BY reaction_2_total DESC LIMIT 15');
|
||||
const cunniest = await db.all<[ScoreboardUserRow]>('SELECT * FROM users ORDER BY reaction_3_total DESC LIMIT 15');
|
||||
const based = await db.all<[ScoreboardUserRow]>('SELECT * FROM users ORDER BY reaction_4_total DESC LIMIT 15');
|
||||
const agreeable = await db.all<[ScoreboardUserRow]>('SELECT * FROM users ORDER BY reaction_5_total DESC LIMIT 15');
|
||||
const funniest = await db.all<[ScoreboardUserRow]>(
|
||||
'SELECT * FROM users ORDER BY reaction_1_total DESC LIMIT 15'
|
||||
);
|
||||
const realest = await db.all<[ScoreboardUserRow]>(
|
||||
'SELECT * FROM users ORDER BY reaction_2_total DESC LIMIT 15'
|
||||
);
|
||||
const cunniest = await db.all<[ScoreboardUserRow]>(
|
||||
'SELECT * FROM users ORDER BY reaction_3_total DESC LIMIT 15'
|
||||
);
|
||||
const based = await db.all<[ScoreboardUserRow]>(
|
||||
'SELECT * FROM users ORDER BY reaction_4_total DESC LIMIT 15'
|
||||
);
|
||||
const agreeable = await db.all<[ScoreboardUserRow]>(
|
||||
'SELECT * FROM users ORDER BY reaction_5_total DESC LIMIT 15'
|
||||
);
|
||||
|
||||
res.render('index', { funniest, realest, cunniest, based, agreeable, msg1, msg2, msg3, msg4, msg5, bestMsg });
|
||||
res.render('index', {
|
||||
funniest,
|
||||
realest,
|
||||
cunniest,
|
||||
based,
|
||||
agreeable,
|
||||
msg1,
|
||||
msg2,
|
||||
msg3,
|
||||
msg4,
|
||||
msg5,
|
||||
bestMsg,
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(port, async () => {
|
||||
|
||||
Reference in New Issue
Block a user