Better Giveaways - v1.0.0-beta.2
    Preparing search index...

    Interface GiveawayRequirements

    Defines entry requirements that participants must meet to enter a giveaway.

    This interface allows for flexible requirement configuration, from simple role checks to complex custom validation functions. All requirements are optional and can be combined as needed.

    const requirements: GiveawayRequirements = {
    // Must have at least one of these roles
    requiredRoles: ['123456789', '987654321'],

    // Account must be at least 30 days old
    accountAgeMin: Date.now() - (30 * 24 * 60 * 60 * 1000),

    // Must have joined server before this date
    joinedServerBefore: Date.now() - (7 * 24 * 60 * 60 * 1000),

    // Custom validation function
    custom: async (userId: string) => {
    const user = await getUserFromDatabase(userId);
    if (user.reputation < 100) {
    return { passed: false, reason: 'Reputation too low (minimum 100)' };
    }
    return { passed: true, reason: '' };
    }
    };
    interface GiveawayRequirements {
        requiredRoles?: string[];
        accountAgeMin?: number;
        joinedServerBefore?: number;
        custom?: (userId: string) => Promise<{ passed: boolean; reason: string }>;
    }
    Index

    Properties

    requiredRoles?: string[]

    Array of Discord role IDs that the user must have at least one of

    accountAgeMin?: number

    UNIX timestamp - user's account must be created before this time

    joinedServerBefore?: number

    UNIX timestamp - user must have joined the server before this time

    custom?: (userId: string) => Promise<{ passed: boolean; reason: string }>

    Custom validation function for complex requirements