-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use guild user instead of silenced model feat: use guild user instead of balance model
- Loading branch information
1 parent
f9d40f5
commit c8a3acb
Showing
13 changed files
with
197 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,37 @@ | ||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; | ||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js'; | ||
|
||
import { SlashCommand } from '@marquinhos/types'; | ||
import ArrestedModel from '@schemas/arrested'; | ||
import GuildUserModel from '@marquinhos/database/schemas/guildUser'; | ||
|
||
export const arrested: SlashCommand = { | ||
command: new SlashCommandBuilder() | ||
.setName('encarcerados') | ||
.setDescription('Te dou uma lista de quem tá preso'), | ||
execute: async (interaction) => { | ||
const arrested = await (await getArrested()).toArray(); | ||
interaction.reply({ | ||
embeds: [ | ||
new EmbedBuilder() | ||
.setDescription( | ||
arrested | ||
.map((a) => a.user) | ||
.toString() | ||
.replace(',', '\n') | ||
) | ||
.setTitle('Segue lista dos criminosos:'), | ||
], | ||
const arrested = await getArrested( | ||
(interaction.member as GuildMember).guild.id | ||
); | ||
const listOfArresteds: string = arrested | ||
.map((prisioner) => `:locked: <@${prisioner.userId}>`) | ||
.join('\n'); | ||
|
||
const arrestedsEmbed = interaction.client | ||
.baseEmbed() | ||
.setTitle(':rotating_light: Lista dos criminosos :rotating_light:') | ||
.setTimestamp(); | ||
|
||
if (listOfArresteds) { | ||
arrestedsEmbed.setDescription(`${listOfArresteds}`); | ||
} else { | ||
arrestedsEmbed.setDescription('**Ninguém está preso!**'); | ||
} | ||
return await interaction.reply({ | ||
embeds: [arrestedsEmbed], | ||
}); | ||
}, | ||
cooldown: 10, | ||
}; | ||
|
||
async function getArrested() { | ||
return ArrestedModel.collection.find(); | ||
async function getArrested(guildId: string) { | ||
return await GuildUserModel.find({ guildId, arrested: true }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.