From 72d8d030ce6505a22567e76003694a425f973138 Mon Sep 17 00:00:00 2001 From: NickTheDevOpsGuy Date: Thu, 11 Dec 2025 17:33:43 -0500 Subject: [PATCH 1/2] Adding in history changes --- scripts copy/precheck.sh | 72 --------------------------------- src/commands/history/history.ts | 56 +++++++++++++++++-------- 2 files changed, 39 insertions(+), 89 deletions(-) delete mode 100755 scripts copy/precheck.sh diff --git a/scripts copy/precheck.sh b/scripts copy/precheck.sh deleted file mode 100755 index 52762a11..00000000 --- a/scripts copy/precheck.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env bash -# Abort on error, unset vars, or pipeline failures -set -euo pipefail - -# Repo root -cd "$(git rev-parse --show-toplevel)" - -# Optional: allow skipping with tag -LAST_COMMIT_MSG="$(git log -1 --pretty=%B || true)" -if echo "$LAST_COMMIT_MSG" | grep -qi '\[skip-precheck\]'; then - echo "⚠️ Skipping pre-push checks due to [skip-precheck] tag." - exit 0 -fi - -echo "🔍 Running Pre-Push Quality Gate..." - -# -------- Empty file check (same behavior you had), scoped to changes -------- -echo "📂 Checking for empty files..." -UPSTREAM="$(git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null || true)" -if [ -n "$UPSTREAM" ]; then - BASE="$(git merge-base HEAD "$UPSTREAM")" - FILES_TO_CHECK="$(git diff --name-only --diff-filter=AM "$BASE"..HEAD)" -else - echo "⚠️ No upstream configured — scanning entire repo..." - FILES_TO_CHECK="$(git ls-files)" -fi - -ALLOW_EMPTY_REGEX='(^|/)\.gitkeep$|(^|/)\.keep$' -EMPTY_FILES="" -while IFS= read -r file; do - [ -z "${file:-}" ] && continue - if echo "$file" | grep -Eq "$ALLOW_EMPTY_REGEX"; then - continue - fi - if [ -f "$file" ] && [ ! -s "$file" ]; then - EMPTY_FILES+="$file"$'\n' - fi -done <<< "$FILES_TO_CHECK" - -if [ -n "$EMPTY_FILES" ]; then - echo -e "🛑 Empty files detected:\n$EMPTY_FILES\nPlease remove or fill them." - exit 1 -fi -echo "✅ No empty files found." - -# -------- Prettier (check → auto-fix & stop) -------- -echo "🎨 Prettier — check" -if ! npx --no-install prettier --config .prettierrc.yml --ignore-path .prettierignore --check .; then - echo "💾 Prettier — writing fixes..." - npx --no-install prettier --config .prettierrc.yml --ignore-path .prettierignore --write . - git add -A - git commit -m "style: auto-format with Prettier [skip-precheck]" - echo "🛑 Prettier fixed files and committed. Push again." - exit 1 -fi -echo "✅ Prettier passed." - -# -------- ESLint (cached src) -------- -echo "🧪 ESLint (cached, src)..." -npx --no-install eslint src --ext .js,.jsx,.ts,.tsx --cache - -# -------- ESLint (strict, repo root) -------- -echo "✨ ESLint (strict)..." -npx --no-install eslint . --max-warnings=0 -echo "✅ ESLint passed." - -# -------- TypeScript -------- -echo "🛠️ TypeScript — type check" -npx --no-install tsc --noEmit --pretty false -echo "✅ TypeScript passed." - -echo "🚀 All checks passed. Ready to push!" \ No newline at end of file diff --git a/src/commands/history/history.ts b/src/commands/history/history.ts index 58b94b4b..8035af28 100644 --- a/src/commands/history/history.ts +++ b/src/commands/history/history.ts @@ -1,17 +1,18 @@ import { SlashCommandBuilder, AttachmentBuilder, + MessageFlags, type ChatInputCommandInteraction, } from "discord.js"; /** * /history command - * Returns the last N raw messages (no summarization). + * Returns the last N raw user messages as a DM to the requester. * MVP version for chat playback feature (F1). */ export const data = new SlashCommandBuilder() .setName("history") - .setDescription("Show the most recent messages in plain text") + .setDescription("DMs you the most recent messages in this channel") .addIntegerOption((opt) => opt .setName("count") @@ -23,11 +24,13 @@ export const data = new SlashCommandBuilder() export async function execute( interaction: ChatInputCommandInteraction, ): Promise { - // Use the requested count, or default to 50 messages. + // Default to 50 messages if no count is provided. const count = interaction.options.getInteger("count") ?? 50; - await interaction.deferReply(); + // Ephemeral: only the caller sees the acknowledgment message. + await interaction.deferReply({ flags: MessageFlags.Ephemeral }); + // Fetch messages from the current channel. const messages = await interaction.channel?.messages.fetch({ limit: count }); if (!messages) { await interaction.editReply("Could not fetch messages for this channel."); @@ -35,41 +38,60 @@ export async function execute( } /** - * Filter out bots so playback only includes real user messages. - * Sort oldest→newest so the playback follows the conversation flow. + * Filter user messages only (exclude bots), + * oldest first so playback reads correctly. */ const userMessages = messages .filter((m) => !m.author.bot && m.content) .sort((a, b) => a.createdTimestamp - b.createdTimestamp); - /** - * Nothing to show. - */ if (userMessages.size === 0) { await interaction.editReply("No history found."); return; } /** - * Combine messages into a simple “username: content” transcript, one per line. + * Build a readable transcript. */ const text = userMessages .map((m) => `${m.author.username}: ${m.content}`) .join("\n"); /** - * If the history exceeds Discord’s 2000-character limit, send it as a text file instead of a normal message. + * If too large for a normal DM, send as a file. */ if (text.length > 2000) { - const file = new AttachmentBuilder(Buffer.from(text), { + const file = new AttachmentBuilder(Buffer.from(text, "utf8"), { name: "history.txt", }); - await interaction.editReply({ - content: "History was too long to display, so I attached it as a file.", - files: [file], - }); + + try { + await interaction.user.send({ + content: "Here is your recent chat history:", + files: [file], + }); + + await interaction.editReply("History sent to your DMs."); + } catch (err) { + console.error("[history] DM file send failed", err); + await interaction.editReply( + "I generated the history, but your DMs appear to be closed.", + ); + } + return; } - await interaction.editReply(text); + /** + * Normal-length transcript → DM it as text. + */ + try { + await interaction.user.send(text); + await interaction.editReply("History sent to your DMs."); + } catch (err) { + console.error("[history] DM text send failed", err); + await interaction.editReply( + "I generated the history, but could not DM you. Your DMs may be closed.", + ); + } } From 6ae928556a7a8ab1a297c80a8f469b494ef293d1 Mon Sep 17 00:00:00 2001 From: NickTheDevOpsGuy Date: Thu, 11 Dec 2025 17:34:39 -0500 Subject: [PATCH 2/2] Adding in new file --- .github/workflows/OmegaBot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/OmegaBot.yml b/.github/workflows/OmegaBot.yml index a792f594..181d528b 100644 --- a/.github/workflows/OmegaBot.yml +++ b/.github/workflows/OmegaBot.yml @@ -1,5 +1,5 @@ # .github/workflows/OmegaBot.yml -name: 🔍 Lint · Typecheck · Format +name: 🤖 OmegaBot on: pull_request: