我收到与announcement.rb
相关的以下错误:
语法错误,意外的tIDENTIFIER,期待keyword_end (SyntaxError)放置“致命错误:”+ e.message
我查看了以下代码,似乎是正确的。有人似乎是错误吗?
Twit::Part.new :announcement do
every 30, :minutes do
ids = @config[:ids].shift(15) # take 25 ids at a time
next if ids.empty? # do not do anything if there are no ids anymore
ids.each do |id|
begin
# look up the user name behind the ID, keep in mind that the
# endpoint for that might be rate limited
username = bot.user(id, skip_status: true)&.screen_name
if username.nil?
@config[:ids] << id
next
end
# finally, tweet the message:
bot.tweet "@#{username} Hey, check out my cool site!”
# and add the id to the :already_tweeted list
@config[:already_tweeted] << id
rescue => e
puts "fatal error: " + e.message
@config[:ids] << id
end
end
bot.save_config
end
end
答案 0 :(得分:5)
"@#{username} Hey, check out my cool site!”
↑
应该是
"@#{username} Hey, check out my cool site!"
↑