Ver código fonte

Auto delete characters of members who leave

Kylie Jo Swistak 5 anos atrás
pai
commit
87ed45befb
1 arquivos alterados com 6 adições e 0 exclusões
  1. 6 0
      bot.rb

+ 6 - 0
bot.rb

@@ -1878,6 +1878,12 @@ end
 
 # This will trigger when anyone leaves the server
 bot.member_leave do |event|
+  chars = Character.where(user_id: event.user.id)
+  chars.each do |char|
+    unless char.active == 'NPC'
+      char.update(active: 'Deleted')
+    end
+  end
 end
 
 # This will trigger when anyone is banned from the server