Skip to content

Conversation

@Xe
Copy link
Member

@Xe Xe commented Jan 20, 2026

Summary

This PR adds cmd/qna-importer, a new tool for importing Discourse forum content into Discord channels via webhooks. The tool includes:

  • Discourse scraping: Extract threads and posts from Discourse forums
  • Content massage: AI-powered content adaptation for Discord format
  • User generation: Random username generation with avatar support via stable-diffusion.cpp
  • Discord import: Posts processed content to Discord via webhooks with avatars stored on Tigris

Changes

New packages

  • cmd/qna-importer - Main CLI tool with import pipeline
  • web/discourse - Discourse API client for scraping forum content
  • web/sdcpp - Stable-diffusion.cpp client for AI image generation
  • web/answerflow - Answer Overflow API client
  • web/useragent - User agent string generation

Store enhancements

  • Added Exists() method to store.Interface
  • Comprehensive table-driven tests for all store operations

Features

  • Scrapes Discourse threads and posts
  • Uses AI to massage content for Discord format
  • Generates unique usernames with AI-generated avatars
  • Uploads avatars to Tigris storage
  • Posts to Discord with proper user attribution

Test plan

  • All tests pass (go test ./...)
  • Code formatted with npm run format
  • Store tests cover all methods (Get, Set, Delete, List, Exists)

Xe added 6 commits January 20, 2026 14:08
Signed-off-by: Xe Iaso <xe@tigrisdata.com>
Signed-off-by: Xe Iaso <xe@tigrisdata.com>
Assisted-by: GLM 4.7 via Claude Code
Signed-off-by: Xe Iaso <xe@tigrisdata.com>
Signed-off-by: Xe Iaso <xe@tigrisdata.com>
Signed-off-by: Xe Iaso <xe@tigrisdata.com>
Signed-off-by: Xe Iaso <xe@tigrisdata.com>
@Xe Xe force-pushed the Xe/qna-importer branch from 16db3d4 to 6d01bdf Compare January 20, 2026 22:34
Xe added 3 commits January 20, 2026 17:35
Adds Exists() method to store.Interface that returns nil if the key
exists, ErrNotFound if it does not exist. Implementation included for
S3API store using HeadObject and for JSON[T] wrapper with prefix support.

Also adds comprehensive table-driven tests for all store methods:
- Exists (key existence checking)
- Delete (key deletion)
- Get (value retrieval)
- Set (value storage)
- List (prefix-based key listing)
- JSON wrapper methods (Get, Set, Delete, List)

Assisted-by: GLM 4.7 via Claude Code
Signed-off-by: Xe Iaso <xe@tigrisdata.com>
Signed-off-by: Xe Iaso <xe@tigrisdata.com>
- Rename UsernameGenerator to UserGenerator
- Add avatar generation using stable-diffusion.cpp
- Add tigrisdata/storage-go dependency for avatar upload
- Add AvatarGen with GenerateAndUpload method
- Add FakeUser struct with AvatarKey field
- Fix command name typo in main.go
- Remove default sdcpp client globals

Assisted-by: GLM 4.7 via Claude Code
Signed-off-by: Xe Iaso <xe@tigrisdata.com>
@Xe Xe force-pushed the Xe/qna-importer branch from 6d01bdf to d6a4bbd Compare January 20, 2026 22:36
Xe added 8 commits January 20, 2026 17:38
Signed-off-by: Xe Iaso <xe@tigrisdata.com>
Add ThreadCreationResponse struct and ParseThreadCreation function to handle
Discord webhook thread creation responses. Also add ThreadName field to
Webhook struct for specifying thread names when creating forum threads.

Assisted-by: GLM 4.7 via Claude Code
Signed-off-by: Xe Iaso <xe@tigrisdata.com>
Replace Discord bot API ForumThreadStartComplex with webhook-based thread
creation. This approach:
- Uses webhooks with thread_name parameter for thread creation
- Adds deduplication tracking via discourseToDiscord mapping
- Adds configurable rate limiting with post-delay flag
- Improves error handling with per-thread loggers
- Validates webhook responses

Assisted-by: GLM 4.7 via Claude Code
Signed-off-by: Xe Iaso <xe@tigrisdata.com>
Add logging.Nop{} to AWS config to suppress verbose SDK debug output
that clutters application logs.

Assisted-by: GLM 4.7 via Claude Code
Signed-off-by: Xe Iaso <xe@tigrisdata.com>
Add rule to summarize content longer than 1000 characters down to
1000 characters or less. This helps keep imported posts concise.

Assisted-by: GLM 4.7 via Claude Code
Signed-off-by: Xe Iaso <xe@tigrisdata.com>
…te prefix

Remove discord-forum-channel flag since webhook approach no longer needs it.
Also change mapping prefix from "discord-thread-mapping-dev" to
"discord-thread-mapping" for production use.

Assisted-by: GLM 4.7 via Claude Code
Signed-off-by: Xe Iaso <xe@tigrisdata.com>
Remove duplicate config import and use awsConfig alias consistently
for WithLogger call.

Assisted-by: GLM 4.7 via Claude Code
Signed-off-by: Xe Iaso <xe@tigrisdata.com>
Include post-delay flag value in startup configuration log for
better observability.

Assisted-by: GLM 4.7 via Claude Code
Signed-off-by: Xe Iaso <xe@tigrisdata.com>
@Xe Xe enabled auto-merge (squash) January 21, 2026 20:43
@Xe Xe merged commit 90f9df6 into main Jan 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants