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")
|
||||
end
|
||||
end
|
||||
|
||||
error = false
|
||||
urls = URI.extract(event.content)
|
||||
urls.each do |url|
|
||||
mime_guess = MimeMagic.by_extension(url)
|
||||
@ -90,11 +90,16 @@ bot.message(private: true) do |event|
|
||||
download = Down.download(file.url)
|
||||
FileUtils.mv(download.path, "./spool/#{download.original_filename}")
|
||||
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
|
||||
else
|
||||
folder.submit(Submission.new(url,false,sender))
|
||||
end
|
||||
event.respond("Submission #{i} accepted")
|
||||
if error
|
||||
event.respond("Submission #{i} accepted")
|
||||
end
|
||||
i= i+1
|
||||
end
|
||||
folder.update()
|
||||
|
Loading…
Reference in New Issue
Block a user