diff --git a/README.md b/README.md index 06b3557..c8c5aa4 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ https://discord.com/api/oauth2/authorize?client_id=572301609305112596&permission This will authorize the bot for your server and you should see it in your default public channel. The bot will have permissions to read, send and manage messages. -**NOTE:** When you first add the bot to your server, it may show up as offline. This is normal! It can take some time for your server to be cached by the bot. +**NOTE:** When you first add the bot to your server, it may show up as offline. This is normal! It can take some time for your server to be cached by the bot and Discord API backend. # Manual Install If you wish to host this yourself, Dice Maiden requires ruby version 2.4 or higher. Please check the Gemfile for the various gems required. To manage these gems, it is recommended to utilize [Bundler](https://bundler.io/).You will also need to create a bot which can be done at the [discord developer section](https://discordapp.com/developers/applications/me). diff --git a/dice_maiden.rb b/dice_maiden.rb index c0cc3ff..e5f485c 100755 --- a/dice_maiden.rb +++ b/dice_maiden.rb @@ -1,6 +1,6 @@ # Dice bot for Discord # Author: Humblemonk -# Version: 8.6.4 +# Version: 8.7.0 # Copyright (c) 2017. All rights reserved. # !/usr/bin/ruby # If you wish to run a single instance of this bot, please follow the "Manual Install" section of the readme! @@ -116,6 +116,7 @@ @roll_set_results = '' @error_check_roll_set = '' roll_count = 0 + @roll_set_total = 0 error_encountered = false while roll_count < @roll_set.to_i if do_roll(event) == true @@ -135,9 +136,9 @@ log_roll(event) if @launch_option == 'debug' if @comment.to_s.empty? || @comment.to_s.nil? - event.respond(content: "#{@user} Request: `[#{@roll_request.strip}]` Rolls:\n#{@roll_set_results}") + event.respond(content: "#{@user} Request: `[#{@roll_request.strip}]` Rolls:\n#{@roll_set_results}Results Total: `#{@roll_set_total}`") else - event.respond(content: "#{@user} Rolls:\n#{@roll_set_results} Reason: `#{@comment}`") + event.respond(content: "#{@user} Rolls:\n#{@roll_set_results}Results Total: `#{@roll_set_total}`\nReason: `#{@comment}`") end next end diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index db13707..6a3b9a8 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -1,3 +1,9 @@ +## 8.7.0 - 2024-03-25 +### Added +- Refactored Gemfile +- Added total to roll set results +- Added note to readme regarding time it takes for a new server to be cached by discord + ## 8.6.4 - 2024-02-17 ### Added - Refactored Gemfile diff --git a/src/dice_maiden_logic.rb b/src/dice_maiden_logic.rb index 6ceb590..35101b6 100644 --- a/src/dice_maiden_logic.rb +++ b/src/dice_maiden_logic.rb @@ -275,7 +275,12 @@ def do_roll(event) return true end - @dice_result = "Result: `#{roll_result}`" + if @roll_set.nil? + @dice_result = "Result: `#{roll_result}`" + else + @roll_set_total += roll_result + @dice_result = "Result: `#{roll_result}`" + end end def log_roll(event) @@ -287,7 +292,7 @@ def log_roll(event) end else File.open('dice_rolls.log', 'a') do |f| - f.puts "#{@time} Shard: #{@shard} | #{@server}| #{@user} Rolls:\n #{@roll_set_results}" + f.puts "#{@time} Shard: #{@shard} | #{@server}| #{@user} Rolls:\n #{@roll_set_results}Results Total:`#{@roll_set_total}`" end end end