File size: 678 Bytes
b39afbe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
 * Copyright (c) 2023 MERCENARIES.AI PTE. LTD.
 * All rights reserved.
 */



const script = {
    name: 'nsfwcheck',
  
    exec: async function (ctx, payload) {
      
      const nsfwCheck = ctx.app.nsfwCheck

      const fid = Array.isArray(payload) ? payload[0] : payload.fid
      
      if (fid)
      {
        console.log(fid)
        const obj = await  ctx.app.cdn.get({fid})
        const buffer = Buffer.from(obj.data)

        const result = await nsfwCheck(buffer, {maxDimensions: 0})

        ctx.app.sendMessageToSession(ctx.session.sessionId, JSON.stringify(result.classes), 'text/plain')
        return true
      }
    }
  
  }

  export default script