
Security News
US Government Forces Anthropic to Pull Claude Fable Days After Launch
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.
exsta-giveaways
Advanced tools
🎉 Complete framework to facilitate the creation of giveaways using discord.js v14
Exsta Giveaways is a powerful Node.js module that allows you to easily create giveaways!
npm install --save exsta-giveaways
Required Discord Intents: Guilds and GuildMessageReactions.
Optional Discord Privileged Intent for better performance: GuildMembers.
import { Client } from 'discord.js';
const client = new Client({
intents: [
Discord.IntentsBitField.Flags.Guilds,
Discord.IntentsBitField.Flags.GuildMessageReactions,
Discord.IntentsBitField.Flags.GuildMembers
]
});
// Requires Manager from exsta-giveaways
/*
For TypeScript
*/
import { GiveawaysManager } from 'exsta-giveaways';
const manager = new GiveawaysManager(client, {
storage: './giveaways.json',
config: {
botsCanWin: false,
embedColor: '#FF0000',
embedColorEnd: '#000000',
reaction: '💫',
botName: "Giveaway Bot",
forceUpdateEvery: 3600,
endedGiveawaysLifetime: 1_600_000,
}
});
/*
For JavaScript
*/
const gw = require('exsta-giveaways');
const manager = new gw.GiveawaysManager(client, {
storage: './giveaways.json',
config: {
botsCanWin: false,
embedColor: '#FF0000',
embedColorEnd: '#000000',
reaction: '💫',
botName: "Giveaway Bot",
forceUpdateEvery: 3600,
endedGiveawaysLifetime: 1_600_000,
}
});
// We now have a giveawaysManager property to access the manager everywhere!
client.giveawaysManager = manager;
client.on('ready', () => {
console.log('Bot is ready!');
});
client.login("My cool discord bot token !");
After that, giveaways that are not yet completed will start to be updated again and new giveaways can be started. You can pass an options object to customize the giveaways. Here is a list of them:
client.on('interactionCreate', (interaction) => {
const ms = require('ms');
if (interaction.isChatInputCommand() && interaction.commandName === 'start-giveaway') {
// /start-giveaway 2d 1 Awesome prize!
// Will create a giveaway with a duration of two days, with one winner and the prize will be "Awesome prize!"
await interaction.deferReply();
let giveawayChannel = interaction.channel;
var giveawayDuration = interaction.options.getString("time");
let giveawayNumberWinners = interaction.options.getNumber("winner");
if (isNaN(giveawayNumberWinners as number) || (parseInt(giveawayNumberWinners as unknown as string) <= 0)) {
await interaction.editReply({ content: "You must specify a valid number of winners!" });
return;
};
let giveawayPrize = interaction.options.getString("prize");
let giveawayDurationFormated = ms(giveawayDuration as unknown as number);
if (Number.isNaN(giveawayDurationFormated)) {
await interaction.editReply({
content: `${interaction.user}, the giveaway Duration you specified are invalid, please try again!`
});
return;
};
client.giveawaysManager.create(giveawayChannel as TextBasedChannel, {
duration: parseInt(giveawayDurationFormated),
prize: giveawayPrize,
winnerCount: giveawayNumberWinners,
hostedBy: interaction.user.id,
embedImageURL: interaction.options.getString('imageURL') || undefined
});
}
});
This allows you to start a new giveaway. Once the create() function is called, the giveaway starts, and you only have to observe the result, the package does the rest!
The command examples below (reroll, edit delete, end) can be executed on any server your bot is a member of if a person has the messageId of a giveaway. To prevent abuse we recommend to check if the messageId that was provided by the command user is for a giveaway on the same server, if it is not, then cancel the command execution.
const query = interaction.options.getString('query');
const giveaway =
// Search with messageId
client.giveawaysManager.isValid(query);
// If no giveaway was found
if (!giveaway) return interaction.reply(`Unable to find a giveaway for \`${query}\`.`);
client.on('interactionCreate', (interaction) => {
if (interaction.isChatInputCommand() && interaction.commandName === 'reroll') {
const messageId = interaction.options.getString('message_id');
try {
await client.giveawaysManager.reroll(client, messageId as string);
interaction.reply('Success! Giveaway rerolled!');
} catch (error) {
interaction.reply(`An error has occurred, please check and try again\n\`${error}\``);
};
}
});
client.on('interactionCreate', (interaction) => {
if (interaction.isChatInputCommand() && interaction.commandName === 'delete') {
const messageId = interaction.options.getString('message_id');
client.giveawaysManager.delete(messageId)
.then(() => {
interaction.reply('Success! Giveaway deleted!');
})
.catch((err) => {
interaction.reply(`An error has occurred, please check and try again.\n\`${err}\``);
});
}
});
⚠️ Note: when you use the delete function, the giveaway data and the message of the giveaway are deleted (by default). You cannot restore a giveaway once you have deleted it!
client.on('interactionCreate', (interaction) => {
if (interaction.isChatInputCommand() && interaction.commandName === 'end') {
const messageId = interaction.options.getString('message_id');
client.giveawaysManager.end(client, inputData as string)
.then(() => {
interaction.reply('Success! Giveaway ended!');
})
.catch((err) => {
interaction.reply(`An error has occurred, please check and try again.\n\`${err}\``);
});
}
});
FAQs
🎉 Complete framework to facilitate the creation of giveaways using discord.js v14
We found that exsta-giveaways demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.

Security News
A network of 152 Chrome live wallpaper extensions hid ad tracking and made extension-driven traffic look like Google search clicks.

Company News
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.