Explorar o código

disallow nsfw chars from appearing anywhere in sfw chat

Kylie Jo Swistak %!s(int64=6) %!d(string=hai) anos
pai
achega
e331914bd9
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      bot.rb

+ 4 - 0
bot.rb

@@ -440,6 +440,10 @@ member = Command.new(:member, desc, opts) do |event, name, section, keyword|
     user_id = UID.match(name)
   when String
     chars = Character.where(name: name)
+    unless event.channel.nsfw?
+      chars = chars.reject { |c| c['rating'] == 'NSFW' }
+    end
+
     char = chars.first if chars.length == 1
 
     if char