Skip to content

Commit

Permalink
Add missing params to send_temporary_message (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
Birdie0 authored Sep 23, 2020
1 parent 0ac2aa2 commit d202032
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/discordrb/bot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,12 @@ def send_message(channel, content, tts = false, embed = nil, attachments = nil)
# @param timeout [Float] The amount of time in seconds after which the message sent will be deleted.
# @param tts [true, false] Whether or not this message should be sent using Discord text-to-speech.
# @param embed [Hash, Discordrb::Webhooks::Embed, nil] The rich embed to append to this message.
def send_temporary_message(channel, content, timeout, tts = false, embed = nil)
# @param attachments [Array<File>] Files that can be referenced in embeds via `attachment://file.png`
def send_temporary_message(channel, content, timeout, tts = false, embed = nil, attachments = nil)
Thread.new do
Thread.current[:discordrb_name] = "#{@current_thread}-temp-msg"

message = send_message(channel, content, tts, embed)
message = send_message(channel, content, tts, embed, attachments)
sleep(timeout)
message.delete
end
Expand Down
7 changes: 5 additions & 2 deletions lib/discordrb/events/message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ def send_embed(message = '', embed = nil, attachments = nil, &block)
# Sends a temporary message to the channel this message was sent in, right now.
# @param content [String] The content to send. Should not be longer than 2000 characters or it will result in an error.
# @param timeout [Float] The amount of time in seconds after which the message sent will be deleted.
def send_temporary_message(content, timeout)
channel.send_temporary_message(content, timeout)
# @param tts [true, false] Whether or not this message should be sent using Discord text-to-speech.
# @param embed [Hash, Discordrb::Webhooks::Embed, nil] The rich embed to append to this message.
# @param attachments [Array<File>] Files that can be referenced in embeds via `attachment://file.png`
def send_temporary_message(content, timeout, tts = false, embed = nil, attachments = nil)
channel.send_temporary_message(content, timeout, tts, embed, attachments)
end

# Adds a string to be sent after the event has finished execution. Avoids problems with rate limiting because only
Expand Down

0 comments on commit d202032

Please sign in to comment.