better erroring
This commit is contained in:
parent
b416edfcf9
commit
a2adba3b3d
9
main.rb
9
main.rb
@ -81,7 +81,7 @@ bot.message(private: true) do |event|
|
|||||||
event.respond("Submission denied; attached file but I can't figure out the file type")
|
event.respond("Submission denied; attached file but I can't figure out the file type")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
error = false
|
||||||
urls = URI.extract(event.content)
|
urls = URI.extract(event.content)
|
||||||
urls.each do |url|
|
urls.each do |url|
|
||||||
mime_guess = MimeMagic.by_extension(url)
|
mime_guess = MimeMagic.by_extension(url)
|
||||||
@ -90,11 +90,16 @@ bot.message(private: true) do |event|
|
|||||||
download = Down.download(file.url)
|
download = Down.download(file.url)
|
||||||
FileUtils.mv(download.path, "./spool/#{download.original_filename}")
|
FileUtils.mv(download.path, "./spool/#{download.original_filename}")
|
||||||
folder.submit(Submission.new("./spool/#{download.original_filename}",true,sender))
|
folder.submit(Submission.new("./spool/#{download.original_filename}",true,sender))
|
||||||
|
else
|
||||||
|
event.respond("Submission denied; link goes to a piece of media but I can't figure out what it is")
|
||||||
|
error = true
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
folder.submit(Submission.new(url,false,sender))
|
folder.submit(Submission.new(url,false,sender))
|
||||||
end
|
end
|
||||||
event.respond("Submission #{i} accepted")
|
if error
|
||||||
|
event.respond("Submission #{i} accepted")
|
||||||
|
end
|
||||||
i= i+1
|
i= i+1
|
||||||
end
|
end
|
||||||
folder.update()
|
folder.update()
|
||||||
|
Loading…
Reference in New Issue
Block a user