botbase-module-alias 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c4a2e1e33b9249f136752fa4e292a866b41410e1
4
+ data.tar.gz: 955029d2dd44ceff5cbe672ccffc6a88583d7a02
5
+ SHA512:
6
+ metadata.gz: f4b039513fc602585e7f265248481e891e3f865381debae0d56b7ca669e18554e7c3f2276bd479520b92274a95576da4f9398c9c63ca237f6a0246286ec69c46
7
+ data.tar.gz: 9bc0abb94ae78884327aff7d2bd0df7796e7a358f38e4b05883f668b1f3c998149976ed5d0c6259d2a24620ee917a21d655ac634753e13c8aba9f1f7f15619b4
@@ -0,0 +1 @@
1
+ �a��)�&�q'��L�G낿0��T<��y��4},�nϙ�~3G���n��"U/��K<�k�Do�Y20���%@��'�!���kE>KW�1��j�Cl�j��-��d�\F���P�5|�e���ۉ�a�Hd�S��€N桙��v�9�__��s�����zu��[�q<b�S�~�� S����9��{�L�ӷ�����@ѵ����(��x��ڒK\�����bn�m�{k�>F�_�zUwa+l�N�
Binary file
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: botbase-module-alias.rb
4
+
5
+ # A service module (used by the BotBase gem) intended to interpret verbose statements into
6
+ # known alias commands e.g. create a random password => lpa (leet_password).
7
+
8
+ require 'dynarex'
9
+
10
+ class BotBaseModuleAliasException < Exception
11
+ end
12
+
13
+ class BotBaseModuleAlias
14
+
15
+ def initialize(aliases: nil, callback: nil)
16
+
17
+ if aliases.nil? then
18
+ raise BotBaseModuleAliasException, 'aliases must be provided'
19
+ end
20
+
21
+ @bot = callback
22
+
23
+ s, _ = RXFHelper.read aliases
24
+ @dx = Dynarex.new
25
+ @dx.import aliases
26
+
27
+
28
+ end
29
+
30
+ def query(s, mode: :textchat, echo_node: 'node1')
31
+
32
+ a = @dx.all.inject([]) do |r, x|
33
+
34
+ found = s.match(/#{x.title}/i)
35
+ found ? r << [x, found] : r
36
+
37
+ end
38
+
39
+ if a.any? then
40
+
41
+ msg=a[0][0].aliasname
42
+ notice msg
43
+
44
+ @bot.received(msg, mode: mode, echo_node: echo_node)
45
+
46
+ else
47
+ ''
48
+ end
49
+
50
+ end
51
+
52
+ private
53
+
54
+ def notice(msg)
55
+ @bot.debug msg if @bot
56
+ end
57
+
58
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: botbase-module-alias
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
+ YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
+ 8ixkARkWAmV1MB4XDTE3MTAxNDE2NDAyM1oXDTE4MTAxNDE2NDAyM1owSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBAJu1w43QGkvv92iJ+faMuLWimeY2bTqFyjfLPt1mT0+NyiWdPy2lPYg3M19S
19
+ 5ER/IQPvzIebXpuAmHcizD+DgsdX1tsQgLqJQP+Za+Tf+qGSNcdXi67E7deCIAQy
20
+ aPt396lgNHA/qgpy8PehXTb1+ehXUzFNW8CFtfyxFGyC8fuR9QS9RyrSdnNdPiU4
21
+ 2LsmLBAhVHcnOiqXUIqKG2f8+p7EDpjDrvSuTk2wm2P06O+Gwv4gJDMEPJ+8CqPE
22
+ xAUFRb/oIbgh3VJJQGJnygsAC7cjD31l3zTQy8KC8FnHjjnNgPdips5jDuTRnnq0
23
+ 8v75SwUYEO4r6ylUVJkDY4P21nECAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQUFyB38RgUFlMbs0DvTRzKJZnfe7owJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAFcNWHk3D
27
+ 0upyYuJD1M7f5GvvOiw2TxQqCZSFDmwqrTrVdZHXZ9+cEtAnXT8HKyyA/ZqAKoFV
28
+ pDns1pG7mBMJUnuDIqPRQso/jh3QGCNZeEMVzLC/5rcUbtL+p589X4FQJHK4KYTh
29
+ F8pwIpvOYxepTnwffGRUKM89b35JZmpOTXjM72povY2V8dHp9dZhXHhPZZ3I/Kkp
30
+ oyjZklxfuFv7Jqyu95xj5hml/smy/POtcxsdZKAgcH5J+hJlAc4e61TrepRxYAIH
31
+ Czv8riRL39wXtHELpxf4fL4GV2d5VUXqTtIRM8apHUm23FGBnV6QDFZ1AnK1S96m
32
+ 2Q6YqU1Ur80H3g==
33
+ -----END CERTIFICATE-----
34
+ date: 2017-10-14 00:00:00.000000000 Z
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: dynarex
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '1.7'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 1.7.26
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '1.7'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 1.7.26
56
+ description:
57
+ email: james@jamesrobertson.eu
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - lib/botbase-module-alias.rb
63
+ homepage: https://github.com/jrobertson/botbase-module-alias
64
+ licenses:
65
+ - MIT
66
+ metadata: {}
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubyforge_project:
83
+ rubygems_version: 2.6.13
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: A botbase module plugin which matched a verbose command with a known alias
87
+ command from a lookup file.
88
+ test_files: []
@@ -0,0 +1,2 @@
1
+ �� " ����U�͑4��3�ֹ�:F7���hV���G��|�(��P��7ɇ����!H�K�%�q�,��r�ItU��4������<0��b��u9�
2
+ w�Ey�+��<�N��t�c��;ͮ�||=�w�Ɵ�k�vFe�P��b()=�.���J��rJ��!�l�Q����ea�<.��5iD�hѐ��F@�X�{����dLѐ�첆���Z���� �/�����Z[S���{