1.4 - splatoon commands!

This commit is contained in:
Emily 2021-03-01 12:58:39 +11:00
parent 9373d9b2de
commit 58c90ddd9d
4 changed files with 191 additions and 1 deletions

77
src/commands/salmonrun.js Normal file
View File

@ -0,0 +1,77 @@
const Discord = require("discord.js");
const BasePaginator = require('discord-paginator.js');
const fetch = require('node-fetch');
const prettifyMiliseconds = require('pretty-ms');
exports.run = async (client, message, args) =>{
fetch('https://splatoon2.ink/data/coop-schedules.json', { headers: { 'User-Agent': client.config.userAgent }})
.then(res => res.json())
.then(json => {
fetch('https://splatoon2.ink/data/timeline.json', { headers: { 'User-Agent': client.config.userAgent }})
.then(timelineRes => timelineRes.json())
.then(timelineJson => {
const embeds = [];
if ((json.details[0].start_time * 1000) > Date.now() === true) {
embeds.push(
new Discord.MessageEmbed()
.setTitle('Upcoming Salmon Run')
.setColor(client.embedColour(message))
.setImage('https://splatoon2.ink/assets/splatnet/'+json.details[0].stage.image)
.addField('Map', json.details[0].stage.name, true)
.setFooter(`Page 1/2 | Starting in ${prettifyMiliseconds(json.details[0].start_time * 1000 - Date.now(), { secondsDecimalDigits: 0 })} | Data provided by splatoon2.ink`)
);
} else {
embeds.push(
new Discord.MessageEmbed()
.setTitle('Current Salmon Run')
.setColor(client.embedColour(message))
.setThumbnail('https://splatoon2.ink/assets/splatnet'+timelineJson.coop.reward_gear.gear.image)
.setImage('https://splatoon2.ink/assets/splatnet/'+json.details[0].stage.image)
.addField('Map', json.details[0].stage.name, true)
.addField('Reward Gear', timelineJson.coop.reward_gear.gear.name, true)
.addField('Weapons', json.details[0].weapons[0].weapon.name+', '+json.details[0].weapons[1].weapon.name+', '+json.details[0].weapons[2].weapon.name+', '+json.details[0].weapons[3].weapon.name)
.setFooter(`Page 1/2 | Ending in ${prettifyMiliseconds((json.details[0].end_time * 1000) - Date.now(), { secondsDecimalDigits: 0 })} | Data provided by splatoon2.ink`)
);
}
embeds.push(
new Discord.MessageEmbed()
.setTitle('Upcoming Salmon Run')
.setColor(client.embedColour(message))
.setImage('https://splatoon2.ink/assets/splatnet/'+json.details[1].stage.image)
.addField('Map', json.details[1].stage.name, true)
.addField('Weapons', json.details[1].weapons[1].weapon.name+', '+json.details[1].weapons[1].weapon.name+', '+json.details[1].weapons[2].weapon.name+', '+json.details[1].weapons[3].weapon.name)
.setFooter(`Page 2/2 | Starting in ${prettifyMiliseconds(json.details[1].start_time * 1000 - Date.now(), { secondsDecimalDigits: 0 })} | Data provided by splatoon2.ink`)
);
const Paginator = new BasePaginator({
pages: embeds,
timeout: 120000,
filter: (reaction, user) => user.id == message.author.id //to filter the reaction collector
})
Paginator.spawn(message.channel)
});
})
.catch(err => {
message.channel.send(`<:error:466995152976871434> An error has occurred: ${err}`);
});
};
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: "User",
requiredPerms: []
};
exports.help = {
name: "salmonrun",
category: "Splatoon",
description: "Get current map, weapons and gear for salmon run.",
usage: "salmonrun"
};

53
src/commands/splatnet.js Normal file
View File

