Skip to content

Commit

Permalink
Appease the RuboCop
Browse files Browse the repository at this point in the history
  • Loading branch information
PanisSupraOmnia committed May 4, 2022
1 parent 562c4aa commit 2a4ccf0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions discordrb.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'redcarpet', '~> 3.5.0' # YARD markdown formatting
spec.add_development_dependency 'rspec', '~> 3.11.0'
spec.add_development_dependency 'rspec_junit_formatter', '~> 0.4.1'
spec.add_development_dependency 'rspec_junit_formatter', '~> 0.5.1'
spec.add_development_dependency 'rspec-prof', '~> 0.0.7'
spec.add_development_dependency 'rubocop', '~> 1.27.0'
spec.add_development_dependency 'rubocop', '~> 1.28.2'
spec.add_development_dependency 'rubocop-performance', '~> 1.0'
spec.add_development_dependency 'rubocop-rake', '~> 0.6.0'
spec.add_development_dependency 'simplecov', '~> 0.21.0'
Expand Down
6 changes: 3 additions & 3 deletions examples/slash_commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'discordrb'

bot = Discordrb::Bot.new(token: ENV['SLASH_COMMAND_BOT_TOKEN'], intents: [:server_messages])
bot = Discordrb::Bot.new(token: ENV.fetch('SLASH_COMMAND_BOT_TOKEN', nil), intents: [:server_messages])

# We need to register our application comomands separately from the handlers with a special DSL.
# This example uses server specific commands so that they appear immediately for testing,
Expand All @@ -11,7 +11,7 @@
#
# You may want to have a separate script for registering your commands so you don't need to do this every
# time you start your bot.
bot.register_application_command(:example, 'Example commands', server_id: ENV['SLASH_COMMAND_BOT_SERVER_ID']) do |cmd|
bot.register_application_command(:example, 'Example commands', server_id: ENV.fetch('SLASH_COMMAND_BOT_SERVER_ID', nil)) do |cmd|
cmd.subcommand_group(:fun, 'Fun things!') do |group|
group.subcommand('8ball', 'Shake the magic 8 ball') do |sub|
sub.string('question', 'Ask a question to receive wisdom', required: true)
Expand All @@ -29,7 +29,7 @@
end
end

bot.register_application_command(:spongecase, 'Are you mocking me?', server_id: ENV['SLASH_COMMAND_BOT_SERVER_ID']) do |cmd|
bot.register_application_command(:spongecase, 'Are you mocking me?', server_id: ENV.fetch('SLASH_COMMAND_BOT_SERVER_ID', nil)) do |cmd|
cmd.string('message', 'Message to spongecase')
cmd.boolean('with_picture', 'Show the mocking sponge?')
end
Expand Down
2 changes: 1 addition & 1 deletion lib/discordrb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module Discordrb
Thread.current[:discordrb_name] = 'main'

# The default debug logger used by discordrb.
LOGGER = Logger.new(ENV['DISCORDRB_FANCY_LOG'])
LOGGER = Logger.new(ENV.fetch('DISCORDRB_FANCY_LOG', false))

# The Unix timestamp Discord IDs are based on
DISCORD_EPOCH = 1_420_070_400_000
Expand Down
2 changes: 1 addition & 1 deletion lib/discordrb/data/channel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ def users
if text?
server.online_members(include_idle: true).select { |u| u.can_read_messages? self }
elsif voice?
server.voice_states.map { |id, voice_state| server.member(id) if !voice_state.voice_channel.nil? && voice_state.voice_channel.id == @id }.compact
server.voice_states.filter_map { |id, voice_state| server.member(id) if !voice_state.voice_channel.nil? && voice_state.voice_channel.id == @id }
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/discordrb/permissions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def initialize(bits = 0, writer = nil)
# permissions.defined_permissions #=> [:create_instant_invite, :administrator]
# @return [Array<Symbol>] the permissions
def defined_permissions
FLAGS.collect { |value, name| (@bits & (1 << value)).positive? ? name : nil }.compact
FLAGS.filter_map { |value, name| (@bits & (1 << value)).positive? ? name : nil }
end

# Comparison based on permission bits
Expand Down

0 comments on commit 2a4ccf0

Please sign in to comment.