dsend 1.0.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 +7 -0
- data/bin/dsend +23 -0
- data/lib/dsend/main.rb +23 -0
- metadata +45 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7f44c78135a37f9f018a16b1745e62a964d46ddc603d158394aa54e5a54d8f62
|
4
|
+
data.tar.gz: 17cc0152f1eb1047cda42c7d05edc67f743d7052e0be0190d634d2b00eb6540b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bdb9bdb06cba07263e16620673bba0067a75423b05b2b06b5ead221cd4eb47d58d11bdc50e7f64261a89b8110ec9541aa394f388e934c0db0956e6422a1bca86
|
7
|
+
data.tar.gz: aa30eded8950a8fe785635ae3da3c43c6b632b26bec9e7b9d0b288cf45da1074a2f024005acb7c9160dd30d4bf306da7690bcd1fbe2887fadcde15c60586a080
|
data/bin/dsend
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "optparse"
|
4
|
+
require "ostruct"
|
5
|
+
require "dsend/main"
|
6
|
+
include DSend
|
7
|
+
|
8
|
+
messages = []
|
9
|
+
options = OpenStruct.new
|
10
|
+
|
11
|
+
OptionParser.new do |parser|
|
12
|
+
parser.banner = "Usage: dsend [options]"
|
13
|
+
parser.on("-k", "--discord-key=DISCORDKEY", "Discord API bot key") do |k|
|
14
|
+
options[:api_key] = k
|
15
|
+
end
|
16
|
+
parser.on("-c", "--channel-id=CHANNEL_ID", "Discord channel id") do |c|
|
17
|
+
options[:chan_id] = c
|
18
|
+
end
|
19
|
+
end.parse!
|
20
|
+
|
21
|
+
ARGV.each { |a| messages.push(a)}
|
22
|
+
|
23
|
+
DSend.send_message(options, messages)
|
data/lib/dsend/main.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require "discordrb"
|
2
|
+
|
3
|
+
module DSend
|
4
|
+
def send_message(options, messages)
|
5
|
+
if not options.api_key or not options.chan_id then
|
6
|
+
puts "Missing arguments"
|
7
|
+
exit
|
8
|
+
end
|
9
|
+
puts "Creating a bot using key #{options.api_key}"
|
10
|
+
bot = Discordrb::Bot.new token: options.api_key
|
11
|
+
puts "Establishing battlefield control, stand by"
|
12
|
+
bot.ready do
|
13
|
+
puts "Connection established"
|
14
|
+
puts "Attempting to send #{messages.length} message(s)"
|
15
|
+
messages.each do |m|
|
16
|
+
puts "Sending message #{m} to channel #{options.chan_id}"
|
17
|
+
bot.send_message(options.chan_id, m)
|
18
|
+
end
|
19
|
+
bot.stop
|
20
|
+
end
|
21
|
+
bot.run
|
22
|
+
end
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dsend
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andreas Kruhlmann
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-06-26 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: ''
|
14
|
+
email: andreas@kruhlmann.dev
|
15
|
+
executables:
|
16
|
+
- dsend
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- bin/dsend
|
21
|
+
- lib/dsend/main.rb
|
22
|
+
homepage: https://github.com/Kruhlmann/dsend
|
23
|
+
licenses:
|
24
|
+
- GPL-3.0-or-later
|
25
|
+
metadata: {}
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- lib
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubygems_version: 3.0.3
|
42
|
+
signing_key:
|
43
|
+
specification_version: 4
|
44
|
+
summary: Discord bot message sender
|
45
|
+
test_files: []
|