浏览代码

bug fixes

Kylie Jo Swistak 6 年之前
父节点
当前提交
7688a5f12e
共有 2 个文件被更改,包括 19 次插入17 次删除
  1. 4 2
      app/responses/character.rb
  2. 15 15
      bot.rb

+ 4 - 2
app/responses/character.rb

@@ -11,7 +11,7 @@ def character_embed(char:, img: nil, user: nil, color:, section: nil)
 
   footer_text = "#{user_name} | #{char.active}"
   footer_text += " | #{char.rating}" if char.rating
-  footer_text += " | #{img.category} " if section == :image
+  footer_text += " | #{img&.category} " if section == :image
 
   navigate = "React to Navigate"
   footer_text += " | #{navigate}" unless section.nil?
@@ -285,7 +285,9 @@ def user_char_embed(chars, user)
     fields.push({ name: "#{user_name}'s NPCs", value: npcs.join(", ") })
   end
 
-  allowed = User.find_by(id: chars.first.user_id).level / 10 + 1
+  allowed = User.find_by(id: user.id).level / 10 + 1
+  allowed =
+    user.roles.map(&:name).include?('Nitro Booster') ? allowed + 1 : allowed
 
   embed = Embed.new(
     title: "#{user_name}'s Characters [#{active.count}/#{allowed}]",

+ 15 - 15
bot.rb

@@ -568,18 +568,18 @@ end
 desc = "Learn about Items"
 opts = { "" => "list all items", "item_name" => "show known info for the item" }
 item = Command.new(:item, desc, opts) do |event, name|
-  i = name ? Item.find_by!(name: name.capitalize) : Item.all
-
-  case
-  when name && i
-    item_embed(i)
-  when !name && i
-    item_list_embed(i)
-  else
-    command_error_embed("Error proccessing your request!", item)
-  end
-rescue ActiveRecord::RecordNotFound
-  error_embed("Item Not Found!")
+  #i = name ? Item.find_by!(name: name.capitalize) : Item.all
+
+  #case
+  #when name && i
+    #item_embed(i)
+  #when !name && i
+    #item_list_embed(i)
+  #else
+    #command_error_embed("Error proccessing your request!", item)
+  #end
+#rescue ActiveRecord::RecordNotFound
+  #error_embed("Item Not Found!")
 end
 
 desc = "Add and remove items from characters' inventories"
@@ -743,7 +743,7 @@ team = Command.new(:team, desc, opts) do |event, team_name, action, desc|
     )
   when /apply/i
     members = CharTeam.where(team_id: t.id)
-    if members.count >= 6
+    if members.count < 6
       embed = team_app_embed(t, char, event.server.member(char.user_id))
       msg = bot.send_message(t.channel.to_i, "", false, embed)
 
@@ -784,7 +784,7 @@ commands = [
   poll,
   raffle,
   member,
-  #item,
+  item,
   #inv,
   status,
   afflict,
@@ -1173,7 +1173,7 @@ bot.reaction_add do |event|
       char_id: char.id,
       nsfw: event.channel.nsfw?,
     )
-    carousel.update(id: carousel.id, image_id: img.id)
+    carousel.update(id: carousel.id, image_id: img&.id)
     user =
       case
       when char.user_id.match(/public/i)