class DiscordMiddleware::CachedEvent
- DiscordMiddleware::CachedEvent
- Reference
- Object
Overview
When a message is passed through this middleware, it caches several common properties one might make for typical commands:
- The channel the message was from
- The guild the message was from
- The member the message was from
- The member's roles
client.on_message_create(
DiscordMiddleware::Prefix.new("!info"),
DiscordMiddleware::CachedEvent.new) do |payload, context|
cached = context[DiscordMiddleware::CachedEvent::Result]
cached.channel # => Channel
cached.guild # => Guild?
cached.member # => Member?
cached.member_roles # => Array(Role)?
end
If the cache is enabled on the client (recommended) it will be used.