Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: message threads #295

Merged
merged 3 commits into from
Jan 15, 2025
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
2 changes: 1 addition & 1 deletion lib/discordrb/commands/command_bot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def arg_check(args, types = nil, server = nil)
rescue ArgumentError
nil
end
elsif types[i] == TrueClass || types[i] == FalseClass
elsif [TrueClass, FalseClass].include?(types[i])
if arg.casecmp('true').zero? || arg.downcase.start_with?('y')
true
elsif arg.casecmp('false').zero? || arg.downcase.start_with?('n')
Expand Down
10 changes: 8 additions & 2 deletions lib/discordrb/data/message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,15 @@ class Message
# @return [Integer, nil] the webhook ID that sent this message, or `nil` if it wasn't sent through a webhook.
attr_reader :webhook_id

# @return [Array<Component>]
# @return [Array<Component>] Interaction components for this message.
attr_reader :components

# @return [Integer] flags set on the message
# @return [Integer] flags set on the message.
attr_reader :flags

# @return [Channel, nil] The thread that was started from this message, or nil.
attr_reader :thread

# @!visibility private
def initialize(data, bot)
@bot = bot
Expand Down Expand Up @@ -160,7 +163,10 @@ def initialize(data, bot)

@components = []
@components = data['components'].map { |component_data| Components.from_data(component_data, @bot) } if data['components']

@flags = data['flags'] || 0

@thread = data['thread'] ? @bot.ensure_channel(data['thread'], @server) : nil
end

# Replies to this message with the specified content.
Expand Down
Loading