 request = require 'request'
+{ type } = Core.db
+
 danbooru = require('request-promise').defaults {
   baseUrl: 'https://danbooru.donmai.us/'
   auth:

        msg.channel.uploadFile request(url), @getFileName(url)
      .catch (e)=>
        msg.reply 'Something went wrong.'
  
  getFileName: (url)=> url.split('/').reverse()[0]


  simple: true
}

Waifu = Core.db.createModel 'Waifu', {
  id: type.string()
  user: type.string()
  waifu: type.string()
}

class DanbooruModule extends BotModule
  init: =>
    {@prefix} = @engine

    @registerCommand 'danbooru', {
      allowDM: true
      aliases: ['d']
    }, (msg, tags, d)=>
      tags = 'rating:safe ' + tags if not d.data.allowNSFW
      qs = {
        random: true
