我買了,我試圖開發在include中沒有隱式將false轉換爲String>。
match /^kill (.*)|^kill/, :method => :kill
def kill(user, target)
target = target
name = user.name
if target.to_s.include? name || target.to_s.empty?
require 'erb'
phrases = ["<%= name %> (gun) Se pegó un tiro porque el nestea con cloro no funcionó"]
name = user.name
target = target
random_phrase = ERB.new(phrases.sample).result(binding)
@client.send_msg random_phrase
elsif target.include? ['chat', 'todo', 'mundo']
require 'erb'
phrases = ["<%= name %> se arrechó y le cayó a tiros a todo el mundo (gun)"]
name = user.name
target = target
random_phrase = ERB.new(phrases.sample).result(binding)
@client.send_msg random_phrase
else
require 'erb'
phrases = ["<%= name %> (gun) le pegó un tiro a <%= target %> por haberle robado memes"]
name = user.name
target = target
random_phrase = ERB.new(phrases.sample).result(binding)
@client.send_msg random_phrase
end
end
這裏我有兩個錯誤,一個聊天機器人命令有點問題,但我不找出如何解決這些問題
#<TypeError: no implicit conversion of false into String> in `include?'
#<TypeError: no implicit conversion of Array into String> in `include?
我已經嘗試了很多東西,但我不管理這個工作。
錯誤發生在 'if target.to_s.include?名稱&& target.to_s.empty?' 至少第一個 '#<類型錯誤:在include中沒有隱式轉換爲字符串> –