Fixed giveaway bug

This commit is contained in:
CorwinDev 2023-01-24 14:02:42 +01:00
parent a3340740f6
commit 9d79758569
6 changed files with 25 additions and 13 deletions

View file

@ -3,7 +3,8 @@ const ms = require('ms');
module.exports = async (client, interaction, args) => {
const messageID = interaction.options.getString('message');
const giveaway = client.giveawaysManager.giveaways.find((g) => g.guildId === interaction.guildId && g.messageId === messageID);
if (!giveaway) return client.errNormal({ error: "This message ID is not from this guild", type: 'editreply' }, interaction)
client.giveawaysManager.delete(messageID).then(() => {
client.succNormal({
text: `The giveaway has been successfully removed`,

View file

@ -3,7 +3,8 @@ const ms = require('ms');
module.exports = async (client, interaction, args) => {
const messageID = interaction.options.getString('message');
const giveaway = client.giveawaysManager.giveaways.find((g) => g.guildId === interaction.guildId && g.messageId === messageID);
if (!giveaway) return client.errNormal({ error: "This message ID is not from this guild", type: 'editreply' }, interaction)
client.giveawaysManager.edit(messageID, {
addTime: 5000,
}).then(() => {

View file

@ -3,7 +3,8 @@ const ms = require('ms');
module.exports = async (client, interaction, args) => {
const messageID = interaction.options.getString('message');
const giveaway = client.giveawaysManager.giveaways.find((g) => g.guildId === interaction.guildId && g.messageId === messageID);
if (!giveaway) return client.errNormal({ error: "This message ID is not from this guild", type: 'editreply' }, interaction)
client.giveawaysManager.edit(messageID, {
setEndTimestamp: Date.now()
}).then(() => {

View file

@ -3,7 +3,8 @@ const ms = require('ms');
module.exports = async (client, interaction, args) => {
const messageID = interaction.options.getString('message');
const giveaway = client.giveawaysManager.giveaways.find((g) => g.guildId === interaction.guildId && g.messageId === messageID);
if (!giveaway) return client.errNormal({ error: "This message ID is not from this guild", type: 'editreply' }, interaction)
client.giveawaysManager.pause(messageID).then(() => {
client.succNormal({
text: `Giveaway paused!`,

View file

@ -1,20 +1,27 @@
const Discord = require('discord.js');
const ms = require('ms');
/**
*
* @param {Discord.Client} client
* @param {Discord.Interaction} interaction
* @param {*} args
* @returns
*/
module.exports = async (client, interaction, args) => {
const messageID = interaction.options.getString('message');
const giveaway = client.giveawaysManager.giveaways.find((g) => g.guildId === interaction.guildId && g.messageId === messageID);
if (!giveaway) return client.errNormal({ error: "This message ID is not from this guild", type: 'editreply' }, interaction)
client.giveawaysManager.reroll(messageID).then(() => {
client.succNormal({
text: `Giveaway gererolled`,
type: 'editreply'
client.succNormal({
text: `Giveaway gererolled`,
type: 'editreply'
}, interaction);
}).catch((err) => {
client.errNormal({
error: `I can't find the giveaway for ${messageID}!`,
type: 'editreply'
client.errNormal({
error: `I can't find the giveaway for ${messageID}!`,
type: 'editreply'
}, interaction)
});
}

View file

@ -3,7 +3,8 @@ const ms = require('ms');
module.exports = async (client, interaction, args) => {
const messageID = interaction.options.getString('message');
const giveaway = client.giveawaysManager.giveaways.find((g) => g.guildId === interaction.guildId && g.messageId === messageID);
if (!giveaway) return client.errNormal({ error: "This message ID is not from this guild", type: 'editreply' }, interaction)
client.giveawaysManager.unpause(messageID).then(() => {
client.succNormal({
text: `Giveaway unpaused!`,