discord-pomodoro 0.1.0

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 959920ddeba86b43e8c80fbb0e92260f58cacb886551baa16704983b0b2b13f4
4
+ data.tar.gz: 1401253cd2f9fa7608e7b13a6f7ce9732a8d54047863e4481a51c4ea3e167bb0
5
+ SHA512:
6
+ metadata.gz: 84c036b8073fffabadfcbf1d15289fcf3356725451cd62239ea452bcc3068e551b9bcfcf9781e5adcc15de09bb563560d93ed90bbd7d07ef95b603e0e68962be
7
+ data.tar.gz: df3afcb555b8d54157d19b4ba24db7eb60bff0726f2344e6125ae4d3dfa015510a46842126126fc49269d47dbdad29f5a3de70eacfb1a6a68843899b340989ef
data/.dockerignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ .env
data/.env.sample ADDED
@@ -0,0 +1,2 @@
1
+ DISCORD_BOT_TOKEN=xxxxxx
2
+ DISCORD_VOICE_CHANNEL_ID=xxxxxx
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ .env
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2022-07-10
4
+
5
+ - Initial release
data/Dockerfile ADDED
@@ -0,0 +1,13 @@
1
+ FROM ruby
2
+
3
+ RUN apt-get update && apt-get install -y \
4
+ libsodium-dev \
5
+ libopus-dev \
6
+ ffmpeg
7
+
8
+ WORKDIR /app
9
+ COPY . /app
10
+ RUN bundle install
11
+ RUN bundle exec rake install
12
+
13
+ CMD discord-pomodoro
data/Dockerfile.dev ADDED
@@ -0,0 +1,14 @@
1
+ FROM ruby
2
+
3
+ RUN apt-get update && apt-get install -y \
4
+ libsodium-dev \
5
+ libopus-dev \
6
+ ffmpeg
7
+
8
+ WORKDIR /app
9
+ COPY . /app
10
+ RUN bundle install
11
+ RUN bundle exec rake install
12
+
13
+ RUN bin/setup
14
+ CMD bin/console
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in discord-pomodoro.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
11
+
12
+ gem "rubocop", "~> 1.7"
data/Gemfile.lock ADDED
@@ -0,0 +1,101 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ discord-pomodoro (0.1.0)
5
+ discordrb (~> 3.4)
6
+ rufus-scheduler (~> 3.8)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ ast (2.4.2)
12
+ concurrent-ruby (1.1.10)
13
+ diff-lcs (1.5.0)
14
+ discordrb (3.4.0)
15
+ discordrb-webhooks (~> 3.3.0)
16
+ ffi (>= 1.9.24)
17
+ opus-ruby
18
+ rest-client (>= 2.0.0)
19
+ websocket-client-simple (>= 0.3.0)
20
+ discordrb-webhooks (3.3.0)
21
+ rest-client (>= 2.1.0.rc1)
22
+ domain_name (0.5.20190701)
23
+ unf (>= 0.0.5, < 1.0.0)
24
+ et-orbi (1.2.7)
25
+ tzinfo
26
+ event_emitter (0.2.6)
27
+ ffi (1.15.5)
28
+ fugit (1.5.3)
29
+ et-orbi (~> 1, >= 1.2.7)
30
+ raabro (~> 1.4)
31
+ http-accept (1.7.0)
32
+ http-cookie (1.0.5)
33
+ domain_name (~> 0.5)
34
+ mime-types (3.4.1)
35
+ mime-types-data (~> 3.2015)
36
+ mime-types-data (3.2022.0105)
37
+ netrc (0.11.0)
38
+ opus-ruby (1.0.1)
39
+ ffi
40
+ parallel (1.22.1)
41
+ parser (3.1.2.0)
42
+ ast (~> 2.4.1)
43
+ raabro (1.4.0)
44
+ rainbow (3.1.1)
45
+ rake (13.0.6)
46
+ regexp_parser (2.5.0)
47
+ rest-client (2.1.0)
48
+ http-accept (>= 1.7.0, < 2.0)
49
+ http-cookie (>= 1.0.2, < 2.0)
50
+ mime-types (>= 1.16, < 4.0)
51
+ netrc (~> 0.8)
52
+ rexml (3.2.5)
53
+ rspec (3.11.0)
54
+ rspec-core (~> 3.11.0)
55
+ rspec-expectations (~> 3.11.0)
56
+ rspec-mocks (~> 3.11.0)
57
+ rspec-core (3.11.0)
58
+ rspec-support (~> 3.11.0)
59
+ rspec-expectations (3.11.0)
60
+ diff-lcs (>= 1.2.0, < 2.0)
61
+ rspec-support (~> 3.11.0)
62
+ rspec-mocks (3.11.1)
63
+ diff-lcs (>= 1.2.0, < 2.0)
64
+ rspec-support (~> 3.11.0)
65
+ rspec-support (3.11.0)
66
+ rubocop (1.30.1)
67
+ parallel (~> 1.10)
68
+ parser (>= 3.1.0.0)
69
+ rainbow (>= 2.2.2, < 4.0)
70
+ regexp_parser (>= 1.8, < 3.0)
71
+ rexml (>= 3.2.5, < 4.0)
72
+ rubocop-ast (>= 1.18.0, < 2.0)
73
+ ruby-progressbar (~> 1.7)
74
+ unicode-display_width (>= 1.4.0, < 3.0)
75
+ rubocop-ast (1.18.0)
76
+ parser (>= 3.1.1.0)
77
+ ruby-progressbar (1.11.0)
78
+ rufus-scheduler (3.8.1)
79
+ fugit (~> 1.1, >= 1.1.6)
80
+ tzinfo (2.0.4)
81
+ concurrent-ruby (~> 1.0)
82
+ unf (0.1.4)
83
+ unf_ext
84
+ unf_ext (0.0.8.2)
85
+ unicode-display_width (2.1.0)
86
+ websocket (1.2.9)
87
+ websocket-client-simple (0.5.1)
88
+ event_emitter
89
+ websocket
90
+
91
+ PLATFORMS
92
+ x86_64-linux
93
+
94
+ DEPENDENCIES
95
+ discord-pomodoro!
96
+ rake (~> 13.0)
97
+ rspec (~> 3.0)
98
+ rubocop (~> 1.7)
99
+
100
+ BUNDLED WITH
101
+ 2.2.22
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 megane42
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,70 @@
1
+ # Discord::Pomodoro
2
+
3
+ - Discord::Pomodoro is a simple pomodoro bot for discord.
4
+ - It sounds a chime on the specified voice channel
5
+ - at **:00 (meaning "Pomodoro Start")
6
+ - at **:50 (meaning "Breaktime Start")
7
+
8
+ ## Requirements
9
+
10
+ - Discord bot token & invite the bot to your server
11
+ - https://github.com/reactiflux/discord-irc/wiki/Creating-a-discord-bot-&-getting-a-token
12
+ - Discord voice channel id
13
+ - https://support.discord.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID-
14
+
15
+ ## Usage
16
+
17
+ - Docker-compose way or Docker way is recommended because
18
+ - it's the easiest to boot
19
+ - it does not pollute your local environment
20
+
21
+ ### Docker-compose way
22
+
23
+ ```sh
24
+ git clone https://github.com/megane42/discord-pomodoro.git
25
+ cd discord-pomodoro
26
+ echo DISCORD_BOT_TOKEN=****** >> .env
27
+ echo DISCORD_VOICE_CHANNEL_ID=****** >> .env
28
+ docker-compose run --rm app
29
+ ```
30
+
31
+ ### Docker way
32
+
33
+ ```sh
34
+ export DISCORD_BOT_TOKEN=******
35
+ export DISCORD_VOICE_CHANNEL_ID=******
36
+ docker run --rm -it megane42/discord-pomodoro
37
+ ```
38
+
39
+ ### Rubygems way
40
+
41
+ ```sh
42
+ sudo apt-get install libsodium-dev libopus-dev ffmpeg
43
+ gem install discord-pomodoro
44
+ export DISCORD_BOT_TOKEN=******
45
+ export DISCORD_VOICE_CHANNEL_ID=******
46
+ discord-pomodoro
47
+ ```
48
+
49
+ ## Development
50
+
51
+ - Run console
52
+ - `docker-compose run --rm dev`
53
+ - Run current gem
54
+ - `docker-compose run --rm dev discord-pomodoro`
55
+ - Release
56
+ - `emacs CHANGELOG.md`
57
+ - `emacs lib/discord/pomodoro/version.rb`
58
+ - `bundle exec rake release`
59
+
60
+ ## Contributing
61
+
62
+ Bug reports and pull requests are welcome on GitHub at https://github.com/megane42/discord-pomodoro.
63
+
64
+ ## License
65
+
66
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
67
+
68
+ ## Sounds
69
+
70
+ OtoLogic (CC BY 4.0) https://otologic.jp (Shortbridge17-1.mp3)
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
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 "discord/pomodoro"
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 "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/discord/pomodoro/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "discord-pomodoro"
7
+ spec.version = Discord::Pomodoro::VERSION
8
+ spec.authors = ["megane42"]
9
+ spec.email = [""]
10
+
11
+ spec.summary = "Simple pomodoro bot for discord"
12
+ spec.description = "You can set timer and receive notify on your voice channel."
13
+ spec.homepage = "https://github.com/megane42/discord-pomodoro/"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 2.6.0"
16
+
17
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
18
+
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = spec.homepage
21
+ spec.metadata["changelog_uri"] = spec.homepage + "CHANGELOG.md"
22
+
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
26
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
27
+ end
28
+ spec.bindir = "exe"
29
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ["lib"]
31
+
32
+ spec.add_dependency "discordrb", "~> 3.4"
33
+ spec.add_dependency "rufus-scheduler", "~> 3.8"
34
+ end
@@ -0,0 +1,15 @@
1
+ version: "3.9"
2
+ services:
3
+ app:
4
+ build: .
5
+ env_file:
6
+ - .env
7
+
8
+ dev:
9
+ build:
10
+ context: .
11
+ dockerfile: Dockerfile.dev
12
+ env_file:
13
+ - .env
14
+ volumes:
15
+ - .:/app
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "discord/pomodoro"
4
+
5
+ Discord::Pomodoro::Bot.new.run
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "discordrb"
4
+ require "rufus-scheduler"
5
+
6
+ module Discord
7
+ module Pomodoro
8
+ # main bot
9
+ class Bot
10
+ def run
11
+ bot.run(true)
12
+ at_exit { bot.stop }
13
+
14
+ connect_voice_bot
15
+ schedule_chime
16
+
17
+ bot.join
18
+ end
19
+
20
+ private
21
+
22
+ def bot
23
+ @bot ||= Discordrb::Bot.new token: ENV["DISCORD_BOT_TOKEN"]
24
+ end
25
+
26
+ def voice_bot
27
+ @voice_bot ||= bot.voice_connect(ENV["DISCORD_VOICE_CHANNEL_ID"])
28
+ end
29
+
30
+ def connect_voice_bot
31
+ voice_bot
32
+ end
33
+
34
+ def chime_path
35
+ @chime_path ||= File.expand_path("../../../sounds/chime.mp3", __dir__)
36
+ end
37
+
38
+ def scheduler
39
+ @scheduler ||= Rufus::Scheduler.new
40
+ end
41
+
42
+ def schedule_chime
43
+ scheduler.cron("0 * * * *") { voice_bot.play_file chime_path }
44
+ scheduler.cron("50 * * * *") { voice_bot.play_file chime_path }
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Discord
4
+ module Pomodoro
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "discord/pomodoro/version"
4
+ require "discord/pomodoro/bot"
5
+
6
+ module Discord
7
+ module Pomodoro
8
+ class Error < StandardError; end
9
+ end
10
+ end
data/sounds/chime.mp3 ADDED
Binary file
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: discord-pomodoro
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - megane42
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-07-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: discordrb
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rufus-scheduler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.8'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.8'
41
+ description: You can set timer and receive notify on your voice channel.
42
+ email:
43
+ - ''
44
+ executables:
45
+ - discord-pomodoro
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".dockerignore"
50
+ - ".env.sample"
51
+ - ".gitignore"
52
+ - ".rspec"
53
+ - ".rubocop.yml"
54
+ - CHANGELOG.md
55
+ - Dockerfile
56
+ - Dockerfile.dev
57
+ - Gemfile
58
+ - Gemfile.lock
59
+ - LICENSE.txt
60
+ - README.md
61
+ - Rakefile
62
+ - bin/console
63
+ - bin/setup
64
+ - discord-pomodoro.gemspec
65
+ - docker-compose.yml
66
+ - exe/discord-pomodoro
67
+ - lib/discord/pomodoro.rb
68
+ - lib/discord/pomodoro/bot.rb
69
+ - lib/discord/pomodoro/version.rb
70
+ - sounds/chime.mp3
71
+ homepage: https://github.com/megane42/discord-pomodoro/
72
+ licenses:
73
+ - MIT
74
+ metadata:
75
+ allowed_push_host: https://rubygems.org
76
+ homepage_uri: https://github.com/megane42/discord-pomodoro/
77
+ source_code_uri: https://github.com/megane42/discord-pomodoro/
78
+ changelog_uri: https://github.com/megane42/discord-pomodoro/CHANGELOG.md
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: 2.6.0
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ requirements: []
94
+ rubygems_version: 3.2.22
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: Simple pomodoro bot for discord
98
+ test_files: []