import { ButtonStyle, ChannelType, Client, Partials } from 'discord.js' import { DatabaseType, Giveaways, isTimeStringValid } from 'discord-giveaways-super' const { Channel, GuildMember, Message, User } = Partials const client = new Client({ rest: { offset: 0, timeout: 120000 }, partials: [Channel, GuildMember, Message, User], intents: [ 'Guilds', 'GuildMembers', 'GuildMessages', 'GuildMessageReactions', 'MessageContent' // using "MessageContent" intent for this example // to provide the text commands functionality ] }) // using JSON database for this example // you can use any database the module provides: // JSON, MongoDB or Enmap const giveaways = new Giveaways(client, { database: DatabaseType.MONGODB, connection: { connectionURI: 'mongodb://localhost:25017', collectionName: 'giveawaystest1', dbName: 'giveawaystest' }, debug: true }) // send a log telling that giveaways module is ready giveaways.on('ready', async () => { console.log('Giveaways module is ready!') }) // send a log telling that discord client is ready client.on('ready', async () => { console.log(`${client.user?.tag} is ready!`) }) // get the user's message client.on('messageCreate', async message => { // define the bot's commands prefix const prefix = '!' // get the command arguments list const args = message.content.slice(prefix.length).split(' ').slice(1) // trigger on "!giveaway-start" command // command usage: "!giveaway-start