Skip to content

Instantly share code, notes, and snippets.

View Droid00000's full-sized avatar
🐼

Droid Droid00000

🐼
  • United States
  • 16:34 (UTC -04:00)
View GitHub Profile
@Droid00000
Droid00000 / thread.rb
Last active September 24, 2025 18:15
# frozen_string_literal: true
# Start a thread in a forum or media channel.
# https://discord.com/developers/docs/resources/channel#start-thread-in-forum-or-media-channel
def start_thread_in_forum_or_media_channel(token, channel_id, name, message, attachments = nil, rate_limit_per_user = nil, auto_archive_duration = nil, applied_tags = [], reason = nil)
body = { name: name, message: message, rate_limit_per_user: rate_limit_per_user, auto_archive_duration: auto_archive_duration, applied_tags: applied_tags }.compact
body = if attachments
files = [*0...attachments.size].zip(attachments).to_h
{ **files, payload_json: body.to_json }