mirror of
https://github.com/System-End/Discord-Bot.git
synced 2026-04-19 16:28:26 +00:00
Fixed giveaway bug
This commit is contained in:
parent
a3340740f6
commit
9d79758569
6 changed files with 25 additions and 13 deletions
|
|
@ -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`,
|
||||
|
|
|
|||
|
|
@ -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(() => {
|
||||
|
|
|
|||
|
|
@ -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(() => {
|
||||
|
|
|
|||
|
|
@ -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!`,
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -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!`,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue