Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix Ruby SDK
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexander Olofsson
Matrix Ruby SDK
Commits
acc19c88
Verified
Commit
acc19c88
authored
2 years ago
by
Alexander Olofsson
Browse files
Options
Downloads
Patches
Plain Diff
Add note on command execution and DRY Request
parent
4eba16ab
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/matrix_sdk/bot/base.rb
+3
-0
3 additions, 0 deletions
lib/matrix_sdk/bot/base.rb
lib/matrix_sdk/bot/request.rb
+1
-4
1 addition, 4 deletions
lib/matrix_sdk/bot/request.rb
with
4 additions
and
4 deletions
lib/matrix_sdk/bot/base.rb
+
3
−
0
View file @
acc19c88
...
@@ -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)
...
...
This diff is collapsed.
Click to expand it.
lib/matrix_sdk/bot/request.rb
+
1
−
4
View file @
acc19c88
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment