Skip to content

Commit

Permalink
Update gems and apply RuboCop fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Quintasan committed Mar 28, 2024
1 parent 1949efe commit c23705a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 42 deletions.
68 changes: 31 additions & 37 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.5)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
base64 (0.1.1)
bigdecimal (3.1.4)
base64 (0.2.0)
bigdecimal (3.1.7)
byebug (11.1.3)
coderay (1.1.3)
concurrent-ruby (1.2.2)
concurrent-ruby (1.2.3)
declarative (0.0.20)
discordrb (3.5.0)
discordrb-webhooks (~> 3.5.0)
Expand All @@ -18,10 +18,9 @@ GEM
websocket-client-simple (>= 0.3.0)
discordrb-webhooks (3.5.0)
rest-client (>= 2.0.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
dotenv (2.8.1)
et-orbi (1.2.7)
domain_name (0.6.20240107)
dotenv (3.1.0)
et-orbi (1.2.11)
tzinfo
event_emitter (0.2.6)
faraday (1.10.3)
Expand All @@ -48,19 +47,18 @@ GEM
faraday-rack (1.0.0)
faraday-retry (1.0.3)
ffi (1.16.3)
fugit (1.9.0)
fugit (1.10.1)
et-orbi (~> 1, >= 1.2.7)
raabro (~> 1.4)
google-apis-core (0.11.1)
google-apis-core (0.11.3)
addressable (~> 2.5, >= 2.5.1)
googleauth (>= 0.16.2, < 2.a)
httpclient (>= 2.8.1, < 3.a)
mini_mime (~> 1.0)
representable (~> 3.0)
retriable (>= 2.0, < 4.a)
rexml
webrick
google-apis-drive_v3 (0.44.0)
google-apis-drive_v3 (0.46.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-sheets_v4 (0.26.0)
google-apis-core (>= 0.11.0, < 2.a)
Expand All @@ -80,25 +78,26 @@ GEM
http-cookie (1.0.5)
domain_name (~> 0.5)
httpclient (2.8.3)
json (2.6.3)
jwt (2.7.1)
json (2.7.1)
jwt (2.8.1)
base64
language_server-protocol (3.17.0.3)
memoist (0.16.2)
method_source (1.0.0)
mime-types (3.5.1)
mime-types (3.5.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2023.1003)
mime-types-data (3.2024.0305)
mini_mime (1.1.5)
multi_json (1.15.0)
multipart-post (2.3.0)
multipart-post (2.4.0)
netrc (0.11.0)
nokogiri (1.15.4-x86_64-linux)
nokogiri (1.16.3-x86_64-linux)
racc (~> 1.4)
opus-ruby (1.0.1)
ffi
os (1.1.4)
parallel (1.23.0)
parser (3.2.2.4)
parallel (1.24.0)
parser (3.3.0.5)
ast (~> 2.4.1)
racc
pastel (0.8.0)
Expand All @@ -109,11 +108,11 @@ GEM
pry-byebug (3.10.1)
byebug (~> 11.0)
pry (>= 0.13, < 0.15)
public_suffix (5.0.3)
public_suffix (5.0.4)
raabro (1.4.0)
racc (1.7.1)
racc (1.7.3)
rainbow (3.1.1)
regexp_parser (2.8.2)
regexp_parser (2.9.0)
representable (3.2.0)
declarative (< 0.1.0)
trailblazer-option (>= 0.1.1, < 0.2.0)
Expand All @@ -125,46 +124,41 @@ GEM
netrc (~> 0.8)
retriable (3.1.2)
rexml (3.2.6)
rubocop (1.57.1)
base64 (~> 0.1.1)
rubocop (1.62.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.4)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
parser (>= 3.2.1.0)
rubocop-ast (1.31.2)
parser (>= 3.3.0.4)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
rufus-scheduler (3.9.1)
fugit (~> 1.1, >= 1.1.6)
sequel (5.73.0)
sequel (5.78.0)
bigdecimal
signet (0.18.0)
signet (0.19.0)
addressable (~> 2.8)
faraday (>= 0.17.5, < 3.a)
jwt (>= 1.5, < 3.0)
multi_json (~> 1.10)
sqlite3 (1.6.7-x86_64-linux)
sqlite3 (1.7.3-x86_64-linux)
trailblazer-option (0.1.2)
tty-color (0.6.0)
tty-logger (0.6.0)
pastel (~> 0.8)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
tzinfo-data (1.2023.3)
tzinfo-data (1.2024.1)
tzinfo (>= 1.0.0)
uber (0.1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.8.2)
unicode-display_width (2.5.0)
webrick (1.8.1)
websocket (1.2.10)
websocket-client-simple (0.8.0)
event_emitter
Expand Down
11 changes: 6 additions & 5 deletions main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,24 @@
require_relative('models')

bot = Discordrb::Bot.new(token: PRZYPOMINACZ_TOKEN, fancy_log: true)
bot.register_application_command(:create_section, "Tworzy rolę, kategorię i kanały dla strefy", server_id: SERVER_ID) do |cmd|
bot.register_application_command(:create_section, 'Tworzy rolę, kategorię i kanały dla strefy',
server_id: SERVER_ID) do |cmd|
cmd.string('section_name', 'Nazwa strefy', required: true)
end
bot.application_command(:create_section) do |event|
event.respond(content: "On it sir!", ephemeral: true)
event.respond(content: 'On it sir!', ephemeral: true)

section_name = event.options['section_name']
server = event.channel.server

LOGGER.info "Creating role #{section_name}"
role = server.create_role(name: section_name)

allow_role_to_communicate = Discordrb::Permissions.new [:read_messages, :send_messages, :connect, :speak]
allow_role_to_communicate = Discordrb::Permissions.new %i[read_messages send_messages connect speak]
add_role_to_category = Discordrb::Overwrite.new(role, allow: allow_role_to_communicate)

deny_everyone = Discordrb::Permissions.new [:read_messages, :connect]
private_category = Discordrb::Overwrite.new(SERVER_ID, type: "role", deny: deny_everyone)
deny_everyone = Discordrb::Permissions.new %i[read_messages connect]
private_category = Discordrb::Overwrite.new(SERVER_ID, type: 'role', deny: deny_everyone)

LOGGER.info "Creating category #{section_name}"
category = server.create_channel(section_name, 4, permission_overwrites: [private_category, add_role_to_category])
Expand Down

0 comments on commit c23705a

Please sign in to comment.