chatrix-bot 1.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +12 -0
- data/.gitignore +170 -0
- data/.rspec +3 -0
- data/.rubocop.yml +2 -0
- data/.travis.yml +11 -0
- data/.yardopts +5 -0
- data/Gemfile +31 -0
- data/Guardfile +67 -0
- data/LICENSE +21 -0
- data/README.md +67 -0
- data/Rakefile +11 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/chatrix-bot.gemspec +32 -0
- data/exe/chatrix-bot +53 -0
- data/lib/chatrix/bot.rb +97 -0
- data/lib/chatrix/bot/command.rb +99 -0
- data/lib/chatrix/bot/config.rb +60 -0
- data/lib/chatrix/bot/errors.rb +16 -0
- data/lib/chatrix/bot/parameter.rb +57 -0
- data/lib/chatrix/bot/pattern.rb +25 -0
- data/lib/chatrix/bot/plugin.rb +149 -0
- data/lib/chatrix/bot/plugin_manager.rb +83 -0
- data/lib/chatrix/bot/plugins.rb +16 -0
- data/lib/chatrix/bot/plugins/echo.rb +36 -0
- data/lib/chatrix/bot/plugins/help.rb +50 -0
- data/lib/chatrix/bot/plugins/hug.rb +22 -0
- data/lib/chatrix/bot/version.rb +8 -0
- metadata +102 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 06786b0a3edabddac298dd4bbcc062b81f7486fc
|
4
|
+
data.tar.gz: 8f2105c557f83fe7f0e0cf40ee4dcb727415da9e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8bce48909b4fba7b18058d5316b943b257e60c5197242f539a9698b3dbe9b778222dfeac5b137821c2fb8ddd6201a279d09a1e1ca569cb7cabf2d991c9b1933b
|
7
|
+
data.tar.gz: 47930e47ec59a43a5d334606f2bf0f221ddda7b487bf017a2950b8e727e0d5d3b0d6709079decbd514056210456642c38d33b979622281456c02bdce370d9d01
|
data/.editorconfig
ADDED
data/.gitignore
ADDED
@@ -0,0 +1,170 @@
|
|
1
|
+
# Created by https://www.gitignore.io/api/ruby,git,windows,linux,osx,vim,sublimetext
|
2
|
+
|
3
|
+
### Ruby ###
|
4
|
+
*.gem
|
5
|
+
*.rbc
|
6
|
+
/.config
|
7
|
+
/coverage/
|
8
|
+
/InstalledFiles
|
9
|
+
/pkg/
|
10
|
+
/spec/reports/
|
11
|
+
/spec/examples.txt
|
12
|
+
/test/tmp/
|
13
|
+
/test/version_tmp/
|
14
|
+
/tmp/
|
15
|
+
|
16
|
+
# Used by dotenv library to load environment variables.
|
17
|
+
# .env
|
18
|
+
|
19
|
+
## Specific to RubyMotion:
|
20
|
+
.dat*
|
21
|
+
.repl_history
|
22
|
+
build/
|
23
|
+
*.bridgesupport
|
24
|
+
build-iPhoneOS/
|
25
|
+
build-iPhoneSimulator/
|
26
|
+
|
27
|
+
## Specific to RubyMotion (use of CocoaPods):
|
28
|
+
#
|
29
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
30
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
31
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
32
|
+
#
|
33
|
+
# vendor/Pods/
|
34
|
+
|
35
|
+
## Documentation cache and generated files:
|
36
|
+
/.yardoc/
|
37
|
+
/_yardoc/
|
38
|
+
/doc/
|
39
|
+
/rdoc/
|
40
|
+
|
41
|
+
## Environment normalization:
|
42
|
+
/.bundle/
|
43
|
+
/vendor/bundle
|
44
|
+
/lib/bundler/man/
|
45
|
+
|
46
|
+
# for a library or gem, you might want to ignore these files since the code is
|
47
|
+
# intended to run in multiple environments; otherwise, check them in:
|
48
|
+
Gemfile.lock
|
49
|
+
.ruby-version
|
50
|
+
.ruby-gemset
|
51
|
+
|
52
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
53
|
+
.rvmrc
|
54
|
+
|
55
|
+
|
56
|
+
### Git ###
|
57
|
+
*.orig
|
58
|
+
|
59
|
+
|
60
|
+
### Windows ###
|
61
|
+
# Windows image file caches
|
62
|
+
Thumbs.db
|
63
|
+
ehthumbs.db
|
64
|
+
|
65
|
+
# Folder config file
|
66
|
+
Desktop.ini
|
67
|
+
|
68
|
+
# Recycle Bin used on file shares
|
69
|
+
$RECYCLE.BIN/
|
70
|
+
|
71
|
+
# Windows Installer files
|
72
|
+
*.cab
|
73
|
+
*.msi
|
74
|
+
*.msm
|
75
|
+
*.msp
|
76
|
+
|
77
|
+
# Windows shortcuts
|
78
|
+
*.lnk
|
79
|
+
|
80
|
+
|
81
|
+
### Linux ###
|
82
|
+
*~
|
83
|
+
|
84
|
+
# temporary files which can be created if a process still has a handle open of a deleted file
|
85
|
+
.fuse_hidden*
|
86
|
+
|
87
|
+
# KDE directory preferences
|
88
|
+
.directory
|
89
|
+
|
90
|
+
# Linux trash folder which might appear on any partition or disk
|
91
|
+
.Trash-*
|
92
|
+
|
93
|
+
|
94
|
+
### OSX ###
|
95
|
+
*.DS_Store
|
96
|
+
.AppleDouble
|
97
|
+
.LSOverride
|
98
|
+
|
99
|
+
# Icon must end with two \r
|
100
|
+
Icon
|
101
|
+
|
102
|
+
|
103
|
+
# Thumbnails
|
104
|
+
._*
|
105
|
+
|
106
|
+
# Files that might appear in the root of a volume
|
107
|
+
.DocumentRevisions-V100
|
108
|
+
.fseventsd
|
109
|
+
.Spotlight-V100
|
110
|
+
.TemporaryItems
|
111
|
+
.Trashes
|
112
|
+
.VolumeIcon.icns
|
113
|
+
.com.apple.timemachine.donotpresent
|
114
|
+
|
115
|
+
# Directories potentially created on remote AFP share
|
116
|
+
.AppleDB
|
117
|
+
.AppleDesktop
|
118
|
+
Network Trash Folder
|
119
|
+
Temporary Items
|
120
|
+
.apdisk
|
121
|
+
|
122
|
+
|
123
|
+
### Vim ###
|
124
|
+
# swap
|
125
|
+
[._]*.s[a-w][a-z]
|
126
|
+
[._]s[a-w][a-z]
|
127
|
+
# session
|
128
|
+
Session.vim
|
129
|
+
# temporary
|
130
|
+
.netrwhist
|
131
|
+
*~
|
132
|
+
# auto-generated tag files
|
133
|
+
tags
|
134
|
+
|
135
|
+
|
136
|
+
### SublimeText ###
|
137
|
+
# cache files for sublime text
|
138
|
+
*.tmlanguage.cache
|
139
|
+
*.tmPreferences.cache
|
140
|
+
*.stTheme.cache
|
141
|
+
|
142
|
+
# workspace files are user-specific
|
143
|
+
*.sublime-workspace
|
144
|
+
|
145
|
+
# project files should be checked into the repository, unless a significant
|
146
|
+
# proportion of contributors will probably not be using SublimeText
|
147
|
+
# *.sublime-project
|
148
|
+
|
149
|
+
# sftp configuration file
|
150
|
+
sftp-config.json
|
151
|
+
|
152
|
+
# Package control specific files
|
153
|
+
Package Control.last-run
|
154
|
+
Package Control.ca-list
|
155
|
+
Package Control.ca-bundle
|
156
|
+
Package Control.system-ca-bundle
|
157
|
+
Package Control.cache/
|
158
|
+
Package Control.ca-certs/
|
159
|
+
bh_unicode_properties.cache
|
160
|
+
|
161
|
+
# Sublime-github package stores a github token in this file
|
162
|
+
# https://packagecontrol.io/packages/sublime-github
|
163
|
+
GitHub.sublime-settings
|
164
|
+
|
165
|
+
### Custom rules ###
|
166
|
+
# Ignore access token file
|
167
|
+
access_token.txt
|
168
|
+
|
169
|
+
# Ignore API dumps
|
170
|
+
dumps/
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/.yardopts
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in chatrix-bot.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
group :development do
|
9
|
+
gem 'pry', '~> 0.10'
|
10
|
+
|
11
|
+
gem 'guard', '~> 2.14'
|
12
|
+
gem 'guard-bundler', '~> 2.1', require: false
|
13
|
+
gem 'guard-rspec', '~> 4.7', require: false
|
14
|
+
gem 'guard-rubocop', '~> 1.2'
|
15
|
+
|
16
|
+
gem 'chatrix', github: 'Sharparam/chatrix', branch: 'develop'
|
17
|
+
end
|
18
|
+
|
19
|
+
group :test do
|
20
|
+
gem 'rake', '~> 10.0'
|
21
|
+
gem 'rspec', '~> 3.0'
|
22
|
+
end
|
23
|
+
|
24
|
+
group :development, :test do
|
25
|
+
gem 'rubocop', '~> 0.41.0'
|
26
|
+
end
|
27
|
+
|
28
|
+
group :doc do
|
29
|
+
gem 'yard', '~> 0.8'
|
30
|
+
gem 'redcarpet', '~> 3.3'
|
31
|
+
end
|
data/Guardfile
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# A sample Guardfile
|
4
|
+
# More info at https://github.com/guard/guard#readme
|
5
|
+
|
6
|
+
## Uncomment and set this to only include directories you want to watch
|
7
|
+
# directories %w(app lib config test spec features) \
|
8
|
+
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
9
|
+
|
10
|
+
## Note: if you are using the `directories` clause above and you are not
|
11
|
+
## watching the project directory ('.'), then you will want to move
|
12
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
13
|
+
#
|
14
|
+
# $ mkdir config
|
15
|
+
# $ mv Guardfile config/
|
16
|
+
# $ ln -s config/Guardfile .
|
17
|
+
#
|
18
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
19
|
+
|
20
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
21
|
+
# rspec may be run, below are examples of the most common uses.
|
22
|
+
# * bundler: 'bundle exec rspec'
|
23
|
+
# * bundler binstubs: 'bin/rspec'
|
24
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
25
|
+
# installed the spring binstubs per the docs)
|
26
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
27
|
+
# * 'just' rspec: 'rspec'
|
28
|
+
|
29
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
30
|
+
require 'guard/rspec/dsl'
|
31
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
32
|
+
|
33
|
+
# Feel free to open issues for suggestions and improvements
|
34
|
+
|
35
|
+
# RSpec files
|
36
|
+
rspec = dsl.rspec
|
37
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
38
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
39
|
+
watch(rspec.spec_files)
|
40
|
+
|
41
|
+
# Ruby files
|
42
|
+
ruby = dsl.ruby
|
43
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
44
|
+
|
45
|
+
# Turnip features and steps
|
46
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
47
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
48
|
+
Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
guard :bundler do
|
53
|
+
require 'guard/bundler'
|
54
|
+
require 'guard/bundler/verify'
|
55
|
+
helper = Guard::Bundler::Verify.new
|
56
|
+
|
57
|
+
files = ['Gemfile']
|
58
|
+
files += Dir['*.gemspec'] if files.any? { |f| helper.uses_gemspec?(f) }
|
59
|
+
|
60
|
+
# Assume files are symlinked from somewhere
|
61
|
+
files.each { |file| watch(helper.real_path(file)) }
|
62
|
+
end
|
63
|
+
|
64
|
+
guard :rubocop do
|
65
|
+
watch(/.+\.rb$/)
|
66
|
+
watch(%r{(?:.+/)?\.rubocop(?:_todo)?\.yml$}) { |m| File.dirname(m[0]) }
|
67
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 by Adam Hellberg.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# chatrix-bot
|
2
|
+
|
3
|
+
A bot for [Matrix][matrix], written in Ruby with plugin support.
|
4
|
+
|
5
|
+
## License
|
6
|
+
|
7
|
+
Copyright (c) 2016 by [Adam Hellberg][sharparam].
|
8
|
+
|
9
|
+
The project is available as open source under
|
10
|
+
the terms of the [MIT License][license].
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
### As a system application
|
15
|
+
|
16
|
+
Install the project as a gem on your system by running `gem install chatrix-bot`
|
17
|
+
and then refer to the [Usage](#usage) section in this document.
|
18
|
+
|
19
|
+
### In another Ruby project
|
20
|
+
|
21
|
+
Add this line to your application's Gemfile:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
gem 'chatrix-bot'
|
25
|
+
```
|
26
|
+
|
27
|
+
And then execute:
|
28
|
+
|
29
|
+
$ bundle
|
30
|
+
|
31
|
+
Or install it yourself as:
|
32
|
+
|
33
|
+
$ gem install chatrix-bot
|
34
|
+
|
35
|
+
## Usage
|
36
|
+
|
37
|
+
**NOTE: chatrix-bot is very early in development and probably very unstable.**
|
38
|
+
|
39
|
+
This project is not ready for deployment as a stable bot, it's for
|
40
|
+
development use only at the moment.
|
41
|
+
|
42
|
+
Run the `chatrix-bot` executable in the `exe` directory to start the bot
|
43
|
+
with default options (loading config from `config.yaml`). To generate a new
|
44
|
+
config, pass the `-g` option with optional path to the config file to generate.
|
45
|
+
|
46
|
+
To specify a config file to use when running the bot, pass the `-c` option
|
47
|
+
with the path to the config file to use.
|
48
|
+
|
49
|
+
The bot can also be used from within other Ruby scripts by requiring
|
50
|
+
`chatrix/bot` and creating a new instance of `Chatrix::Bot`.
|
51
|
+
|
52
|
+
## Development
|
53
|
+
|
54
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
55
|
+
Then, run `rake spec` to run the tests. You can also run `bin/console`
|
56
|
+
for an interactive prompt that will allow you to experiment.
|
57
|
+
|
58
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
59
|
+
|
60
|
+
## Contributing
|
61
|
+
|
62
|
+
Bug reports and pull requests are welcome on [GitHub][issues].
|
63
|
+
|
64
|
+
[matrix]: http://matrix.org
|
65
|
+
[issues]: https://github.com/Sharparam/chatrix-bot/issues
|
66
|
+
[sharparam]: https://github.com/Sharparam
|
67
|
+
[license]: http://opensource.org/licenses/MIT
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'chatrix/bot'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require 'pry'
|
15
|
+
Pry.start
|