Drop: Add Patreon muti drop/pickup support

This commit is contained in:
2023-03-13 03:30:56 +01:00
parent b4dda4b49f
commit da78623a05

View File

@@ -16,9 +16,11 @@ module.exports = {
let permissionLevel = await UserUtils.getPermissionLevel(interaction.member);
const cooldowns = await UserUtils.getCooldowns(user);
if (cooldowns.dropCooldown > 0 && permissionLevel < 2) {
//Can't drop if no drops remain nextReset hasn't been reached User is not a global admin
if (cooldowns.remainingDrops <= 0 && cooldowns.nextDropReset > 0 && permissionLevel < 9) {
interaction.editReply({
content: `You can't drop a card yet! ${cooldowns.dropCooldownFormatted}`,
content: `You can't drop a card yet! \nReset in ${cooldowns.nextDropResetFormatted}`,
ephemeral: false
});
return;
@@ -117,9 +119,7 @@ module.exports = {
type: 0
});
//const message = await interaction.editReply({ content: reply, components: [row], fetchReply: true });
//set users drop cooldown
await UserUtils.setCooldown(user, "drop", await GeneralUtils.getBotProperty("dropTimeout"));
await UserUtils.actionHandler(user, "drop");
const collector = message.createMessageComponentCollector({ componentType: ComponentType.Button, time: 60000 });
@@ -131,9 +131,9 @@ module.exports = {
let claimUser = await UserUtils.getUserByDiscordId(i.user.id);
let cooldowns = await UserUtils.getCooldowns(claimUser);
let permissionLevel = await UserUtils.getPermissionLevel(i.member);
if (cooldowns.pullCooldown > 0 && permissionLevel < 2) {
if (cooldowns.remainingClaims <= 0 && cooldowns.nextClaimReset > 0 && permissionLevel < 9) {
i.reply({
content: `You can't claim a card yet! ${cooldowns.pullCooldownFormatted}`,
content: `${i.user} You can't claim a card yet! \nReset in ${cooldowns.nextClaimResetFormatted}`,
ephemeral: false
});
return;
@@ -142,7 +142,7 @@ module.exports = {
if (claimUser) {
//Update card with the user id
cards[cardId].userId = claimUser.id;
await UserUtils.setCooldown(claimUser, "pull", await GeneralUtils.getBotProperty("pullTimeout"));
await UserUtils.actionHandler(user, "claim");
await cards[cardId].save();
let historyEntry = {
userId: claimUser.id,