// Automated spam-detection hits (Phase 6b). Bot-owned; recorded when the
// rate-limit / mass-mention / mass-emoji checks trip. mod_actions still logs the
// resulting warn separately. Schema: server/db/schema.sql (spam_hits).
const db = require('../db')

async function record({ guildId, spamType, discordUserId, username, channelId }) {
  await db.query(
    `INSERT INTO spam_hits (guild_id, spam_type, discord_user_id, username, channel_id)
     VALUES (?, ?, ?, ?, ?)`,
    [guildId, spamType, discordUserId, username || null, channelId || null],
  )
}

module.exports = { record }
