Skip to content
Snippets Groups Projects
Verified Commit acc19c88 authored by Alexander Olofsson's avatar Alexander Olofsson
Browse files

Add note on command execution and DRY Request

parent 4eba16ab
Branches
Tags
No related merge requests found
...@@ -152,6 +152,9 @@ module MatrixSdk::Bot ...@@ -152,6 +152,9 @@ module MatrixSdk::Bot
# @note Due to the way blocks are handled, required parameters won't block execution. # @note Due to the way blocks are handled, required parameters won't block execution.
# If your command requires all parameters to be valid, you will need to check for nil yourself. # If your command requires all parameters to be valid, you will need to check for nil yourself.
# #
# @note Execution will be performed with a MatrixSdk::Bot::Request object as self.
# To access the bot instance, use MatrixSdk::Bot::Request#bot
#
# @param command [String] The command to register, will be routed based on the prefix and bot NameError # @param command [String] The command to register, will be routed based on the prefix and bot NameError
# @param desc [String] A human-readable description for the command # @param desc [String] A human-readable description for the command
# @param dmonly [Boolean] Should this command only be handled in DMs (direct chats) # @param dmonly [Boolean] Should this command only be handled in DMs (direct chats)
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
module MatrixSdk::Bot module MatrixSdk::Bot
class Request class Request
extend MatrixSdk::Extensions extend MatrixSdk::Extensions
include MatrixSdk::Logging
attr_reader :bot, :event attr_reader :bot, :event
attr_writer :logger attr_writer :logger
...@@ -14,10 +15,6 @@ module MatrixSdk::Bot ...@@ -14,10 +15,6 @@ module MatrixSdk::Bot
@event = event @event = event
end end
def logger
@logger || Logging.logger[self]
end
def client def client
@bot.client @bot.client
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment