Merge branch 'main' of ssh://git.0xfffe.org/frostbide/frostbot

This commit is contained in:
sroschke
2025-05-26 13:14:35 -07:00
2 changed files with 13 additions and 5 deletions

View File

@@ -21,10 +21,18 @@ module.exports = {
);
const embed = new EmbedBuilder()
.setTitle(`<@${user.id}>'s Invite Count`)
.setTitle(`Invite info for @${user.username}`)
.setColor(0x009bc2)
.setDescription(
'Invites: ' + (invites ?? 'No invites found for this user.')
.addFields(
{
name: 'Invites created',
value: `${invites.length}`,
inline: true,
},
{
name: 'Total uses',
value: `${invites.reduce((acc, invite) => parseInt(acc) + parseInt(invite.uses), 0)}`,
}
)
.setTimestamp();

View File

@@ -124,12 +124,12 @@ function main(ctx) {
},
async getUserInvites(guildId, userId) {
const result = await database.db.query(
`SELECT SUM(uses) AS total_uses
`SELECT uses, invite
FROM inviteCount
WHERE serverid = $1 AND userid = $2`,
[guildId, userId]
);
return result.rows?.[0]?.total_uses || 0;
return result.rows;
},
async getUserLeaderboard(guildId, amount = 10) {