better erroring

This commit is contained in:
stryan 2022-03-30 12:36:03 -04:00
parent b416edfcf9
commit a2adba3b3d

View File

@ -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()