Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ LEETIFY_API_BASE_URL=https://api-public.cs-prod.leetify.com

# Bot Settings
PREFIX=!

# Match Tracker Settings
CHECK_INTERVAL_MINUTES=60 # How often to check for new matches (default: 60 minutes)
USER_COOLDOWN_HOURS=3 # Cooldown period after detecting a match (default: 3 hours)
4 changes: 2 additions & 2 deletions commands/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ module.exports = {
return message.reply({ embeds: [embed] });
}

const ADMIN_ID = '945415570281603103'; // Admin who can link others
const isAdmin = message.author.id === ADMIN_ID;
// Check if user has Administrator permission in this server
const isAdmin = message.member.permissions.has('Administrator');

if (args.length < 1) {
const embed = new EmbedBuilder()
Expand Down
11 changes: 8 additions & 3 deletions services/matchTracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ const { loadUserLinks } = require('../utils/userLinksManager');
const { getGuildConfig } = require('../utils/guildConfigManager');

const TRACKER_DATA_PATH = path.join(__dirname, '../data/matchTrackerData.json');
const CHECK_INTERVAL = 60 * 60 * 1000; // 1 hour in milliseconds
const USER_COOLDOWN = 3 * 60 * 60 * 1000; // 3 hours in milliseconds

// Load timer configurations from environment variables (with defaults)
const CHECK_INTERVAL_MINUTES = parseInt(process.env.CHECK_INTERVAL_MINUTES) || 60;
const USER_COOLDOWN_HOURS = parseInt(process.env.USER_COOLDOWN_HOURS) || 3;

const CHECK_INTERVAL = CHECK_INTERVAL_MINUTES * 60 * 1000; // Convert minutes to milliseconds
const USER_COOLDOWN = USER_COOLDOWN_HOURS * 60 * 60 * 1000; // Convert hours to milliseconds

class MatchTracker {
constructor() {
Expand Down Expand Up @@ -88,7 +93,7 @@ class MatchTracker {
* Start the automatic tracking interval
*/
startTracking() {
console.log('Starting match tracker - checking every 1 hour');
console.log(`Starting match tracker - checking every ${CHECK_INTERVAL_MINUTES} minute${CHECK_INTERVAL_MINUTES !== 1 ? 's' : ''} (cooldown: ${USER_COOLDOWN_HOURS} hour${USER_COOLDOWN_HOURS !== 1 ? 's' : ''})`);

// Run initial check
this.checkAllUsers();
Expand Down