@ -0,0 +1,53 @@
const Discord = require("discord.js");
const BasePaginator = require('discord-paginator.js');
const fetch = require('node-fetch');
const prettifyMiliseconds = require('pretty-ms');
exports.run = async (client, message, args) =>{
fetch('https://splatoon2.ink//data/merchandises.json', { headers: { 'User-Agent': client.config.userAgent }})
.then(res => res.json())
.then(json => {
const embeds = [];
for ( let i = 0; i < json.merchandises.length; i++ ) {
const embed = new Discord.MessageEmbed()
.setTitle(json.merchandises[i].gear.name)
.setThumbnail('https://splatoon2.ink/assets/splatnet' + json.merchandises[i].gear.image)
.setColor(client.embedColour(message))
.addField('Price', (json.merchandises[i].price).toString(), true)
.addField('Brand', json.merchandises[i].gear.brand.name, true)
.addField('Ability Slots', (json.merchandises[i].gear.rarity + 1).toString(), true)
.addField('Main Ability', json.merchandises[i].skill.name, true)
.addField('Common Ability', json.merchandises[i].gear.brand.frequent_skill.name, true)
.setFooter(`Page ${i+1}/${json.merchandises.length} | Out of stock in ${prettifyMiliseconds(json.merchandises[i].end_time * 1000 - Date.now())} | Data provided by splatoon2.ink`);
embeds.push(embed);
}
const Paginator = new BasePaginator({
pages: embeds,
timeout: 120000,
filter: (reaction, user) => user.id == message.author.id //to filter the reaction collector
})
Paginator.spawn(message.channel)
})
.catch(err => {
message.channel.send(`<:error:466995152976871434> An error has occurred: ${err}`);
});
};
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: "User",
requiredPerms: []
};
exports.help = {
name: "splatnet",
category: "Splatoon",
description: "Get current and upcoming maps and modes for regular, ranked and league battles.",
usage: "splatoonmaps"
};

View File

@ -0,0 +1,60 @@
const Discord = require("discord.js");
const BasePaginator = require('discord-paginator.js');
const fetch = require('node-fetch');
const prettifyMiliseconds = require('pretty-ms');
exports.run = async (client, message, args) =>{
fetch('https://splatoon2.ink/data/schedules.json', { headers: { 'User-Agent': client.config.userAgent }})
.then(res => res.json())
.then(json => {
const embeds = [
new Discord.MessageEmbed()
.setTitle('Current Splatoon 2 Maps')
.setColor(client.embedColour(message))
.addField('<:turf_war:814651383911153692> Turf War', `${json.regular[0].stage_a.name}\n${json.regular[0].stage_b.name}`, true)
.addField(`<:ranked:814651402479468544> Ranked: ${json.gachi[0].rule.name}`, `${json.gachi[0].stage_a.name}\n${json.gachi[0].stage_b.name}`, true)
.addField(`<:league:814651415409590363> League: ${json.league[0].rule.name}`, `${json.league[0].stage_a.name}\n${json.league[0].stage_b.name}`, true)
.setFooter(`Page 1/${json.regular.length} | Maps changing in ${prettifyMiliseconds(json.league[0].end_time * 1000 - Date.now(), { secondsDecimalDigits: 0 })} | Data provided by splatoon2.ink`)
];
for ( let i = 1; i < json.regular.length; i++ ) {
embeds.push(
new Discord.MessageEmbed()
.setTitle('Upcoming Splatoon 2 Maps')
.setColor(client.embedColour(message))
.addField('<:turf_war:814651383911153692> Turf War', `${json.regular[i].stage_a.name}\n${json.regular[i].stage_b.name}`, true)
.addField(`<:ranked:814651402479468544> Ranked: ${json.gachi[i].rule.name}`, `${json.gachi[i].stage_a.name}\n${json.gachi[i].stage_b.name}`, true)
.addField(`<:league:814651415409590363> League: ${json.league[i].rule.name}`, `${json.league[i].stage_a.name}\n${json.league[i].stage_b.name}`, true)
.setFooter(`Page ${i+1}/${json.regular.length} | Available in ${prettifyMiliseconds(json.league[i].start_time * 1000 - Date.now(), { secondsDecimalDigits: 0 })} | Data provided by splatoon2.ink`)
);
}
const Paginator = new BasePaginator({
pages: embeds,
timeout: 120000,
filter: (reaction, user) => user.id == message.author.id //to filter the reaction collector
})
Paginator.spawn(message.channel)
})
.catch(err => {
message.channel.send(`<:error:466995152976871434> An error has occurred: ${err}`);
});
};
exports.conf = {
enabled: true,
guildOnly: false,
aliases: ['splatoonmodes'],
permLevel: "User",
requiredPerms: []
};
exports.help = {
name: "splatoonmaps",
category: "Splatoon",
description: "Get current and upcoming maps and modes for regular, ranked and league battles.",
usage: "splatoonmaps"
};

View File

@ -1,4 +1,4 @@
{
"number": "1.3.14",
"number": "1.4",
"changelog": "**1.3 Changelog:**\n> • Music module has been rewritten for better stability and lots more features\n> • Force disconnecting Woomy from a voice channel no longer breaks music\n> • Music should (hopefully) break less in general\n> • Existing music commands have been rewritten\n> • Added the following new commands: fixmusic, movehere, movesong, playnext, shuffle, songinfo, volume\n> • Updated ship command\n**Notes:**\n> • This will be the final major update to Woomy V1, as we are shifting our focus to Woomy V2, which is a complete rewrite."
}