Skip to content

Commit

Permalink
idk
Browse files Browse the repository at this point in the history
  • Loading branch information
rosetintedcheeks committed Jul 31, 2022
1 parent b83d9ae commit 7308d89
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/*
.vscode/*
*.code-workspace
*.code-workspace
config.json
Empty file modified bot.sh
100755 → 100644
Empty file.
5 changes: 3 additions & 2 deletions commands/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ module.exports = {
if (error) throw error;
request_id = results.insertId;
});
const name = inlineCode(request.request_name);
const message = await interaction.reply({content :'You have requested ' + name + '.', fetchReply: true});
const request_name = inlineCode(request.request_name);
const name = interaction.member.user;
const message = await interaction.reply({content :`${name} has requested ${request_name}.`, fetchReply: true});
connection.end();

/*
Expand Down
3 changes: 2 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"user" : "laravel",
"password" : "Md188RRlvSRcOZJyMOGVCMuw",
"database" : "sac"
}
},
"blutopiaApiKey": "8R3syoLLyrKFFfvyBhYSjgVgvf71xy9kliAaNZS14jwVkrkXk3px3tYZ4Y8RqEpUz5xhcdAummhTa1Yp0iPmpr2NL0nA7hyqsXdG"
}
59 changes: 59 additions & 0 deletions findrequest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,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()
},
};
14 changes: 9 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ client.on('messageCreate', async (message) => {
voiceConnection.destroy();
}
});
const resource = createAudioResource('/srv/http/storage/app/public/' + results[0].location);
const resource = createAudioResource('/srv/laravel/the-mega-site/storage/app/public/' + results[0].location);
player.play(resource);
}
});
Expand Down Expand Up @@ -115,7 +115,7 @@ client.on('voiceStateUpdate', async (oldState, newState) => {
}
}
});
const resource = createAudioResource('/srv/http/storage/app/public/' + result.location);
const resource = createAudioResource('/srv/laravel/the-mega-site/storage/app/public/' + result.location);
player.play(resource);
}
});
Expand All @@ -138,16 +138,20 @@ client.on('interactionCreate', async interaction => {
});

scheduleJob('*/5 * * * *', function() {
const query = pool.query('SELECT id, request_name, filled, announced FROM requests', function (error, results, fields) {
const query = pool.query('SELECT id, request_name, filled, announced, discord_id FROM requests', function (error, results, fields) {
const channel = client.channels.cache.get(guild_config[0].announce_channel);
results.forEach(function(v) {
if(v.filled == 1 && v.announced == 0) {
// announce
channel.send(inlineCode(v.request_name) + ' is on the server.');
channel.send(`<@${v.discord_id}> ${inlineCode(v.request_name)} is on the server.`);
const insertQuery = pool.query('UPDATE requests SET announced = 1 WHERE id = ?', v.id);
}
});
});
//const voiceConnection = getVoiceConnection(message.guild.id);
//guild_config.forEach(function(v) {
//client.
//}
//guild_config.forEach(function(v) {
//const channel = client.channels.cache.get(v.announce_channel); // god i'm an idiot this doesn't actually work need a guild column in requests some day
//channel.send('content');
Expand All @@ -160,4 +164,4 @@ process.on('beforeExit', () => {
});
});

client.login(token);
client.login(token);
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"discord.js": "^13.3.1",
"erlpack": "github:discord/erlpack",
"ffmpeg-static": "^4.4.0",
"jquery": "^3.6.0",
"mysql": "^2.18.1",
"node-schedule": "^2.1.0",
"sodium": "^3.0.2",
Expand Down

0 comments on commit 7308d89

Please sign in to comment.