class DiscordMiddleware::Time
- DiscordMiddleware::Time
- Reference
- Object
Overview
This middleware provides a method of executing some block after a given amount of time from receiving an event.
delayed = DiscordMiddleware::Time.new(5.seconds) do |context|
channel_id = context.payload.channel_id
context.client.create_message(channel_id, "I'm back!")
end
client.on_message_create(delayed) do |payload, context|
channel_id = payload.channel_id
context.client.create_message(channel_id, "Going away for 5 seconds..")
end