lita-discord_oauth 0.1.0.pre.alpha.pre.14 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,21 +1,21 @@
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
- TODO: Add a description of the plugin.
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
- TODO: Describe any configuration attributes the plugin exposes.
18
-
19
- ## Usage
20
-
21
- 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)
4
+
5
+ TODO: Add a description of the plugin.
6
+
7
+ ## Installation
8
+
9
+ Add lita-discord to your Lita instance's Gemfile:
10
+
11
+ ``` ruby
12
+ gem "lita-discord"
13
+ ```
14
+
15
+ ## Configuration
16
+
17
+ TODO: Describe any configuration attributes the plugin exposes.
18
+
19
+ ## Usage
20
+
21
+ 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,63 +1,63 @@
1
- require 'discordrb'
2
-
3
- module Lita
4
- module Adapters
5
- class Discord_oauth < Adapter
6
- # insert adapter code here
7
- config :token, type: String, required: true
8
- config :client, type: String, required: true
9
- config :prefix, type: String, required: true
10
-
11
- def initialize(robot)
12
- super
13
- @client = ::Discordrb::Bot.new token: config.token, client_id: config.client
14
- end
15
-
16
- def run
17
- @client.connect
18
-
19
-
20
- @client.ready do
21
- robot.trigger(:connected)
22
- end
23
-
24
- @client.message(starts_with: config.prefix) do |event|
25
- message = event.message
26
- message_text = message.content
27
-
28
- user = Lita::User.find_by_id(message.author.id)
29
- user = Lita::User.create(user) unless user
30
-
31
- channel = event.channel.id
32
-
33
- source = Lita::Source.new(user: user, room: channel)
34
- msg = Lita::Message.new(robot, message_text, source)
35
-
36
- robot.receive(msg) unless message.from_bot?
37
-
38
- end
39
-
40
- @client.run
41
- end
42
-
43
- def shut_down
44
- @client.stop
45
- end
46
-
47
- def send_messages(target, messages)
48
- mention = @client.user(target.user).mention
49
-
50
- messages.each do |message|
51
- if mention
52
- message = mention + ',\n' + message
53
-
54
- @client.send_message(target.channel, message)
55
- end
56
- end
57
- end
58
-
59
- end
60
-
61
- Lita.register_adapter(:discord, Discord_oauth)
62
- end
63
- end
1
+ require 'discordrb'
2
+
3
+ module Lita
4
+ module Adapters
5
+ class Discord < Adapter
6
+ # insert adapter code here
7
+ config :token, type: String, required: true
8
+ config :client, type: String, required: true
9
+ config :prefix, type: String, required: true
10
+
11
+ def initialize(robot)
12
+ super
13
+ @client = ::Discordrb::Bot.new token: config.token, client_id: config.client
14
+ end
15
+
16
+ def run
17
+ @client.connect
18
+
19
+
20
+ @client.ready do
21
+ robot.trigger(:connected)
22
+ end
23
+
24
+ @client.message(starts_with: config.prefix) do |event|
25
+ message = event.message
26
+ message_text = message.content
27
+
28
+ user = Lita::User.find_by_id(message.author.id)
29
+ user = Lita::User.create(user) unless user
30
+
31
+ channel = event.channel.id
32
+
33
+ source = Lita::Source.new(user: user, room: channel)
34
+ msg = Lita::Message.new(robot, message_text, source)
35
+
36
+ robot.receive(msg) unless message.from_bot?
37
+
38
+ end
39
+
40
+ @client.run
41
+ end
42
+
43
+ def shut_down
44
+ @client.stop
45
+ end
46
+
47
+ def send_messages(target, messages)
48
+ mention = @client.user(target.user).mention
49
+
50
+ messages.each do |message|
51
+ if mention
52
+ message = mention + ',\n' + message
53
+
54
+ @client.send_message(target.channel, message)
55
+ end
56
+ end
57
+ end
58
+
59
+ end
60
+
61
+ Lita.register_adapter(:discord, Discord)
62
+ end
63
+ 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,26 +1,26 @@
1
- Gem::Specification.new do |spec|
2
- spec.name = 'lita-discord_oauth'
3
- spec.version = '0.1.0'
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'
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
-
21
- spec.add_development_dependency 'bundler', '~> 1.3'
22
- spec.add_development_dependency 'pry-byebug'
23
- spec.add_development_dependency 'rake'
24
- spec.add_development_dependency 'rack-test'
25
- spec.add_development_dependency 'rspec', '>= 3.0.0'
26
- end
1
+ Gem::Specification.new do |spec|
2
+ spec.name = 'lita-discord_oauth'
3
+ spec.version = '0.1.0'
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'
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
+
21
+ spec.add_development_dependency 'bundler', '~> 1.3'
22
+ spec.add_development_dependency 'pry-byebug'
23
+ spec.add_development_dependency 'rake'
24
+ spec.add_development_dependency 'rack-test'
25
+ spec.add_development_dependency 'rspec', '>= 3.0.0'
26
+ 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, 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.0.pre.alpha.pre.14
4
+ version: 0.1.0
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: '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