Compare commits
2 commits
75b9d712af
...
0068cde234
Author | SHA1 | Date | |
---|---|---|---|
0068cde234 | |||
2347762ecc |
2 changed files with 53 additions and 1 deletions
|
@ -185,6 +185,52 @@ module.exports = class Splatnet extends Command {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (subCmd === 'salmonrun') {
|
||||||
|
if (client.cache.has('SPLATNET_SR') && Date.now() > client.cache.get('SPLATNET_SR').expiry) {
|
||||||
|
client.cache.delete('SPLATNET_SR');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!client.cache.has('SPLATNET_SR')) {
|
||||||
|
fetch('https://splatoon3.ink/data/schedules.json', { headers: { 'User-Agent': client.config.userAgent} })
|
||||||
|
.then(res => res.json())
|
||||||
|
.then(tlJson => {
|
||||||
|
fetch('https://splatoon3.ink/data/coop.json', { headers: { 'User-Agent': client.config.userAgent} })
|
||||||
|
.then(rewardRes => rewardRes.json())
|
||||||
|
.then(async rewardJson => {
|
||||||
|
const embeds = [];
|
||||||
|
const json = {
|
||||||
|
tl: tlJson.data.coopGroupingSchedule,
|
||||||
|
rw: rewardJson.data.coopResult.monthlyGear
|
||||||
|
};
|
||||||
|
|
||||||
|
embeds.push(new client.EmbedBuilder()
|
||||||
|
.setTitle('Current Salmon Run')
|
||||||
|
.setColor(interaction.guild.members.me.displayColor)
|
||||||
|
.setThumbnail(json.rw.image.url)
|
||||||
|
.setImage(json.tl.regularSchedules.nodes[0].setting.coopStage.image.url)
|
||||||
|
.addFields(
|
||||||
|
{
|
||||||
|
name: 'Stage',
|
||||||
|
value: json.tl.regularSchedules.nodes[0].setting.coopStage.name,
|
||||||
|
inline: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Monthly Gear',
|
||||||
|
value: json.rw.name,
|
||||||
|
inline: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Weapons',
|
||||||
|
value: json.tl.regularSchedules.nodes[0].setting.weapons[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (subCmd === 'gear') {
|
if (subCmd === 'gear') {
|
||||||
if (client.cache.has('SPLATNET_GEAR') && Date.now() > client.cache.get('SPLATNET_GEAR').expiry) {
|
if (client.cache.has('SPLATNET_GEAR') && Date.now() > client.cache.get('SPLATNET_GEAR').expiry) {
|
||||||
client.cache.delete('SPLATNET_GEAR');
|
client.cache.delete('SPLATNET_GEAR');
|
||||||
|
|
|
@ -2,11 +2,17 @@
|
||||||
|
|
||||||
const { REST, Routes } = require('discord.js');
|
const { REST, Routes } = require('discord.js');
|
||||||
const { clientId, token } = require('../botconfig.json');
|
const { clientId, token } = require('../botconfig.json');
|
||||||
const guildId = '413591792185769984';
|
|
||||||
const read = require('fs-readdir-recursive');
|
const read = require('fs-readdir-recursive');
|
||||||
const commands = [];
|
const commands = [];
|
||||||
const commandFiles = read('./commands').filter(file => file.endsWith('.js'));
|
const commandFiles = read('./commands').filter(file => file.endsWith('.js'));
|
||||||
|
|
||||||
|
if (process.argv.length === 2) {
|
||||||
|
console.log('No guild ID provided, deployment failed.');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const guildId = process.argv[2];
|
||||||
|
|
||||||
for (const file of commandFiles) {
|
for (const file of commandFiles) {
|
||||||
const command = new (require(__dirname + '/commands/' + file))(file.substr(file.indexOf('/') + 1).slice(0, -3), file.substr(0, file.indexOf('/')));
|
const command = new (require(__dirname + '/commands/' + file))(file.substr(file.indexOf('/') + 1).slice(0, -3), file.substr(0, file.indexOf('/')));
|
||||||
commands.push({
|
commands.push({
|
||||||
|
|
Loading…
Reference in a new issue