瀏覽代碼

fix reject embed attempt 1

Kylie Jo Swistak 5 年之前
父節點
當前提交
3f5758d547
共有 2 個文件被更改,包括 13 次插入4 次删除
  1. 3 3
      app/responses/reject.rb
  2. 10 1
      bot.rb

+ 3 - 3
app/responses/reject.rb

@@ -14,9 +14,9 @@ def reject_app_embed(app, opts = nil)
 
   fields = []
 
-  app.fields.each do |f|
-    fields.push({ name: f.name, value: f.value, inline: true })
-  end
+  #app.fields.each do |f|
+    #fields.push({ name: f.name, value: f.value, inline: true })
+  #end
 
   if opts
     fields.push({ name: "\u200b", value: "\u200b" })

+ 10 - 1
bot.rb

@@ -1091,6 +1091,14 @@ bot.reaction_add do |event|
   carousel = Carousel.find_by(message_id: event.message.id)
   team_chat = Team.find_by(channel: event.message.channel.id)
   maj = 100
+  star = false
+
+  if stars = event.message.reacted_with(Emoji::STAR)
+    stars.each do |s|
+      u = event.server.member(s.id)
+      star = true if u.roles.map(&:name).include? "Guild Masters"
+    end
+  end
 
   form =
     case app&.author&.name
@@ -1143,7 +1151,7 @@ bot.reaction_add do |event|
 
   vote =
     case
-    when reactions[Emoji::Y]&.count.to_i > maj then :yes
+    when reactions[Emoji::Y]&.count.to_i > maj && star then :yes
     when reactions[Emoji::N]&.count.to_i > maj then :no
     when reactions[Emoji::CHECK]&.count.to_i > 1 then :check
     when reactions[Emoji::CROSS]&.count.to_i > 1 then :cross
@@ -1322,6 +1330,7 @@ bot.reaction_add do |event|
     event.message.delete
     bot.send_temporary_message(event.channel.id, "", 5, false, embed)
     bot.send_message(user.dm.id, "", false, embed)
+
   when [:reactivation, :cross]
     event.message.delete