lita-discord_oauth 0.1.1.alpha.43 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -1,30 +1,30 @@
1
- # lita-discord
2
-
3
- [![Build Status](https://travis-ci.org/cascer1/lita-discord.png?branch=master)](https://travis-ci.org/cascer1/lita-discord) [![Gem Version](https://badge.fury.io/rb/lita-discord_oauth.svg)](https://badge.fury.io/rb/lita-discord_oauth)
4
-
5
- Discord adapter for Lita, using OAuth tokens.
6
-
7
- ## Installation
8
-
9
- Add lita-discord to your Lita instance's Gemfile:
10
-
11
- ``` ruby
12
- gem "lita-discord_oauth"
13
- ```
14
-
15
- ## Configuration
16
-
17
- The adapter exposes two configuration settings:
18
-
19
- * `config.adapters.discord_oauth.token = ''`
20
- Bot account token
21
- * `config.adapters.discord_oauth.client = ''`
22
- Bot client ID
23
-
24
- You can get both these values from [this page](https://discordapp.com/developers/applications/me) - Make sure that the application is a bot user!
25
-
26
- ![bot user](https://ducohosting.com/screenshots/isaac28fe06147f6a73a1a654433cf2ef3d37.png)
27
-
28
- ## Usage
29
-
30
- TODO: Describe the plugin's features and how to use them.
1
+ # lita-discord
2
+
3
+ [![Build Status](https://travis-ci.org/cascer1/lita-discord.png?branch=master)](https://travis-ci.org/cascer1/lita-discord) [![Gem Version](https://badge.fury.io/rb/lita-discord_oauth.svg)](https://badge.fury.io/rb/lita-discord_oauth)
4
+
5
+ Discord adapter for Lita, using OAuth tokens.
6
+
7
+ ## Installation
8
+
9
+ Add lita-discord to your Lita instance's Gemfile:
10
+
11
+ ``` ruby
12
+ gem "lita-discord_oauth"
13
+ ```
14
+
15
+ ## Configuration
16
+
17
+ The adapter exposes two configuration settings:
18
+
19
+ * `config.adapters.discord_oauth.token = ''`
20
+ Bot account token
21
+ * `config.adapters.discord_oauth.client = ''`
22
+ Bot client ID
23
+
24
+ You can get both these values from [this page](https://discordapp.com/developers/applications/me) - Make sure that the application is a bot user!
25
+
26
+ ![bot user](https://ducohosting.com/screenshots/isaac28fe06147f6a73a1a654433cf2ef3d37.png)
27
+
28
+ ## Usage
29
+
30
+ TODO: Describe the plugin's features and how to use them.
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- require 'bundler/gem_tasks'
2
- require 'rspec/core/rake_task'
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task default: :spec
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -1,73 +1,74 @@
1
- require 'discordrb'
2
-
3
- module Lita
4
- module Adapters
5
- class Discord_oauth < Adapter
6
- config :token, type: String, required: true
7
- config :client, type: String, required: true
8
-
9
- def initialize(robot)
10
- super
11
- @client = ::Discordrb::Bot.new token: config.token, client_id: config.client
12
- end
13
-
14
- def run
15
- STDOUT.write('Starting')
16
- @client.ready do |e|
17
- robot.trigger(:connected)
18
-
19
- @client.message do |event|
20
- message = event.message
21
- author_id = message.author.id.to_s
22
-
23
- Lita.logger.debug('Received message from ' + author_id + ': ' + message.content)
24
-
25
- user = Lita::User.find_by_id(author_id)
26
- user = Lita::User.create(author_id) unless user
27
-
28
- Lita.logger.debug('User ID: ' + user.id)
29
-
30
- channel = event.channel.id.to_s
31
-
32
- Lita.logger.debug('Channel ID: ' + channel)
33
-
34
- source = Lita::Source.new(user: user, room: channel)
35
- msg = Lita::Message.new(robot, message.content, source)
36
-
37
- robot.receive(msg) unless message.from_bot?
38
-
39
- end
40
- end
41
-
42
-
43
- @client.run
44
- end
45
-
46
- def shut_down
47
- @client.stop
48
- end
49
-
50
- def send_messages(target, messages)
51
- Lita.logger.debug('Target user ID: ' + target.user.id)
52
- Lita.logger.debug('Target channel ID: ' + target.room)
53
-
54
- mention = @client.user(target.user.id).mention
55
-
56
- Lita.logger.debug('Mention: ' + mention)
57
-
58
- messages.each do |message|
59
- if mention
60
- message = mention + ',\n' + message
61
-
62
- Lita.logger.debug(message)
63
-
64
- @client.send_message(target.room, message)
65
- end
66
- end
67
- end
68
-
69
- end
70
-
71
- Lita.register_adapter(:discord_oauth, Discord_oauth)
72
- end
73
- end
1
+ require 'discordrb'
2
+
3
+ module Lita
4
+ module Adapters
5
+ class Discord_oauth < Adapter
6
+ config :token, type: String, required: true
7
+ config :client, type: String, required: true
8
+
9
+ def initialize(robot)
10
+ super
11
+ @client = ::Discordrb::Bot.new token: config.token, client_id: config.client
12
+ end
13
+
14
+ def run
15
+ STDOUT.write('Starting')
16
+ @client.ready do |e|
17
+ robot.trigger(:connected)
18
+
19
+ @client.message do |event|
20
+ message = event.message
21
+ author_id = message.author.id.to_s
22
+
23
+ Lita.logger.debug('Received message from ' + author_id + ': ' + message.content)
24
+
25
+ user = Lita::User.find_by_id(author_id)
26
+ user = Lita::User.create(author_id) unless user
27
+
28
+ Lita.logger.debug('User ID: ' + user.id)
29
+
30
+ channel = event.channel.id.to_s
31
+
32
+ Lita.logger.debug('Channel ID: ' + channel)
33
+
34
+ source = Lita::Source.new(user: user, room: channel)
35
+ msg = Lita::Message.new(robot, message.content, source)
36
+
37
+ robot.receive(msg) unless message.from_bot?
38
+
39
+ end
40
+ end
41
+
42
+
43
+ @client.run
44
+ end
45
+
46
+ def shut_down
47
+ @client.stop
48
+ end
49
+
50
+ def send_messages(target, messages)
51
+ Lita.logger.debug('Target: ' + target)
52
+ Lita.logger.debug('Target user: ' + target.user)
53
+ Lita.logger.debug('Target user ID: ' + target.user.id)
54
+
55
+ mention = @client.user(target.user.id).mention
56
+
57
+ Lita.logger.debug('Mention: ' + mention)
58
+
59
+ messages.each do |message|
60
+ if mention
61
+ message = mention + ',\n' + message
62
+
63
+ Lita.logger.debug(message)
64
+
65
+ @client.send_message(target.room, message)
66
+ end
67
+ end
68
+ end
69
+
70
+ end
71
+
72
+ Lita.register_adapter(:discord_oauth, Discord_oauth)
73
+ end
74
+ end
@@ -1,7 +1,7 @@
1
- require 'lita'
2
-
3
- Lita.load_locales Dir[File.expand_path(
4
- File.join('..', '..', 'locales', '*.yml'), __FILE__
5
- )]
6
-
7
- require 'lita/adapters/discord_oauth'
1
+ require 'lita'
2
+
3
+ Lita.load_locales Dir[File.expand_path(
4
+ File.join('..', '..', 'locales', '*.yml'), __FILE__
5
+ )]
6
+
7
+ require 'lita/adapters/discord_oauth'
@@ -1,27 +1,27 @@
1
- Gem::Specification.new do |spec|
2
- spec.name = 'lita-discord_oauth'
3
- spec.version = '0.1.1'
4
- spec.version = "#{spec.version}.alpha.#{ENV['TRAVIS_BUILD_NUMBER']}" if ENV['TRAVIS']
5
- spec.authors = ['Cas Eliëns']
6
- spec.email = ['cas.eliens@gmail.com']
7
- spec.description = 'Discord Adapter for Lita'
8
- spec.summary = 'Adapter to connect Lita to Discord using OAuth'
9
- spec.homepage = 'https://github.com/cascer1/lita-discord_oauth'
10
- spec.license = 'GPL-3.0+'
11
- spec.metadata = {'lita_plugin_type' => 'adapter'}
12
-
13
- spec.files = `git ls-files`.split($/)
14
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
15
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
- spec.require_paths = ['lib']
17
-
18
- spec.add_runtime_dependency 'lita', '>= 4.7'
19
- spec.add_runtime_dependency 'discordrb', '>= 3.1.1'
20
- spec.required_ruby_version = '>= 2.0.0'
21
-
22
- spec.add_development_dependency 'bundler', '~> 1.3'
23
- spec.add_development_dependency 'pry-byebug'
24
- spec.add_development_dependency 'rake'
25
- spec.add_development_dependency 'rack-test'
26
- spec.add_development_dependency 'rspec', '>= 3.0.0'
27
- end
1
+ Gem::Specification.new do |spec|
2
+ spec.name = 'lita-discord_oauth'
3
+ spec.version = '0.1.1'
4
+ spec.version = "#{spec.version}.alpha.#{ENV['TRAVIS_BUILD_NUMBER']}" if ENV['TRAVIS']
5
+ spec.authors = ['Cas Eliëns']
6
+ spec.email = ['cas.eliens@gmail.com']
7
+ spec.description = 'Discord Adapter for Lita'
8
+ spec.summary = 'Adapter to connect Lita to Discord using OAuth'
9
+ spec.homepage = 'https://github.com/cascer1/lita-discord_oauth'
10
+ spec.license = 'GPL-3.0+'
11
+ spec.metadata = {'lita_plugin_type' => 'adapter'}
12
+
13
+ spec.files = `git ls-files`.split($/)
14
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
15
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
+ spec.require_paths = ['lib']
17
+
18
+ spec.add_runtime_dependency 'lita', '>= 4.7'
19
+ spec.add_runtime_dependency 'discordrb', '>= 3.1.1'
20
+ spec.required_ruby_version = '>= 2.0.0'
21
+
22
+ spec.add_development_dependency 'bundler', '~> 1.3'
23
+ spec.add_development_dependency 'pry-byebug'
24
+ spec.add_development_dependency 'rake'
25
+ spec.add_development_dependency 'rack-test'
26
+ spec.add_development_dependency 'rspec', '>= 3.0.0'
27
+ end
data/locales/en.yml CHANGED
@@ -1,4 +1,4 @@
1
- en:
2
- lita:
3
- adapters:
4
- discord_oauth:
1
+ en:
2
+ lita:
3
+ adapters:
4
+ discord_oauth:
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
2
-
3
- describe Lita::Adapters::Discord_oauth, lita: true do
4
- end
1
+ require 'spec_helper'
2
+
3
+ describe Lita::Adapters::Discord_oauth, lita: true do
4
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,6 @@
1
- require 'lita-discord_oauth'
2
- require 'lita/rspec'
3
-
4
- # A compatibility mode is provided for older plugins upgrading from Lita 3. Since this plugin
5
- # was generated with Lita 4, the compatibility mode should be left disabled.
6
- Lita.version_3_compatibility_mode = false
1
+ require 'lita-discord_oauth'
2
+ require 'lita/rspec'
3
+
4
+ # A compatibility mode is provided for older plugins upgrading from Lita 3. Since this plugin
5
+ # was generated with Lita 4, the compatibility mode should be left disabled.
6
+ Lita.version_3_compatibility_mode = false
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-discord_oauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.alpha.43
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cas Eliëns
@@ -143,12 +143,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
143
143
  version: 2.0.0
144
144
  required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  requirements:
146
- - - ">"
146
+ - - ">="
147
147
  - !ruby/object:Gem::Version
148
- version: 1.3.1
148
+ version: '0'
149
149
  requirements: []
150
150
  rubyforge_project:
151
- rubygems_version: 2.4.5
151
+ rubygems_version: 2.5.1
152
152
  signing_key:
153
153
  specification_version: 4
154
154
  summary: Adapter to connect Lita to Discord using OAuth