discorb 0.16.0 → 0.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitattributes +1 -0
- data/.github/workflows/build_main.yml +2 -2
- data/.github/workflows/build_version.yml +1 -1
- data/.github/workflows/codeql-analysis.yml +1 -1
- data/.github/workflows/lint-push.yml +3 -5
- data/.github/workflows/lint.yml +2 -4
- data/.github/workflows/spec.yml +33 -0
- data/.github/workflows/validate.yml +21 -0
- data/.gitignore +2 -0
- data/.lefthook/commit-msg/validator.rb +5 -0
- data/.rspec +2 -0
- data/.rspec_parallel +2 -0
- data/.rubocop.yml +43 -6
- data/Changelog.md +30 -1
- data/Gemfile +20 -8
- data/Rakefile +226 -98
- data/Steepfile +28 -0
- data/bin/console +3 -3
- data/docs/Examples.md +1 -1
- data/docs/application_command.md +156 -47
- data/docs/cli/irb.md +2 -2
- data/docs/cli/new.md +14 -9
- data/docs/cli/run.md +7 -11
- data/docs/cli.md +17 -10
- data/docs/events.md +247 -213
- data/docs/extension.md +1 -2
- data/docs/faq.md +0 -1
- data/docs/tutorial.md +18 -18
- data/docs/voice_events.md +106 -106
- data/examples/commands/message.rb +68 -0
- data/examples/commands/permission.rb +19 -0
- data/examples/commands/slash.rb +48 -0
- data/examples/commands/user.rb +54 -0
- data/examples/components/authorization_button.rb +4 -3
- data/examples/components/select_menu.rb +6 -3
- data/examples/extension/main.rb +2 -1
- data/examples/extension/message_expander.rb +6 -2
- data/examples/sig/commands/message.rbs +5 -0
- data/examples/simple/eval.rb +3 -2
- data/examples/simple/ping_pong.rb +2 -1
- data/examples/simple/rolepanel.rb +17 -6
- data/examples/simple/shard.rb +3 -2
- data/examples/simple/wait_for_message.rb +4 -1
- data/exe/discorb +33 -18
- data/lefthook.yml +45 -0
- data/lib/discorb/allowed_mentions.rb +2 -1
- data/lib/discorb/app_command/command.rb +130 -72
- data/lib/discorb/app_command/common.rb +25 -0
- data/lib/discorb/app_command/handler.rb +130 -33
- data/lib/discorb/app_command.rb +2 -1
- data/lib/discorb/application.rb +1 -0
- data/lib/discorb/asset.rb +1 -2
- data/lib/discorb/attachment.rb +1 -1
- data/lib/discorb/audit_logs.rb +19 -10
- data/lib/discorb/automod.rb +269 -0
- data/lib/discorb/channel/base.rb +108 -0
- data/lib/discorb/channel/category.rb +32 -0
- data/lib/discorb/channel/container.rb +44 -0
- data/lib/discorb/channel/dm.rb +28 -0
- data/lib/discorb/channel/guild.rb +246 -0
- data/lib/discorb/channel/stage.rb +140 -0
- data/lib/discorb/channel/text.rb +336 -0
- data/lib/discorb/channel/thread.rb +325 -0
- data/lib/discorb/channel/voice.rb +79 -0
- data/lib/discorb/channel.rb +2 -1165
- data/lib/discorb/client.rb +50 -36
- data/lib/discorb/color.rb +37 -60
- data/lib/discorb/common.rb +2 -1
- data/lib/discorb/components/button.rb +2 -1
- data/lib/discorb/components/select_menu.rb +4 -2
- data/lib/discorb/components/text_input.rb +12 -2
- data/lib/discorb/components.rb +1 -1
- data/lib/discorb/dictionary.rb +1 -1
- data/lib/discorb/embed.rb +26 -10
- data/lib/discorb/emoji.rb +31 -4
- data/lib/discorb/emoji_table.rb +4969 -3
- data/lib/discorb/event.rb +29 -4
- data/lib/discorb/exe/about.rb +2 -1
- data/lib/discorb/exe/irb.rb +2 -4
- data/lib/discorb/exe/new.rb +89 -26
- data/lib/discorb/exe/run.rb +8 -22
- data/lib/discorb/exe/setup.rb +25 -12
- data/lib/discorb/exe/show.rb +4 -3
- data/lib/discorb/extend.rb +1 -0
- data/lib/discorb/extension.rb +6 -7
- data/lib/discorb/flag.rb +13 -2
- data/lib/discorb/gateway.rb +79 -589
- data/lib/discorb/gateway_events.rb +638 -0
- data/lib/discorb/guild.rb +318 -67
- data/lib/discorb/guild_template.rb +11 -5
- data/lib/discorb/http.rb +53 -24
- data/lib/discorb/integration.rb +4 -1
- data/lib/discorb/intents.rb +28 -19
- data/lib/discorb/interaction/autocomplete.rb +28 -16
- data/lib/discorb/interaction/command.rb +42 -14
- data/lib/discorb/interaction/components.rb +5 -2
- data/lib/discorb/interaction/modal.rb +0 -1
- data/lib/discorb/interaction/response.rb +125 -26
- data/lib/discorb/interaction/root.rb +13 -13
- data/lib/discorb/interaction.rb +1 -0
- data/lib/discorb/invite.rb +5 -2
- data/lib/discorb/member.rb +28 -8
- data/lib/discorb/message.rb +60 -25
- data/lib/discorb/message_meta.rb +3 -3
- data/lib/discorb/modules.rb +59 -16
- data/lib/discorb/presence.rb +2 -0
- data/lib/discorb/rate_limit.rb +7 -2
- data/lib/discorb/reaction.rb +2 -2
- data/lib/discorb/role.rb +20 -5
- data/lib/discorb/shard.rb +1 -1
- data/lib/discorb/sticker.rb +9 -8
- data/lib/discorb/user.rb +4 -3
- data/lib/discorb/utils/colored_puts.rb +1 -0
- data/lib/discorb/voice_state.rb +6 -2
- data/lib/discorb/webhook.rb +64 -31
- data/lib/discorb.rb +7 -5
- data/po/yard.pot +20 -20
- data/rbs_collection.lock.yaml +88 -0
- data/rbs_collection.yaml +21 -0
- data/sig/async.rbs +11 -0
- data/sig/discorb/activity.rbs +23 -0
- data/sig/discorb/allowed_mentions.rbs +44 -0
- data/sig/discorb/app_command/base.rbs +282 -0
- data/sig/discorb/app_command/handler.rbs +171 -0
- data/sig/discorb/application.rbs +142 -0
- data/sig/discorb/asset.rbs +32 -0
- data/sig/discorb/attachment.rbs +91 -0
- data/sig/discorb/audit_log.rbs +231 -0
- data/sig/discorb/automod.rbs +128 -0
- data/sig/discorb/avatar.rbs +26 -0
- data/sig/discorb/channel/base.rbs +179 -0
- data/sig/discorb/channel/category.rbs +56 -0
- data/sig/discorb/channel/container.rbs +29 -0
- data/sig/discorb/channel/dm.rbs +14 -0
- data/sig/discorb/channel/news.rbs +20 -0
- data/sig/discorb/channel/stage.rbs +77 -0
- data/sig/discorb/channel/text.rbs +158 -0
- data/sig/discorb/channel/thread.rbs +185 -0
- data/sig/discorb/channel/voice.rbs +41 -0
- data/sig/discorb/client.rbs +2495 -0
- data/sig/discorb/color.rbs +142 -0
- data/sig/discorb/component/base.rbs +28 -0
- data/sig/discorb/component/button.rbs +65 -0
- data/sig/discorb/component/select_menu.rbs +107 -0
- data/sig/discorb/component/text_input.rbs +69 -0
- data/sig/discorb/connectable.rbs +8 -0
- data/sig/discorb/custom_emoji.rbs +90 -0
- data/sig/discorb/dictionary.rbs +85 -0
- data/sig/discorb/discord_model.rbs +15 -0
- data/sig/discorb/embed.rbs +279 -0
- data/sig/discorb/emoji.rbs +13 -0
- data/sig/discorb/error.rbs +73 -0
- data/sig/discorb/event_handler.rbs +27 -0
- data/sig/discorb/extension.rbs +1734 -0
- data/sig/discorb/flag.rbs +72 -0
- data/sig/discorb/gateway.rbs +481 -0
- data/sig/discorb/guild.rbs +870 -0
- data/sig/discorb/guild_template.rbs +174 -0
- data/sig/discorb/http.rbs +147 -0
- data/sig/discorb/image.rbs +20 -0
- data/sig/discorb/integration.rbs +118 -0
- data/sig/discorb/intents.rbs +97 -0
- data/sig/discorb/interaction/autocomplete.rbs +9 -0
- data/sig/discorb/interaction/base.rbs +66 -0
- data/sig/discorb/interaction/command.rbs +66 -0
- data/sig/discorb/interaction/message_component.rbs +140 -0
- data/sig/discorb/interaction/modal.rbs +50 -0
- data/sig/discorb/interaction/responder.rbs +157 -0
- data/sig/discorb/invite.rbs +86 -0
- data/sig/discorb/member.rbs +187 -0
- data/sig/discorb/message.rbs +469 -0
- data/sig/discorb/messageable.rbs +153 -0
- data/sig/discorb/partial_emoji.rbs +35 -0
- data/sig/discorb/permissions.rbs +149 -0
- data/sig/discorb/presence.rbs +237 -0
- data/sig/discorb/reaction.rbs +33 -0
- data/sig/discorb/role.rbs +145 -0
- data/sig/discorb/scheduled_event.rbs +148 -0
- data/sig/discorb/shard.rbs +62 -0
- data/sig/discorb/snowflake.rbs +56 -0
- data/sig/discorb/stage_instance.rbs +63 -0
- data/sig/discorb/sticker.rbs +116 -0
- data/sig/discorb/system_channel_flag.rbs +17 -0
- data/sig/discorb/unicode_emoji.rbs +49 -0
- data/sig/discorb/user.rbs +93 -0
- data/sig/discorb/utils.rbs +8 -0
- data/sig/discorb/voice_region.rbs +30 -0
- data/sig/discorb/voice_state.rbs +71 -0
- data/sig/discorb/webhook.rbs +327 -0
- data/sig/discorb/welcome_screen.rbs +78 -0
- data/sig/discorb.rbs +6 -7230
- data/sig/manifest.yaml +3 -0
- data/sig/override.rbs +19 -0
- data/template-replace/files/css/common.css +4 -0
- metadata +102 -6
- data/examples/commands/bookmarker.rb +0 -42
- data/examples/commands/hello.rb +0 -10
- data/examples/commands/inspect.rb +0 -25
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "discorb"
|
3
4
|
|
4
5
|
client = Discorb::Client.new
|
@@ -28,7 +29,7 @@ client.on :message do |message|
|
|
28
29
|
components: [
|
29
30
|
Discorb::Button.new(
|
30
31
|
"Get role", custom_id: "auth:#{role.id}",
|
31
|
-
)
|
32
|
+
),
|
32
33
|
],
|
33
34
|
)
|
34
35
|
end
|
@@ -36,9 +37,9 @@ end
|
|
36
37
|
client.on :button_click do |response|
|
37
38
|
if response.custom_id.start_with?("auth:")
|
38
39
|
id = response.custom_id.delete_prefix("auth:")
|
39
|
-
response.
|
40
|
+
response.user.add_role(id).wait
|
40
41
|
response.post("You got your role!\nHere's your role: <@&#{id}>", ephemeral: true)
|
41
42
|
end
|
42
43
|
end
|
43
44
|
|
44
|
-
client.run(ENV
|
45
|
+
client.run(ENV.fetch("DISCORD_BOT_TOKEN", nil))
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "discorb"
|
3
4
|
|
4
5
|
client = Discorb::Client.new
|
@@ -22,7 +23,7 @@ SECTIONS = [
|
|
22
23
|
> So I decided to make it.
|
23
24
|
Matsumoto describes the design of Ruby as being like a simple Lisp language at its core, with an object system like that of Smalltalk, blocks inspired by higher-order functions, and practical utility like that of Perl.
|
24
25
|
WIKI
|
25
|
-
["First publication", <<~WIKI]
|
26
|
+
["First publication", <<~WIKI],
|
26
27
|
The first public release of Ruby 0.95 was announced on Japanese domestic newsgroups on December 21, 1995.
|
27
28
|
Subsequently, three more versions of Ruby were released in two days.
|
28
29
|
The release coincided with the launch of the Japanese-language ruby-list mailing list, which was the first mailing list for the new language.
|
@@ -41,7 +42,9 @@ client.on :message do |message|
|
|
41
42
|
next if message.author.bot?
|
42
43
|
next unless message.content == "!ruby"
|
43
44
|
|
44
|
-
options = SECTIONS.map.with_index
|
45
|
+
options = SECTIONS.map.with_index do |section, i|
|
46
|
+
Discorb::SelectMenu::Option.new("Page #{i + 1}", "sections:#{i}", description: section[0])
|
47
|
+
end
|
45
48
|
message.channel.post(
|
46
49
|
"Select a section", components: [Discorb::SelectMenu.new("sections", options)],
|
47
50
|
)
|
@@ -59,4 +62,4 @@ client.on :select_menu_select do |response|
|
|
59
62
|
)
|
60
63
|
end
|
61
64
|
|
62
|
-
client.run(ENV
|
65
|
+
client.run(ENV.fetch("DISCORD_BOT_TOKEN", nil))
|
data/examples/extension/main.rb
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "discorb"
|
3
4
|
|
5
|
+
#
|
6
|
+
# Class for expanding message URL.
|
7
|
+
#
|
4
8
|
class MessageExpander
|
5
9
|
include Discorb::Extension
|
6
10
|
|
7
|
-
|
11
|
+
MESSAGE_PATTERN = Regexp.new(
|
8
12
|
'(?!<)https://(?:ptb\.|canary\.)?discord(?:app)?\.com/channels/' \
|
9
13
|
"(?<guild>[0-9]{18})/(?<channel>[0-9]{18})/(?<message>[0-9]{18})(?!>)"
|
10
14
|
)
|
@@ -12,7 +16,7 @@ class MessageExpander
|
|
12
16
|
event :message do |message|
|
13
17
|
next if message.author.bot?
|
14
18
|
|
15
|
-
message.content.to_enum(:scan,
|
19
|
+
message.content.to_enum(:scan, MESSAGE_PATTERN).map { Regexp.last_match }.each do |match|
|
16
20
|
ch = @client.channels[match[:channel]]
|
17
21
|
next if ch.nil?
|
18
22
|
|
data/examples/simple/eval.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "discorb"
|
3
4
|
|
4
5
|
client = Discorb::Client.new
|
@@ -25,9 +26,9 @@ client.on :message do |message|
|
|
25
26
|
res = res.wait if res.is_a? Async::Task
|
26
27
|
message.channel.post("```rb\n#{res.inspect[...1990]}\n```")
|
27
28
|
end
|
28
|
-
rescue Exception => e
|
29
|
+
rescue Exception => e # rubocop:disable Lint/RescueException
|
29
30
|
message.reply embed: Discorb::Embed.new("Error!", "```rb\n#{e.full_message(highlight: false)[...1990]}\n```",
|
30
31
|
color: Discorb::Color[:red])
|
31
32
|
end
|
32
33
|
|
33
|
-
client.run(ENV
|
34
|
+
client.run(ENV.fetch("discord_bot_token", nil))
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "discorb"
|
3
4
|
|
4
5
|
client = Discorb::Client.new
|
@@ -14,4 +15,4 @@ client.on :message do |message|
|
|
14
15
|
message.channel.post("Pong!")
|
15
16
|
end
|
16
17
|
|
17
|
-
client.run(ENV
|
18
|
+
client.run(ENV.fetch("DISCORD_BOT_TOKEN", nil))
|
@@ -1,7 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "discorb"
|
3
4
|
intents = Discorb::Intents.new
|
4
5
|
intents.members = true
|
6
|
+
|
5
7
|
client = Discorb::Client.new(intents: intents)
|
6
8
|
|
7
9
|
def convert_role(guild, string)
|
@@ -15,6 +17,8 @@ client.once :standby do
|
|
15
17
|
end
|
16
18
|
|
17
19
|
client.on :reaction_add do |event|
|
20
|
+
next unless event.guild
|
21
|
+
next unless event.member
|
18
22
|
next unless event.emoji.value.end_with?(0x0000fe0f.chr("utf-8") + 0x000020e3.chr("utf-8"))
|
19
23
|
next if event.member.bot?
|
20
24
|
|
@@ -31,6 +35,7 @@ end
|
|
31
35
|
|
32
36
|
client.on :reaction_remove do |event|
|
33
37
|
next unless event.emoji.value.end_with?(0x0000fe0f.chr("utf-8") + 0x000020e3.chr("utf-8"))
|
38
|
+
next unless event.member
|
34
39
|
next if event.member.bot?
|
35
40
|
|
36
41
|
msg = event.fetch_message.wait
|
@@ -49,18 +54,24 @@ client.on :message do |message|
|
|
49
54
|
next if message.author.bot?
|
50
55
|
|
51
56
|
message.reply("Too many roles.") if message.content.split.length > 10
|
52
|
-
roles = message.content.delete_prefix("/rp ").split.map.with_index
|
57
|
+
roles = message.content.delete_prefix("/rp ").split.map.with_index do |raw_role, index|
|
58
|
+
[index, convert_role(message.guild, raw_role), raw_role]
|
59
|
+
end
|
53
60
|
if (convert_fails = roles.filter { |r| r[1].nil? }).length.positive?
|
54
61
|
message.reply("#{convert_fails.map { |r| r[2] }.join(", ")} is not a role.")
|
55
62
|
next
|
56
63
|
end
|
57
|
-
rp_msg = message.channel.post(
|
58
|
-
|
59
|
-
|
60
|
-
|
64
|
+
rp_msg = message.channel.post(
|
65
|
+
embed: Discorb::Embed.new(
|
66
|
+
"Role panel",
|
67
|
+
roles.map.with_index(1) do |r, index|
|
68
|
+
"#{index}\ufe0f\u20e3#{r[1].mention}"
|
69
|
+
end.join("\n")
|
70
|
+
),
|
71
|
+
).wait
|
61
72
|
1.upto(roles.length).each do |i|
|
62
73
|
rp_msg.add_reaction(Discorb::UnicodeEmoji["#{i}\ufe0f\u20e3"]).wait
|
63
74
|
end
|
64
75
|
end
|
65
76
|
|
66
|
-
client.run(ENV
|
77
|
+
client.run(ENV.fetch("DISCORD_BOT_TOKEN", nil))
|
data/examples/simple/shard.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "discorb"
|
3
4
|
|
4
|
-
client = Discorb::Client.new(
|
5
|
+
client = Discorb::Client.new(logger: Logger.new($stderr))
|
5
6
|
|
6
7
|
client.once :standby do
|
7
8
|
puts "Logged in as #{client.user}"
|
@@ -14,4 +15,4 @@ client.on :message do |message|
|
|
14
15
|
message.channel.post("I'm #{client.user}, running on shard #{client.shard_id}!")
|
15
16
|
end
|
16
17
|
|
17
|
-
client.run(ENV
|
18
|
+
client.run(ENV.fetch("DISCORD_BOT_TOKEN", nil), shards: [0, 1], shard_count: 2)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "discorb"
|
3
4
|
|
4
5
|
client = Discorb::Client.new
|
@@ -12,6 +13,8 @@ client.on :message do |message|
|
|
12
13
|
next unless message.content == "!quiz"
|
13
14
|
|
14
15
|
operator = %i[+ - *].sample
|
16
|
+
next unless operator
|
17
|
+
|
15
18
|
num1 = rand(1..10)
|
16
19
|
num2 = rand(1..10)
|
17
20
|
|
@@ -28,4 +31,4 @@ client.on :message do |message|
|
|
28
31
|
end
|
29
32
|
end
|
30
33
|
|
31
|
-
client.run(ENV
|
34
|
+
client.run(ENV.fetch("DISCORD_BOT_TOKEN", nil))
|
data/exe/discorb
CHANGED
@@ -1,32 +1,47 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
4
|
+
require "optparse"
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
options = {
|
7
|
+
bundler: true,
|
8
|
+
}
|
9
|
+
discorb_paths = $LOAD_PATH.filter { |path| File.directory?(path + "/discorb") }
|
10
|
+
scripts = {}
|
11
|
+
discorb_paths.each do |discorb_path|
|
11
12
|
Dir.glob(discorb_path + "/discorb/exe/*.rb") do |exe_script|
|
12
13
|
name = File.basename(exe_script, ".rb")
|
13
14
|
description = File.read(exe_script).match(/# description: (.+)/)&.[](1) || "No description"
|
14
15
|
scripts[name] = description
|
15
16
|
end
|
16
|
-
|
17
|
-
|
18
|
-
|
17
|
+
end
|
18
|
+
max_length = scripts.keys.map(&:length).max
|
19
|
+
global = OptionParser.new do |opts|
|
20
|
+
opts.banner = "Usage: discorb [options] [subcommand [options]]"
|
21
|
+
opts.on("-b", "--[no-]bundler", "Whether to use bundler.") do |v|
|
22
|
+
options[:bundler] = v
|
19
23
|
end
|
24
|
+
opts.separator ""
|
25
|
+
commands = +"Subcommands:\n"
|
26
|
+
commands << scripts.sort.map do |name, description|
|
27
|
+
" #{name.rjust(max_length)} - #{description}"
|
28
|
+
end.join("\n")
|
29
|
+
commands << "\n\nYou can run `discorb [subcommand] --help` for more information."
|
30
|
+
opts.separator commands
|
31
|
+
end
|
32
|
+
global.order!(ARGV)
|
20
33
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
exit 1
|
34
|
+
if ARGV.empty?
|
35
|
+
puts global
|
36
|
+
abort
|
25
37
|
end
|
26
38
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
39
|
+
require "bundler/setup" if options[:bundler]
|
40
|
+
|
41
|
+
command = ARGV.shift
|
42
|
+
|
43
|
+
unless $LOAD_PATH.resolve_feature_path("discorb/exe/#{command}.rb")
|
44
|
+
warn "Unknown subcommand: #{command}"
|
45
|
+
abort
|
32
46
|
end
|
47
|
+
require "discorb/exe/#{command}"
|
data/lefthook.yml
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# EXAMPLE USAGE
|
2
|
+
# Refer for explanation to following link:
|
3
|
+
# https://github.com/evilmartians/lefthook/blob/master/docs/full_guide.md
|
4
|
+
#
|
5
|
+
# pre-push:
|
6
|
+
# commands:
|
7
|
+
# packages-audit:
|
8
|
+
# tags: frontend security
|
9
|
+
# run: yarn audit
|
10
|
+
# gems-audit:
|
11
|
+
# tags: backend security
|
12
|
+
# run: bundle audit
|
13
|
+
#
|
14
|
+
# pre-commit:
|
15
|
+
# parallel: true
|
16
|
+
# commands:
|
17
|
+
# eslint:
|
18
|
+
# glob: "*.{js,ts}"
|
19
|
+
# run: yarn eslint {staged_files}
|
20
|
+
# rubocop:
|
21
|
+
# tags: backend style
|
22
|
+
# glob: "*.rb"
|
23
|
+
# exclude: "application.rb|routes.rb"
|
24
|
+
# run: bundle exec rubocop --force-exclusion {all_files}
|
25
|
+
# govet:
|
26
|
+
# tags: backend style
|
27
|
+
# files: git ls-files -m
|
28
|
+
# glob: "*.go"
|
29
|
+
# run: go vet {files}
|
30
|
+
# scripts:
|
31
|
+
# "hello.js":
|
32
|
+
# runner: node
|
33
|
+
# "any.go":
|
34
|
+
# runner: go run
|
35
|
+
pre-commit:
|
36
|
+
parallel: true
|
37
|
+
commands:
|
38
|
+
linting:
|
39
|
+
glob: "*.rb"
|
40
|
+
run: rubocop {staged_files}
|
41
|
+
|
42
|
+
commit-msg:
|
43
|
+
scripts:
|
44
|
+
"validator.rb":
|
45
|
+
runner: ruby
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Discorb
|
3
4
|
#
|
4
5
|
# Represents a allowed mentions in a message.
|
@@ -22,7 +23,7 @@ module Discorb
|
|
22
23
|
# @param [Boolean] replied_user Whether to ping the user that sent the message to reply.
|
23
24
|
#
|
24
25
|
def initialize(everyone: nil, roles: nil, users: nil, replied_user: nil)
|
25
|
-
@everyone = everyone
|
26
|
+
@everyone = !everyone.nil?
|
26
27
|
@roles = roles
|
27
28
|
@users = users
|
28
29
|
@replied_user = replied_user
|