discord-pomodoro 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.dockerignore +13 -0
- data/.env.sample +2 -0
- data/.gitignore +13 -0
- data/.rspec +3 -0
- data/.rubocop.yml +13 -0
- data/CHANGELOG.md +5 -0
- data/Dockerfile +13 -0
- data/Dockerfile.dev +14 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +101 -0
- data/LICENSE.txt +21 -0
- data/README.md +70 -0
- data/Rakefile +12 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/discord-pomodoro.gemspec +34 -0
- data/docker-compose.yml +15 -0
- data/exe/discord-pomodoro +5 -0
- data/lib/discord/pomodoro/bot.rb +48 -0
- data/lib/discord/pomodoro/version.rb +7 -0
- data/lib/discord/pomodoro.rb +10 -0
- data/sounds/chime.mp3 +0 -0
- metadata +98 -0
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
data/.env.sample
ADDED
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/CHANGELOG.md
ADDED
data/Dockerfile
ADDED
data/Dockerfile.dev
ADDED
data/Gemfile
ADDED
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
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,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
|
data/docker-compose.yml
ADDED
@@ -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
|
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: []
|