diff --git a/main.rb b/main.rb index 12504aa..1a02b8c 100755 --- a/main.rb +++ b/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()