discord-giveaway-easy
Version:
A module allowing the simple creation of a discord giveaway with your bot supported by Discord.js^14.0.0
116 lines (94 loc) • 3.4 kB
JavaScript
;
const Discord = require("discord.js")
const data = require("../../../data/config.json")
const {saveLocal} = require("../../../functions/functions")
const {
NewData
} = require("../utils/Constant")
module.exports = class panel {
/**
*
* @param {Discord.Client} client
*/
constructor(client) {
this.client = client;
}
/**
*
* @param {Discord.Message} message
* @param {Boolean} deprive
* @returns
*/
async panel(message, deprive) {
let embed = new Discord.EmbedBuilder()
.setTitle(`Giveaway Settings`)
.setDescription(`To modify this data, you must create a command specific to this action.`)
.addFields(
{
name: `Emoji`,
value: `${data.emoji}`,
inline: true
},
{
name: `Color`,
value: `\`${data.color}\``,
inline: true
},
{
name: `Language`,
value: `\`${data.language}\``,
inline: true
},
{
name: `Enable`,
value: `\`${data.giveawayEnable}\``,
inline: true
}
)
.setColor("#2f3136")
.setFooter({text: `Valogzi ©️ 2022`});
if (deprive === false) return message.reply({embeds: [embed]});
return message.reply({embeds: [embed], ephemeral: true});
}
/**
*
* @param {Discord.Message} message
* @param {NewData} options
* @returns
*/
async setConfig(message, options) {
if (
options.color === null &&
options.emoji === null &&
options.giveawayEnable === null &&
options.language === null
)
return message.reply({content: `❌ No new values were found! Nothing has been changed!`, ephemeral: true})
if (options.giveawayEnable === null) options.giveawayEnable = data.giveawayEnable;
if (options.color === null) options.color = data.color;
if (options.emoji === null) options.emoji = data.emoji;
if (options.language === null) options.language = data.language;
///======================================
///======================================
///======================================
///======================================
///======================================
if (options.language === "fr") await console.log(`\n\n** ⚠️ | Please note that the French language is not yet supported. **\n** Please note that the French language is not yet supported. The language will always be set to English.** \n\n`);
///======================================
///======================================
///======================================
///======================================
///======================================
if (
options.language !== "fr" &&
options.language !== "en"
)
return message.reply({content: "You can only fill this argument with the values 'en' and 'fr'", ephemeral: true})
data.color = options.color;
data.emoji = options.emoji;
data.giveawayEnable = options.giveawayEnable;
data.language = options.language;
saveLocal();
return message.reply({content: `The new values have been applied!`, ephemeral: true})
}
}