-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfindrequest.js
59 lines (49 loc) · 1.28 KB
/
findrequest.js
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
const { SlashCommandBuilder, inlineCode, codeBlock } = require('@discordjs/builders');
const { database, blutopiaApiKey } = require('../config.json');
const https = require('https');
module.exports = {
data: new SlashCommandBuilder()
.setName('findbooty')
.setDescription('Looks for a file, and adds it to the server')
.addStringOption(option =>
option.setName('name')
.setDescription('Name of file')
.setRequired(false))
.addStringOption(option =>
option.setName('imdb')
.setDescription('imdb id (tt#####)')
.setRequired(false))
,
async execute(interaction) {
var search = {
name: interaction.options.getString('name'),
imdb: interaction.options.getString('imdb'),
api_token: blutopiaApiKey,
}
const path = '/api/torrents/filter?'
+ 'name=' + search.name + '&'
//+ 'imdb=' + search.imdb + '&'
+ 'api_token=' + search.api_token
;
console.log(path);
const options = {
hostname: 'blutopia.xyz',
port: 443,
path: path,
method: 'GET',
}
const req = https.request(options, res => {
console.log(`statusCode: ${res.statusCode}`)
res.on('data', d => {
d.sort((a, b) => {
})
interaction.reply(codeBlock(
))
token})
})
req.on('error', error => {
console.error(error)
})
req.end()
},
};