Skip to content

Commit

Permalink
Merge pull request #295 from Droid00000/message-threads
Browse files Browse the repository at this point in the history
feat: message threads
  • Loading branch information
swarley authored Jan 15, 2025
2 parents 6a8ea12 + 696467b commit cfce8ce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
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

0 comments on commit cfce8ce

Please sign in to comment.